public class ASTMatcher
extends java.lang.Object
For example, to compute whether two ASTs subtrees are structurally
isomorphic, use n1.subtreeMatch(new ASTMatcher(), n2)
where
n1
and n2
are the AST root nodes of the subtrees.
For each different concrete AST node type T there is a
public boolean match(T node, Object other)
method
that matches the given node against another object (typically another
AST node, although this is not essential). The default implementations
provided by this class tests whether the other object is a node of the
same type with structurally isomorphic child subtrees. For nodes with
list-valued properties, the child nodes within the list are compared in
order. For nodes with multiple properties, the child nodes are compared
in the order that most closely corresponds to the lexical reading order
of the source program. For instance, for a type declaration node, the
child ordering is: name, superclass, superinterfaces, and body
declarations.
Subclasses may override (extend or reimplement) some or all of the
match
methods in order to define more specialized subtree
matchers.
Constructor and Description |
---|
ASTMatcher()
Creates a new AST matcher instance.
|
ASTMatcher(boolean matchDocTags)
Creates a new AST matcher instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
match(AnonymousClassDeclaration node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ArrayAccess node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ArrayCreation node,
java.lang.Object other)
Returns whether the given node and the other object object match.
|
boolean |
match(ArrayInitializer node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ArrayName node,
java.lang.Object other) |
boolean |
match(ArrayType node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ArrowFunctionExpression node,
java.lang.Object other) |
boolean |
match(AssignmentName assignmentName,
java.lang.Object other) |
boolean |
match(Assignment node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(BlockComment node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(Block node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(BooleanLiteral node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(BreakStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(CatchClause node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(CharacterLiteral node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ClassInstanceCreation node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ConditionalExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ConstructorInvocation node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ContinueStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(DebuggerStatement debuggerStatement,
java.lang.Object other) |
boolean |
match(DoStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(EmptyStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(EnhancedForStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ExportDeclaration exportDeclaration,
java.lang.Object other) |
boolean |
match(ExpressionStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(FieldAccess node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(FieldDeclaration node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ForInStatement node,
java.lang.Object other) |
boolean |
match(ForOfStatement node,
java.lang.Object other) |
boolean |
match(ForStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(FunctionDeclaration node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(FunctionDeclarationStatement functionDeclarationStatement,
java.lang.Object other) |
boolean |
match(FunctionExpression node,
java.lang.Object other) |
boolean |
match(FunctionInvocation node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(FunctionRef node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(FunctionRefParameter node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(IfStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ImportDeclaration node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(InferredType node,
java.lang.Object other) |
boolean |
match(InfixExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(Initializer node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(InstanceofExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(JavaScriptUnit node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(JSdoc node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(LabeledStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(LineComment node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ListExpression node,
java.lang.Object other) |
boolean |
match(MemberRef node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(MetaProperty metaProperty,
java.lang.Object other) |
boolean |
match(Modifier node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ModuleSpecifier moduleSpecifier,
java.lang.Object other) |
boolean |
match(NullLiteral node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(NumberLiteral node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ObjectLiteralField node,
java.lang.Object other) |
boolean |
match(ObjectLiteral node,
java.lang.Object other) |
boolean |
match(ObjectName node,
java.lang.Object other) |
boolean |
match(PackageDeclaration node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ParenthesizedExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(PostfixExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(PrefixExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(PrimitiveType node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(QualifiedName node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(QualifiedType node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(RegularExpressionLiteral node,
java.lang.Object other) |
boolean |
match(RestElementName restElementName,
java.lang.Object other) |
boolean |
match(ReturnStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SimpleName node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SimpleType node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SingleVariableDeclaration node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SpreadElement spreadElement,
java.lang.Object other) |
boolean |
match(StringLiteral node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SuperConstructorInvocation node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SuperFieldAccess node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SuperMethodInvocation node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SwitchCase node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(SwitchStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(TagElement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(TemplateElement templateElement,
java.lang.Object other) |
boolean |
match(TemplateLiteral templateLiteral,
java.lang.Object other) |
boolean |
match(TextElement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ThisExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(ThrowStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(TryStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(TypeDeclarationExpression typeDeclarationExpression,
java.lang.Object other) |
boolean |
match(TypeDeclaration node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(TypeDeclarationStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(TypeLiteral node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(UndefinedLiteral node,
java.lang.Object other) |
boolean |
match(VariableDeclarationExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(VariableDeclarationFragment node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(VariableDeclarationStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(WhileStatement node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
boolean |
match(WithStatement node,
java.lang.Object other) |
boolean |
match(YieldExpression node,
java.lang.Object other)
Returns whether the given node and the other object match.
|
static boolean |
safeEquals(java.lang.Object o1,
java.lang.Object o2)
Returns whether the given objects are equal according to
equals . |
boolean |
safeSubtreeListMatch(java.util.List list1,
java.util.List list2)
Returns whether the given lists of AST nodes match pair wise according
to
ASTNode.subtreeMatch . |
boolean |
safeSubtreeMatch(java.lang.Object node1,
java.lang.Object node2)
Returns whether the given nodes match according to
AST.subtreeMatch . |
public ASTMatcher()
For backwards compatibility, the matcher ignores tag
elements below doc comments by default. Use
ASTMatcher(true)
for a matcher that compares doc tags by default.
public ASTMatcher(boolean matchDocTags)
matchDocTags
- true
if doc comment tags are
to be compared by default, and false
otherwisematch(JSdoc,Object)
public final boolean safeSubtreeListMatch(java.util.List list1, java.util.List list2)
ASTNode.subtreeMatch
.
Note that this is a convenience method, useful for writing recursive subtree matchers.
list1
- the first list of AST nodes
(element type: ASTNode
)list2
- the second list of AST nodes
(element type: ASTNode
)true
if the lists have the same number of elements
and match pair-wise according to ASTNode.subtreeMatch
ASTNode.subtreeMatch(ASTMatcher matcher, Object other)
public final boolean safeSubtreeMatch(java.lang.Object node1, java.lang.Object node2)
AST.subtreeMatch
. Returns false
if one or
the other of the nodes are null
. Returns true
if both nodes are null
.
Note that this is a convenience method, useful for writing recursive subtree matchers.
node1
- the first AST node, or null
; must be an
instance of ASTNode
node2
- the second AST node, or null
; must be an
instance of ASTNode
true
if the nodes match according
to AST.subtreeMatch
or both are null
, and
false
otherwiseASTNode.subtreeMatch(ASTMatcher, Object)
public static boolean safeEquals(java.lang.Object o1, java.lang.Object o2)
equals
. Returns false
if either
node is null
.o1
- the first object, or null
o2
- the second object, or null
true
if the nodes are equal according to
equals
or both null
, and
false
otherwisepublic boolean match(AnonymousClassDeclaration node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ArrayAccess node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ArrayCreation node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ArrayInitializer node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ArrayType node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(Assignment node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(Block node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(BlockComment node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type. Subclasses may override this method as needed.
Note: LineComment
and BlockComment
nodes are
not considered part of main structure of the AST. This method will
only be called if a client goes out of their way to visit this
kind of node explicitly.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(BooleanLiteral node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(BreakStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(FunctionExpression node, java.lang.Object other)
public boolean match(CatchClause node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(CharacterLiteral node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(RegularExpressionLiteral node, java.lang.Object other)
public boolean match(ClassInstanceCreation node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(JavaScriptUnit node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ConditionalExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ConstructorInvocation node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ContinueStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(DoStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(EmptyStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(EnhancedForStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ExpressionStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(FieldAccess node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(FieldDeclaration node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ForStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ForInStatement node, java.lang.Object other)
public boolean match(ForOfStatement node, java.lang.Object other)
forOfStatement
- other
- public boolean match(IfStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ImportDeclaration node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(InferredType node, java.lang.Object other)
public boolean match(InfixExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(InstanceofExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(Initializer node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(JSdoc node, java.lang.Object other)
Unlike other node types, the behavior of the default
implementation is controlled by a constructor-supplied
parameter ASTMatcher(boolean)
which is false
if not specified.
When this parameter is true
, the implementation
tests whether the other object is also a Javadoc
with structurally isomorphic child subtrees; the comment string
(Javadoc.getComment()
) is ignored.
Conversely, when the parameter is false
, the
implementation tests whether the other object is also a
Javadoc
with exactly the same comment string;
the tag elements (Javadoc.tags
are
ignored. Subclasses may reimplement.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
ASTMatcher()
,
ASTMatcher(boolean)
public boolean match(LabeledStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(LineComment node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type. Subclasses may override this method as needed.
Note: LineComment
and BlockComment
nodes are
not considered part of main structure of the AST. This method will
only be called if a client goes out of their way to visit this
kind of node explicitly.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ListExpression node, java.lang.Object other)
public boolean match(MemberRef node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(FunctionRef node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(FunctionRefParameter node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(FunctionDeclaration node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
Note that extra array dimensions are compared since they are an important part of the method declaration.
Note that the method return types are compared even for constructor declarations.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(FunctionInvocation node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(Modifier node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(NullLiteral node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(UndefinedLiteral node, java.lang.Object other)
public boolean match(NumberLiteral node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(PackageDeclaration node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ParenthesizedExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(PostfixExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(PrefixExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(PrimitiveType node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(QualifiedName node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(QualifiedType node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ReturnStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(SimpleName node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(SimpleType node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(SingleVariableDeclaration node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
Note that extra array dimensions and the variable arity flag are compared since they are both important parts of the declaration.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(StringLiteral node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(SuperConstructorInvocation node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(SuperFieldAccess node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(SuperMethodInvocation node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(SwitchCase node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(SwitchStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(TagElement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(TextElement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ThisExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ThrowStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(TryStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(TypeDeclaration node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(TypeDeclarationStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(TypeLiteral node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(VariableDeclarationExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(VariableDeclarationFragment node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
Note that extra array dimensions are compared since they are an important part of the type of the variable.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(VariableDeclarationStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(WhileStatement node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(WithStatement node, java.lang.Object other)
public boolean match(ObjectLiteral node, java.lang.Object other)
public boolean match(ObjectLiteralField node, java.lang.Object other)
public boolean match(YieldExpression node, java.lang.Object other)
The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed.
node
- the nodeother
- the other object, or null
true
if the subtree matches, or
false
if they do not match or the other object has a
different node type or is null
public boolean match(ArrowFunctionExpression node, java.lang.Object other)
arrowFunctionExpression
- other
- public boolean match(DebuggerStatement debuggerStatement, java.lang.Object other)
debuggerStatement
- other
- public boolean match(ArrayName node, java.lang.Object other)
arrayName
- other
- public boolean match(ObjectName node, java.lang.Object other)
objectName
- other
- public boolean match(TemplateElement templateElement, java.lang.Object other)
templateElement
- other
- public boolean match(TemplateLiteral templateLiteral, java.lang.Object other)
templateLiteral
- other
- public boolean match(AssignmentName assignmentName, java.lang.Object other)
assignmentName
- other
- public boolean match(RestElementName restElementName, java.lang.Object other)
restElementName
- other
- public boolean match(SpreadElement spreadElement, java.lang.Object other)
spreadElement
- other
- public boolean match(MetaProperty metaProperty, java.lang.Object other)
metaProperty
- other
- public boolean match(ModuleSpecifier moduleSpecifier, java.lang.Object other)
moduleSpecifier
- other
- public boolean match(ExportDeclaration exportDeclaration, java.lang.Object other)
exportDeclaration
- other
- public boolean match(TypeDeclarationExpression typeDeclarationExpression, java.lang.Object other)
typeDeclarationExpression
- other
- public boolean match(FunctionDeclarationStatement functionDeclarationStatement, java.lang.Object other)
functionDeclarationStatement
- other
- Copyright (c) IBM Corp. and others 2000, 2016. All Rights Reserved.