org.eclipse.emf.codegen.merge.java
Class JPatternDictionary

java.lang.Object
  extended by org.eclipse.emf.codegen.merge.java.facade.FacadeVisitor
      extended by org.eclipse.emf.codegen.merge.java.JPatternDictionary

public class JPatternDictionary
extends FacadeVisitor

A dictionary of signatures and JNodes.


Field Summary
protected  java.util.Map<java.lang.String,JAbstractType> abstractTypeMap
           
protected  java.util.Map<java.lang.String,JAnnotation> annotationMap
           
protected  java.util.Map<java.lang.String,JAnnotationTypeMember> annotationTypeMemberMap
           
protected static java.util.regex.Pattern COMMENT
           
protected  JControlModel controlModel
           
protected static boolean DEBUG
           
protected  java.util.Map<java.lang.String,JEnumConstant> enumConstantMap
           
protected  java.util.Map<java.lang.String,JField> fieldMap
           
protected  java.util.Map<java.lang.String,JImport> importMap
           
protected  java.util.Map<java.lang.String,JInitializer> initializerMap
           
protected  JPackage jPackage
           
protected  java.util.Map<java.lang.String,java.util.Collection<JNode>> markupMap
           
protected  java.util.Map<java.lang.String,JMethod> methodMap
           
protected static java.lang.Object[] NO_ARGUMENTS
           
protected  java.util.Map<JNode,java.lang.String> nodeIdentifierMap
           
protected  java.util.Set<java.lang.String> noImportSet
           
 
Fields inherited from class org.eclipse.emf.codegen.merge.java.facade.FacadeVisitor
rootNode
 
Constructor Summary
JPatternDictionary(JCompilationUnit compilationUnit, JControlModel controlModel)
           
 
Method Summary
protected  void beforeVisit(JNode node)
           
protected  java.lang.String checkSelection(java.lang.String selection, JControlModel.DictionaryPattern dictionaryPattern, JNode node)
          Checks the selection to fix the problem with facade implementations that assign wrong javadoc to the node.
protected static
<K,V> java.lang.String
dumpMap(java.lang.String lineIndent, java.util.Map<K,V> map)
           
protected  void dumpMaps()
           
 java.util.Map<java.lang.String,JAbstractType> getAbstractTypeMap()
           
 java.util.Map<java.lang.String,JAnnotation> getAnnotationMap()
           
 java.util.Map<java.lang.String,JAnnotationTypeMember> getAnnotationTypeMemberMap()
           
protected  java.lang.String getDefaultNodeIdentifier(JNode node)
           
 java.util.Map<java.lang.String,JEnumConstant> getEnumConstantMap()
           
 java.util.Map<java.lang.String,JField> getFieldMap()
           
 java.util.Map<java.lang.String,JImport> getImportMap()
           
 java.util.Map<java.lang.String,JInitializer> getInitializerMap()
           
 JPackage getJPackage()
           
 java.util.Map<java.lang.String,java.util.Collection<JNode>> getMarkupMap()
           
 java.util.Map<java.lang.String,JMethod> getMethodMap()
           
 JNode getNode(java.lang.String nodeIdentifier)
           
 java.lang.String getNodeIdentifier(JNode node)
           
 java.util.Map<java.lang.String,? extends JNode> getNodeMap(JNode node)
           
protected  java.util.Set<java.lang.String> getNoImporterSet()
           
 boolean isMarkedUp(java.util.regex.Pattern markupPattern, JNode node)
           
 boolean isMarkedUp(java.util.regex.Pattern markupPattern, java.util.regex.Pattern parentMarkupPattern, JNode node)
          Determines if the node is marked up based on the node and parent markup.
 boolean isNoImport(JImport jImport)
           
protected  void markupNode(java.lang.String selection, JControlModel.DictionaryPattern dictionaryPattern, JNode node)
          Matches pattern in dictionary pattern against selection, and marks up node with all matching groups.
protected  void markupNode(java.lang.String markup, JNode node)
          Marks up node with the given markup string.
 void reset()
          Resets this JPatternDictionary.
protected  boolean visit(JAbstractType abstractType)
           
protected  boolean visit(JAnnotation annotation)
           
protected  boolean visit(JAnnotationTypeMember annotationTypeMember)
           
protected  boolean visit(JCompilationUnit compilationUnit)
           
protected  boolean visit(JEnumConstant enumConstant)
           
protected  boolean visit(JField field)
           
protected  boolean visit(JImport jImport)
           
protected  boolean visit(JInitializer initializer)
           
protected  boolean visit(JMethod method)
           
protected  boolean visit(JPackage jPackage)
           
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.FacadeVisitor
afterVisit, afterVisitChildren, basicVisit, dispatch, getRootNode, start, visit, visitChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMENT

protected static final java.util.regex.Pattern COMMENT

NO_ARGUMENTS

protected static final java.lang.Object[] NO_ARGUMENTS

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values

controlModel

protected JControlModel controlModel

jPackage

protected JPackage jPackage

annotationMap

protected java.util.Map<java.lang.String,JAnnotation> annotationMap

annotationTypeMemberMap

protected java.util.Map<java.lang.String,JAnnotationTypeMember> annotationTypeMemberMap

enumConstantMap

protected java.util.Map<java.lang.String,JEnumConstant> enumConstantMap

importMap

protected java.util.Map<java.lang.String,JImport> importMap

abstractTypeMap

protected java.util.Map<java.lang.String,JAbstractType> abstractTypeMap

initializerMap

protected java.util.Map<java.lang.String,JInitializer> initializerMap

fieldMap

protected java.util.Map<java.lang.String,JField> fieldMap

methodMap

protected java.util.Map<java.lang.String,JMethod> methodMap

markupMap

protected java.util.Map<java.lang.String,java.util.Collection<JNode>> markupMap

noImportSet

protected java.util.Set<java.lang.String> noImportSet

nodeIdentifierMap

protected java.util.Map<JNode,java.lang.String> nodeIdentifierMap
Constructor Detail

JPatternDictionary

public JPatternDictionary(JCompilationUnit compilationUnit,
                          JControlModel controlModel)
Method Detail

reset

public void reset()
Resets this JPatternDictionary. After calling this method, it is necessary to invoke FacadeVisitor.start(JNode) passing a compilation unit to reuse this instance.


getJPackage

public JPackage getJPackage()

getNodeMap

public java.util.Map<java.lang.String,? extends JNode> getNodeMap(JNode node)

getImportMap

public java.util.Map<java.lang.String,JImport> getImportMap()

getAbstractTypeMap

public java.util.Map<java.lang.String,JAbstractType> getAbstractTypeMap()

getInitializerMap

public java.util.Map<java.lang.String,JInitializer> getInitializerMap()

getFieldMap

public java.util.Map<java.lang.String,JField> getFieldMap()

getMethodMap

public java.util.Map<java.lang.String,JMethod> getMethodMap()

getAnnotationMap

public java.util.Map<java.lang.String,JAnnotation> getAnnotationMap()

getAnnotationTypeMemberMap

public java.util.Map<java.lang.String,JAnnotationTypeMember> getAnnotationTypeMemberMap()

getEnumConstantMap

public java.util.Map<java.lang.String,JEnumConstant> getEnumConstantMap()

getMarkupMap

public java.util.Map<java.lang.String,java.util.Collection<JNode>> getMarkupMap()

isMarkedUp

public boolean isMarkedUp(java.util.regex.Pattern markupPattern,
                          java.util.regex.Pattern parentMarkupPattern,
                          JNode node)
Determines if the node is marked up based on the node and parent markup.

If both patterns are null, the node is marked up.

If both patterns are not null, the node is marked up if the node itself and its parent is marked up. If the node does not have a parent, the node is marked up if the node itself is marked up.

If only markupPattern or parentMarkupPattern is set, the node is marked up if the node or its parent is marked up respectively.

Parameters:
markupPattern -
parentMarkupPattern -
node -
See Also:
isMarkedUp(Pattern, JNode)

isMarkedUp

public boolean isMarkedUp(java.util.regex.Pattern markupPattern,
                          JNode node)

getNoImporterSet

protected java.util.Set<java.lang.String> getNoImporterSet()

isNoImport

public boolean isNoImport(JImport jImport)

visit

protected boolean visit(JCompilationUnit compilationUnit)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JPackage jPackage)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JAbstractType abstractType)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JImport jImport)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JInitializer initializer)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JField field)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JMethod method)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JAnnotation annotation)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JAnnotationTypeMember annotationTypeMember)
Overrides:
visit in class FacadeVisitor

visit

protected boolean visit(JEnumConstant enumConstant)
Overrides:
visit in class FacadeVisitor

beforeVisit

protected void beforeVisit(JNode node)
Overrides:
beforeVisit in class FacadeVisitor

checkSelection

protected java.lang.String checkSelection(java.lang.String selection,
                                          JControlModel.DictionaryPattern dictionaryPattern,
                                          JNode node)
Checks the selection to fix the problem with facade implementations that assign wrong javadoc to the node.

Parameters:
selection -
dictionaryPattern -
node -
Returns:
null if the node should be skipped

markupNode

protected void markupNode(java.lang.String selection,
                          JControlModel.DictionaryPattern dictionaryPattern,
                          JNode node)
Matches pattern in dictionary pattern against selection, and marks up node with all matching groups.

If pattern matches selection, but no groups are defined, node is marked up with dictionary pattern name.

Parameters:
selection -
dictionaryPattern -
node -

markupNode

protected void markupNode(java.lang.String markup,
                          JNode node)
Marks up node with the given markup string.

Parameters:
markup -
node -

dumpMaps

protected void dumpMaps()

dumpMap

protected static <K,V> java.lang.String dumpMap(java.lang.String lineIndent,
                                                java.util.Map<K,V> map)

getNodeIdentifier

public java.lang.String getNodeIdentifier(JNode node)

getDefaultNodeIdentifier

protected java.lang.String getDefaultNodeIdentifier(JNode node)

getNode

public JNode getNode(java.lang.String nodeIdentifier)

Copyright 2001-2012 IBM Corporation and others.
All Rights Reserved.