tip.node
Class ABlock

java.lang.Object
  extended by tip.node.Node
      extended by tip.node.PBlock
          extended by tip.node.ABlock
All Implemented Interfaces:
Cloneable, NodeInterface

public final class ABlock
extends PBlock

ABlock represents the alternative of the block production in the AST.


Constructor Summary
ABlock()
          Creates a new ABlock node with no children.
ABlock(List<? extends PStm> _statements_)
          Creates a new ABlock node with the given nodes as children.
ABlock(List<? extends PStm> _statements_, Map<String,ALocalDecl> _local_env_)
          Creates a new ABlock node with the given nodes as children.
 
Method Summary
 void apply(Analysis caller)
          Calls the Analysis.caseABlock(ABlock) of the Analysis caller.
<A> A
apply(Answer<A> caller)
          Returns the answer for caller by applying this ABlock node to the Answer visitor.
<Q> void
apply(Question<Q> caller, Q question)
          Applies this ABlock node to the Question visitor caller.
<Q,A> A
apply(QuestionAnswer<Q,A> caller, Q question)
          Returns the answer for caller by applying this ABlock node with the question to the QuestionAnswer visitor.
 void checkOptionalInvariant()
           
 ABlock clone()
          Returns a deep clone of this ABlock node.
 ABlock clone(Map<Node,Node> oldToNewMap)
          Creates a deep clone of this ABlock node while putting all old node-new node relations in the map oldToNewMap.
<T extends NodeInterface>
void
getChildren(Collection<T> collection, NodeFilter<T> filter)
          Adds all children of this ABlock node that are accepted by the NodeFilter filter to collection.
<T extends NodeInterface>
void
getDescendants(Collection<T> collection, NodeFilter<T> filter)
          Adds all descendants of this ABlock node (including the node itself) that are accepted by the NodeFilter filter to collection.
 Map<String,ALocalDecl> getLocalEnv()
          Returns the local_env field of this ABlock node.
 LinkedList<PStm> getStatements()
          Returns the possibly empty list of PStm nodes that are the statements children of this ABlock node.
 void setLocalEnv(Map<String,ALocalDecl> value)
          Sets the local_env field of this ABlock node.
 void setStatements(List<? extends PStm> value)
          Sets the statements children of this ABlock node.
 String toString()
          Returns a textual representation of this ABlock node.
 
Methods inherited from class tip.node.PBlock
kindNode
 
Methods inherited from class tip.node.Node
getAncestor, getAncestor, getAncestor, getChildren, getChildren, getDescendants, getDescendants, getDescendants, isOptionalInvariant, parent, replaceBy, setOptionalInvariant
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ABlock

public ABlock()
Creates a new ABlock node with no children.


ABlock

public ABlock(List<? extends PStm> _statements_)
Creates a new ABlock node with the given nodes as children. The basic child nodes are removed from their previous parents.

Parameters:
_statements_ - the list of PStm nodes for the Statements children of this ABlock node

ABlock

public ABlock(List<? extends PStm> _statements_,
              Map<String,ALocalDecl> _local_env_)
Creates a new ABlock node with the given nodes as children. The basic child nodes are removed from their previous parents.

Parameters:
_statements_ - the list of PStm nodes for the Statements children of this ABlock node
_local_env_ - the LocalEnv child of this ABlock node
Method Detail

clone

public ABlock clone()
Returns a deep clone of this ABlock node.

Specified by:
clone in interface NodeInterface
Specified by:
clone in class PBlock
Returns:
a deep clone of this ABlock node

clone

public ABlock clone(Map<Node,Node> oldToNewMap)
Creates a deep clone of this ABlock node while putting all old node-new node relations in the map oldToNewMap.

Specified by:
clone in interface NodeInterface
Specified by:
clone in class PBlock
Parameters:
oldToNewMap - the map filled with the old node-new node relation
Returns:
a deep clone of this ABlock node

toString

public String toString()
Returns a textual representation of this ABlock node.

Overrides:
toString in class Object
Returns:
a textual representation of this ABlock node

getStatements

public LinkedList<PStm> getStatements()
Returns the possibly empty list of PStm nodes that are the statements children of this ABlock node.

Specified by:
getStatements in class PBlock
Returns:
the possibly empty list of PStm nodes that are the statements children of this ABlock node

setStatements

public void setStatements(List<? extends PStm> value)
Sets the statements children of this ABlock node.

Specified by:
setStatements in class PBlock
Parameters:
value - the new statements children of this ABlock node

getLocalEnv

public Map<String,ALocalDecl> getLocalEnv()
Returns the local_env field of this ABlock node.

Specified by:
getLocalEnv in class PBlock
Returns:
the local_env field of this ABlock node

setLocalEnv

public void setLocalEnv(Map<String,ALocalDecl> value)
Sets the local_env field of this ABlock node.

Specified by:
setLocalEnv in class PBlock
Parameters:
value - the new local_env field of this ABlock node

getDescendants

public <T extends NodeInterface> void getDescendants(Collection<T> collection,
                                                     NodeFilter<T> filter)
Adds all descendants of this ABlock node (including the node itself) that are accepted by the NodeFilter filter to collection.

Specified by:
getDescendants in interface NodeInterface
Specified by:
getDescendants in class Node
Parameters:
collection - the collection to which the descendants are added
filter - the NodeFilter used

getChildren

public <T extends NodeInterface> void getChildren(Collection<T> collection,
                                                  NodeFilter<T> filter)
Adds all children of this ABlock node that are accepted by the NodeFilter filter to collection.

Specified by:
getChildren in interface NodeInterface
Specified by:
getChildren in class Node
Parameters:
collection - the collection to which the children are added
filter - the NodeFilter used

checkOptionalInvariant

public void checkOptionalInvariant()
Specified by:
checkOptionalInvariant in interface NodeInterface
Specified by:
checkOptionalInvariant in class Node

apply

public void apply(Analysis caller)
Calls the Analysis.caseABlock(ABlock) of the Analysis caller.

Specified by:
apply in interface NodeInterface
Specified by:
apply in class Node
Parameters:
sw - the Analysis to which this ABlock node is applied

apply

public <A> A apply(Answer<A> caller)
Returns the answer for caller by applying this ABlock node to the Answer visitor.

Specified by:
apply in interface NodeInterface
Specified by:
apply in class Node
Parameters:
caller - the Answer to which this node is applied
Returns:
the answer as returned from caller

apply

public <Q> void apply(Question<Q> caller,
                      Q question)
Applies this ABlock node to the Question visitor caller.

Specified by:
apply in interface NodeInterface
Specified by:
apply in class Node
Parameters:
caller - the Question to which this node is applied
question - the question provided to caller

apply

public <Q,A> A apply(QuestionAnswer<Q,A> caller,
                     Q question)
Returns the answer for caller by applying this ABlock node with the question to the QuestionAnswer visitor.

Specified by:
apply in interface NodeInterface
Specified by:
apply in class Node
Parameters:
caller - the QuestionAnswer to which this node is applied
question - the question provided to caller
Returns:
the answer as returned from caller