tip.node
Class ABinopExp

java.lang.Object
  extended by tip.node.Node
      extended by tip.node.PExp
          extended by tip.node.ABinopExp
All Implemented Interfaces:
Cloneable, ITyped, NodeInterface

public final class ABinopExp
extends PExp

ABinopExp represents the binop alternative of the exp production in the AST.


Constructor Summary
ABinopExp()
          Creates a new ABinopExp node with no children.
ABinopExp(PExp _left_, PBinop _binop_, PExp _right_)
          Creates a new ABinopExp node with the given nodes as children.
ABinopExp(PExp _left_, PBinop _binop_, PExp _right_, Type _type_)
          Creates a new ABinopExp node with the given nodes as children.
 
Method Summary
 void apply(Analysis caller)
          Calls the Analysis.caseABinopExp(ABinopExp) of the Analysis caller.
<A> A
apply(Answer<A> caller)
          Returns the answer for caller by applying this ABinopExp node to the Answer visitor.
<Q> void
apply(Question<Q> caller, Q question)
          Applies this ABinopExp node to the Question visitor caller.
<Q,A> A
apply(QuestionAnswer<Q,A> caller, Q question)
          Returns the answer for caller by applying this ABinopExp node with the question to the QuestionAnswer visitor.
 void checkOptionalInvariant()
           
 ABinopExp clone()
          Returns a deep clone of this ABinopExp node.
 ABinopExp clone(Map<Node,Node> oldToNewMap)
          Creates a deep clone of this ABinopExp node while putting all old node-new node relations in the map oldToNewMap.
 PBinop getBinop()
          Returns the PBinop node which is the binop child of this ABinopExp node.
<T extends NodeInterface>
void
getChildren(Collection<T> collection, NodeFilter<T> filter)
          Adds all children of this ABinopExp 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 ABinopExp node (including the node itself) that are accepted by the NodeFilter filter to collection.
 PExp getLeft()
          Returns the PExp node which is the left child of this ABinopExp node.
 PExp getRight()
          Returns the PExp node which is the right child of this ABinopExp node.
 Type getType()
          Returns the type field of this ABinopExp node.
 EExp kindPExp()
          Returns the EExp corresponding to the type of this PExp node.
 void setBinop(PBinop value)
          Sets the binop child of this ABinopExp node.
 void setLeft(PExp value)
          Sets the left child of this ABinopExp node.
 void setRight(PExp value)
          Sets the right child of this ABinopExp node.
 void setType(Type value)
          Sets the type field of this ABinopExp node.
 String toString()
          Returns a textual representation of this ABinopExp node.
 
Methods inherited from class tip.node.PExp
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
 
Methods inherited from interface tip.node.NodeInterface
getAncestor, getAncestor, getAncestor, getChildren, getChildren, getDescendants, getDescendants, getDescendants, isOptionalInvariant, parent, replaceBy, setOptionalInvariant
 

Constructor Detail

ABinopExp

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


ABinopExp

public ABinopExp(PExp _left_,
                 PBinop _binop_,
                 PExp _right_)
Creates a new ABinopExp node with the given nodes as children. The basic child nodes are removed from their previous parents.

Parameters:
_left_ - the PExp node for the Left child of this ABinopExp node
_binop_ - the PBinop node for the Binop child of this ABinopExp node
_right_ - the PExp node for the Right child of this ABinopExp node

ABinopExp

public ABinopExp(PExp _left_,
                 PBinop _binop_,
                 PExp _right_,
                 Type _type_)
Creates a new ABinopExp node with the given nodes as children. The basic child nodes are removed from their previous parents.

Parameters:
_left_ - the PExp node for the Left child of this ABinopExp node
_binop_ - the PBinop node for the Binop child of this ABinopExp node
_right_ - the PExp node for the Right child of this ABinopExp node
_type_ - the Type child of this ABinopExp node
Method Detail

clone

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

Specified by:
clone in interface NodeInterface
Specified by:
clone in class PExp
Returns:
a deep clone of this ABinopExp node

clone

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

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

toString

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

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

kindPExp

public EExp kindPExp()
Returns the EExp corresponding to the type of this PExp node.

Specified by:
kindPExp in class PExp
Returns:
the EExp for this node

getLeft

public PExp getLeft()
Returns the PExp node which is the left child of this ABinopExp node.

Returns:
the PExp node which is the left child of this ABinopExp node

setLeft

public void setLeft(PExp value)
Sets the left child of this ABinopExp node.

Parameters:
value - the new left child of this ABinopExp node

getBinop

public PBinop getBinop()
Returns the PBinop node which is the binop child of this ABinopExp node.

Returns:
the PBinop node which is the binop child of this ABinopExp node

setBinop

public void setBinop(PBinop value)
Sets the binop child of this ABinopExp node.

Parameters:
value - the new binop child of this ABinopExp node

getRight

public PExp getRight()
Returns the PExp node which is the right child of this ABinopExp node.

Returns:
the PExp node which is the right child of this ABinopExp node

setRight

public void setRight(PExp value)
Sets the right child of this ABinopExp node.

Parameters:
value - the new right child of this ABinopExp node

getType

public Type getType()
Returns the type field of this ABinopExp node.

Specified by:
getType in interface ITyped
Specified by:
getType in class PExp
Returns:
the type field of this ABinopExp node

setType

public void setType(Type value)
Sets the type field of this ABinopExp node.

Specified by:
setType in interface ITyped
Specified by:
setType in class PExp
Parameters:
value - the new type field of this ABinopExp node

getDescendants

public <T extends NodeInterface> void getDescendants(Collection<T> collection,
                                                     NodeFilter<T> filter)
Adds all descendants of this ABinopExp 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 ABinopExp 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.caseABinopExp(ABinopExp) of the Analysis caller.

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

apply

public <A> A apply(Answer<A> caller)
Returns the answer for caller by applying this ABinopExp 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 ABinopExp 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 ABinopExp 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