|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttip.node.Node
public abstract class Node
Node
is the superclass of all nodes in the AST.
Constructor Summary | |
---|---|
Node()
|
Method Summary | ||
---|---|---|
abstract void |
apply(Analysis caller)
Applies the Analysis visitor to this node. |
|
abstract
|
apply(Answer<A> caller)
Returns the answer for caller by applying this node to the
Answer visitor. |
|
abstract
|
apply(Question<Q> caller,
Q question)
Applies this node to the Question visitor caller . |
|
abstract
|
apply(QuestionAnswer<Q,A> caller,
Q question)
Returns the answer for answer by applying this node with the
question to the QuestionAnswer visitor. |
|
abstract void |
checkOptionalInvariant()
|
|
abstract Node |
clone()
|
|
abstract Node |
clone(Map<Node,Node> oldToNewMap)
|
|
|
getAncestor(Class<T> classType)
Returns the nearest ancestor of this node (including itself) which is a subclass of classType . |
|
|
getAncestor(Class<T> classType,
Class<? extends NodeInterface> guardClass)
Returns the nearest ancestor of this node (including itself) which is a subclass of classType . |
|
|
getAncestor(NodeFilter<T> filter)
Returns the nearest ancestor of this node (including itself) which is accepted by the NodeFilter filter . |
|
|
getChildren(Class<T> classType)
Returns the collection of children to this node which are subtypes of classType . |
|
abstract
|
getChildren(Collection<T> collection,
NodeFilter<T> filter)
Adds all children of this Node node that are
accepted by the NodeFilter filter to collection . |
|
|
getChildren(NodeFilter<T> filter)
Returns the collection of children to this node which are accepted by the NodeFilter filter . |
|
|
getDescendants(Class<T> classType)
Returns the collection of descendants to this node (including itself) which are subtypes of classType . |
|
|
getDescendants(Class<T> classType,
Class<? extends NodeInterface> guardClass)
Returns the collection of descendants to this node (including itself) which are subtypes of classType . |
|
abstract
|
getDescendants(Collection<T> collection,
NodeFilter<T> filter)
Adds all descendants of this Node node (including the node itself) that are
accepted by the NodeFilter filter to collection . |
|
|
getDescendants(NodeFilter<T> filter)
Returns the collection of descendants to this node (including the node itself) which are accepted by the NodeFilter filter . |
|
boolean |
isOptionalInvariant()
|
|
abstract NodeEnum |
kindNode()
Returns the NodeEnum corresponding to the
type of this Node node. |
|
Node |
parent()
Returns the parent node of this node. |
|
void |
replaceBy(Node node)
Replaces this node by node in the AST. |
|
void |
setOptionalInvariant(boolean value)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Node()
Method Detail |
---|
public abstract Node clone()
clone
in interface NodeInterface
clone
in class Object
public abstract Node clone(Map<Node,Node> oldToNewMap)
clone
in interface NodeInterface
public abstract NodeEnum kindNode()
NodeEnum
corresponding to the
type of this Node
node.
NodeEnum
for this nodepublic Node parent()
parent
in interface NodeInterface
public void replaceBy(Node node)
node
in the AST. If this node has no parent
node, this results in a NullPointerException
.
The replacing node
is removed from its previous parent.
replaceBy
in interface NodeInterface
node
- the node replacing this node in the ASTpublic <T extends NodeInterface> T getAncestor(NodeFilter<T> filter)
NodeFilter
filter
.
Traversal is stopped if the node is guarded by
the NodeFilter
filter
.
getAncestor
in interface NodeInterface
filter
- the NodeFilter
used
public <T extends NodeInterface> T getAncestor(Class<T> classType)
classType
.
getAncestor
in interface NodeInterface
classType
- the superclass used
public <T extends NodeInterface> T getAncestor(Class<T> classType, Class<? extends NodeInterface> guardClass)
classType
. Traversal is stopped
if a subclass of guardClass
is found.
getAncestor
in interface NodeInterface
classType
- the superclass used for filteringguardClass
- the superclass used for guarding
public abstract <T extends NodeInterface> void getDescendants(Collection<T> collection, NodeFilter<T> filter)
Node
node (including the node itself) that are
accepted by the NodeFilter
filter
to collection
.
getDescendants
in interface NodeInterface
collection
- the collection to which the descendants are addedfilter
- the NodeFilter
usedpublic <T extends NodeInterface> Collection<T> getDescendants(NodeFilter<T> filter)
NodeFilter
filter
.
Descandants of nodes which are guarded by the NodeFilter
filter
are not included.
getDescendants
in interface NodeInterface
filter
- the NodeFilter
used
public <T extends NodeInterface> Collection<T> getDescendants(Class<T> classType)
classType
.
getDescendants
in interface NodeInterface
classType
- the supertype for all collected descendants
public <T extends NodeInterface> Collection<T> getDescendants(Class<T> classType, Class<? extends NodeInterface> guardClass)
classType
. Descendants of subtypes of
guardClass
are not included.
getDescendants
in interface NodeInterface
classType
- the supertype for all collected descendants
public abstract <T extends NodeInterface> void getChildren(Collection<T> collection, NodeFilter<T> filter)
Node
node that are
accepted by the NodeFilter
filter
to collection
.
getChildren
in interface NodeInterface
collection
- the collection to which the children are addedfilter
- the NodeFilter
usedpublic <T extends NodeInterface> List<T> getChildren(NodeFilter<T> filter)
NodeFilter
filter
.
getChildren
in interface NodeInterface
filter
- the NodeFilter
used
public <T extends NodeInterface> List<T> getChildren(Class<T> classType)
classType
.
getChildren
in interface NodeInterface
classType
- the supertype for all collected children
public abstract void apply(Analysis caller)
Analysis
visitor to this node.
apply
in interface NodeInterface
caller
- the Analysis
to which this node is appliedpublic abstract <A> A apply(Answer<A> caller)
caller
by applying this node to the
Answer
visitor.
apply
in interface NodeInterface
caller
- the Answer
to which this node is applied
caller
public abstract <Q> void apply(Question<Q> caller, Q question)
Question
visitor caller
.
apply
in interface NodeInterface
caller
- the Question
to which this node is appliedquestion
- the question provided to caller
public abstract <Q,A> A apply(QuestionAnswer<Q,A> caller, Q question)
answer
by applying this node with the
question
to the QuestionAnswer
visitor.
apply
in interface NodeInterface
caller
- the QuestionAnswer
to which this node is appliedquestion
- the question provided to answer
answer
public boolean isOptionalInvariant()
isOptionalInvariant
in interface NodeInterface
public void setOptionalInvariant(boolean value)
setOptionalInvariant
in interface NodeInterface
public abstract void checkOptionalInvariant()
checkOptionalInvariant
in interface NodeInterface
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |