org.waxeye.ast
Class AST<E extends java.lang.Enum<?>>

java.lang.Object
  extended by org.waxeye.ast.AST<E>
Type Parameters:
E - The node types for the AST.
All Implemented Interfaces:
IAST<E>

public final class AST<E extends java.lang.Enum<?>>
extends java.lang.Object
implements IAST<E>

A class to represent an abstract syntax tree.

Author:
Orlando Hill

Constructor Summary
AST(E type, java.util.List<IAST<E>> children, Position position)
          Creates a new AST.
 
Method Summary
 void acceptASTVisitor(IASTVisitor visitor)
          Accepts the visitor.
 java.lang.String childrenAsString()
          Treats the children of the AST as IChar's and concatenates their values into a String.
 boolean equals(java.lang.Object object)
          
 java.util.List<IAST<E>> getChildren()
          Returns the children.
 Position getPosition()
          Returns the position.
 E getType()
          Returns the type.
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AST

public AST(E type,
           java.util.List<IAST<E>> children,
           Position position)
Creates a new AST.

Parameters:
type - The type of the AST.
children - The children of the AST.
position - The position of the AST.
Method Detail

equals

public boolean equals(java.lang.Object object)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

getChildren

public java.util.List<IAST<E>> getChildren()
Returns the children.

Specified by:
getChildren in interface IAST<E extends java.lang.Enum<?>>
Returns:
Returns the children.

getPosition

public Position getPosition()
Returns the position. Can be null if the AST doesn't have a position set.

Specified by:
getPosition in interface IAST<E extends java.lang.Enum<?>>
Returns:
Returns the position;

getType

public E getType()
Returns the type.

Specified by:
getType in interface IAST<E extends java.lang.Enum<?>>
Returns:
Returns the type.

acceptASTVisitor

public void acceptASTVisitor(IASTVisitor visitor)
Accepts the visitor.

Specified by:
acceptASTVisitor in interface IAST<E extends java.lang.Enum<?>>
Parameters:
visitor - The visitor to accept.

childrenAsString

public final java.lang.String childrenAsString()
Treats the children of the AST as IChar's and concatenates their values into a String.

Specified by:
childrenAsString in interface IAST<E extends java.lang.Enum<?>>
Returns:
The AST's IChar children as a String.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


Waxeye Parser Generator