tip.node
Class AIfThenElseStm

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

public final class AIfThenElseStm
extends PStm

AIfThenElseStm represents the if_then_else alternative of the stm production in the AST.


Constructor Summary
AIfThenElseStm()
          Creates a new AIfThenElseStm node with no children.
AIfThenElseStm(TLPar _token_, PExp _condition_, PStm _then_body_, PStm _else_body_)
          Creates a new AIfThenElseStm node with the given nodes as children.
 
Method Summary
 void apply(Analysis caller)
          Calls the Analysis.caseAIfThenElseStm(AIfThenElseStm) of the Analysis caller.
<A> A
apply(Answer<A> caller)
          Returns the answer for caller by applying this AIfThenElseStm node to the Answer visitor.
<Q> void
apply(Question<Q> caller, Q question)
          Applies this AIfThenElseStm node to the Question visitor caller.
<Q,A> A
apply(QuestionAnswer<Q,A> caller, Q question)
          Returns the answer for caller by applying this AIfThenElseStm node with the question to the QuestionAnswer visitor.
 void checkOptionalInvariant()
           
 AIfThenElseStm clone()
          Returns a deep clone of this AIfThenElseStm node.
 AIfThenElseStm clone(Map<Node,Node> oldToNewMap)
          Creates a deep clone of this AIfThenElseStm 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 AIfThenElseStm node that are accepted by the NodeFilter filter to collection.
 PExp getCondition()
          Returns the PExp node which is the condition child of this AIfThenElseStm node.
<T extends NodeInterface>
void
getDescendants(Collection<T> collection, NodeFilter<T> filter)
          Adds all descendants of this AIfThenElseStm node (including the node itself) that are accepted by the NodeFilter filter to collection.
 PStm getElseBody()
          Returns the PStm node which is the else_body child of this AIfThenElseStm node.
 PStm getThenBody()
          Returns the PStm node which is the then_body child of this AIfThenElseStm node.
 TLPar getToken()
          Returns the TLPar node which is the token child of this AIfThenElseStm node.
 EStm kindPStm()
          Returns the EStm corresponding to the type of this PStm node.
 void setCondition(PExp value)
          Sets the condition child of this AIfThenElseStm node.
 void setElseBody(PStm value)
          Sets the else_body child of this AIfThenElseStm node.
 void setThenBody(PStm value)
          Sets the then_body child of this AIfThenElseStm node.
 void setToken(TLPar value)
          Sets the token child of this AIfThenElseStm node.
 String toString()
          Returns a textual representation of this AIfThenElseStm node.
 
Methods inherited from class tip.node.PStm
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

AIfThenElseStm

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


AIfThenElseStm

public AIfThenElseStm(TLPar _token_,
                      PExp _condition_,
                      PStm _then_body_,
                      PStm _else_body_)
Creates a new AIfThenElseStm node with the given nodes as children. The basic child nodes are removed from their previous parents.

Parameters:
_token_ - the TLPar node for the Token child of this AIfThenElseStm node
_condition_ - the PExp node for the Condition child of this AIfThenElseStm node
_then_body_ - the PStm node for the ThenBody child of this AIfThenElseStm node
_else_body_ - the PStm node for the ElseBody child of this AIfThenElseStm node
Method Detail

clone

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

Specified by:
clone in interface NodeInterface
Specified by:
clone in class PStm
Returns:
a deep clone of this AIfThenElseStm node

clone

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

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

toString

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

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

kindPStm

public EStm kindPStm()
Returns the EStm corresponding to the type of this PStm node.

Specified by:
kindPStm in class PStm
Returns:
the EStm for this node

getToken

public TLPar getToken()
Returns the TLPar node which is the token child of this AIfThenElseStm node.

Specified by:
getToken in class PStm
Returns:
the TLPar node which is the token child of this AIfThenElseStm node

setToken

public void setToken(TLPar value)
Sets the token child of this AIfThenElseStm node.

Parameters:
value - the new token child of this AIfThenElseStm node

getCondition

public PExp getCondition()
Returns the PExp node which is the condition child of this AIfThenElseStm node.

Returns:
the PExp node which is the condition child of this AIfThenElseStm node

setCondition

public void setCondition(PExp value)
Sets the condition child of this AIfThenElseStm node.

Parameters:
value - the new condition child of this AIfThenElseStm node

getThenBody

public PStm getThenBody()
Returns the PStm node which is the then_body child of this AIfThenElseStm node.

Returns:
the PStm node which is the then_body child of this AIfThenElseStm node

setThenBody

public void setThenBody(PStm value)
Sets the then_body child of this AIfThenElseStm node.

Parameters:
value - the new then_body child of this AIfThenElseStm node

getElseBody

public PStm getElseBody()
Returns the PStm node which is the else_body child of this AIfThenElseStm node.

Returns:
the PStm node which is the else_body child of this AIfThenElseStm node

setElseBody

public void setElseBody(PStm value)
Sets the else_body child of this AIfThenElseStm node.

Parameters:
value - the new else_body child of this AIfThenElseStm node

getDescendants

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

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

apply

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