tip.node
Class Start

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

public final class Start
extends Node

The Start node is the topmost node in the AST. It holds the PProgram node which is the initial production of the grammar.


Constructor Summary
Start()
          Creates a new Start node with no children.
Start(AProgram program, EOF eof)
          Creates a new Start node with the given nodes as children.
 
Method Summary
 void apply(Analysis caller)
          Calls the Analysis.caseStart(Start) of the Analysis caller.
<A> A
apply(Answer<A> caller)
          Returns the answer for caller by applying this Start node to the Answer visitor.
<Q> void
apply(Question<Q> caller, Q question)
          Applies this Start node to the Question visitor caller.
<Q,A> A
apply(QuestionAnswer<Q,A> caller, Q question)
          Returns the answer for caller by applying this Start node with the question to the QuestionAnswer visitor.
 void checkOptionalInvariant()
           
 Start clone()
          Returns a deep clone of this Start node.
 Start clone(Map<Node,Node> oldToNewMap)
          Creates a deep clone of this Start 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 Start 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 Start node (including the node itself) that are accepted by the NodeFilter filter to collection.
 EOF getEOF()
          Returns the EOF node which is the eof child of this Start node.
 AProgram getProgram()
          Returns the AProgram node which is the program child of this Start node.
 NodeEnum kindNode()
          Returns the NodeEnum corresponding to the type of this Node node.
 void setEOF(EOF value)
          Sets the eof child of this Start node.
 void setProgram(AProgram value)
          Sets the program child of this Start node.
 String toString()
          Returns a textual representation of this Start node.
 
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

Start

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


Start

public Start(AProgram program,
             EOF eof)
Creates a new Start node with the given nodes as children. The basic child nodes are removed from their previous parents.

Parameters:
program - the AProgram node for the Program child of this Start node
eof - the EOF node for the EOF child of this Start node
Method Detail

clone

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

Specified by:
clone in interface NodeInterface
Specified by:
clone in class Node
Returns:
a deep clone of this Start node

clone

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

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

toString

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

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

kindNode

public NodeEnum kindNode()
Returns the NodeEnum corresponding to the type of this Node node.

Specified by:
kindNode in class Node
Returns:
the NodeEnum for this node

getProgram

public AProgram getProgram()
Returns the AProgram node which is the program child of this Start node.

Returns:
the AProgram node which is the program child of this Start node

setProgram

public void setProgram(AProgram value)
Sets the program child of this Start node.

Parameters:
value - the new program child of this Start node

getEOF

public EOF getEOF()
Returns the EOF node which is the eof child of this Start node.

Returns:
the EOF node which is the eof child of this Start node

setEOF

public void setEOF(EOF value)
Sets the eof child of this Start node.

Parameters:
value - the new eof child of this Start node

getDescendants

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

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

apply

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