com.octagroup.foregej.antlr
Class BaseAST

java.lang.Object
  |
  +--antlr.BaseAST
        |
        +--antlr.CommonAST
              |
              +--antlr.CommonASTWithHiddenTokens
                    |
                    +--com.octagroup.foregej.antlr.BaseAST
All Implemented Interfaces:
antlr.collections.AST, java.io.Serializable
Direct Known Subclasses:
HtmlAST, JavaDocAST, JavaAST

public class BaseAST
extends antlr.CommonASTWithHiddenTokens

The base representation of an AST in the FOREGEJ system.

See Also:
Serialized Form

Field Summary
protected  DynASTFactory astFactory_
          the AST factory that created this token
static int WRAP_PREF_NO
           
static int WRAP_PREF_NONE
           
static int WRAP_PREF_OK
           
 
Fields inherited from class antlr.CommonASTWithHiddenTokens
hiddenAfter, hiddenBefore
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
BaseAST()
          Constructor creates a new BaseAST object.
BaseAST(antlr.collections.AST ast)
          Constructor creates a new BaseAST object.
 
Method Summary
 BaseAST deepCopy()
          Performs a deep copy of the node.
static antlr.collections.AST deepCopy(antlr.collections.AST ast)
           
 boolean equals(java.lang.Object o)
           
 boolean equals(java.lang.Object o1, java.lang.Object o2)
          Compares two objects
 antlr.collections.AST getChildAST(java.lang.Class type)
          DOCUMENT ME!
 java.util.List getChildASTs(java.lang.Class type)
          Returns all the child asts that match the supplied type.
 java.util.List getChildASTsExcluding(java.lang.Class[] excluding)
          Returns all the child asts that do not match the supplied classes.
 antlr.collections.AST getParentAst()
          Returns the parent AST.
 int getWrappingPreference()
          As we invoke the NodeWriter.writewe store how the node prefers to handle wrapping.
 void insertAfter(java.lang.Class afterType, antlr.collections.AST newAst)
          Helper method that inserts an ast after the last occurence of the supplied type.
 void insertFirst(antlr.collections.AST newAst)
          Helper method that replaces a child or ast with a new ast.
 boolean replaceAST(antlr.collections.AST oldAst, antlr.collections.AST newAst)
          Helper method that replaces a child or ast with a new ast.
 void setASTFactory(DynASTFactory factory)
          Sets the factory used to create this AST.
 void setFirstChild(antlr.collections.AST child)
          As we set the first child we update the parent of the child ast to this ast.
 void setFirstChildForced(antlr.collections.AST child)
          As we set the first child we update the parent of the child ast to this ast.
 void setHiddenAfter(BaseToken hiddenAfter)
          Sets the token hidden after this ast.
 void setHiddenBefore(BaseToken hiddenBefore)
          Sets the token hidden before this ast.
 void setNextSibling(antlr.collections.AST sib)
          As we set the next sibling we update the parent ast to the same ast as this node.
 void setNextSiblingForced(antlr.collections.AST sib)
          As we set the next sibling we update the parent ast to the same ast as this node.
 void setParentAst(antlr.collections.AST parent)
          Sets the parent AST.
 void setType(int type)
          Sets the type of this ast.
 java.lang.String toString()
           
 java.lang.String toString(boolean includeComments)
           
 void write(NodeWriter nw)
          DOCUMENT ME!
 
Methods inherited from class antlr.CommonASTWithHiddenTokens
getHiddenAfter, getHiddenBefore, initialize
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, initialize, setText
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, removeChildren, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WRAP_PREF_NONE

public static int WRAP_PREF_NONE

WRAP_PREF_NO

public static int WRAP_PREF_NO

WRAP_PREF_OK

public static int WRAP_PREF_OK

astFactory_

protected DynASTFactory astFactory_
the AST factory that created this token
Constructor Detail

BaseAST

public BaseAST()
Constructor creates a new BaseAST object.

BaseAST

public BaseAST(antlr.collections.AST ast)
Constructor creates a new BaseAST object.
Parameters:
ast - DOCUMENT ME!
Method Detail

getWrappingPreference

public int getWrappingPreference()
As we invoke the NodeWriter.writewe store how the node prefers to handle wrapping.
Returns:
the wrapping preference.

getChildAST

public antlr.collections.AST getChildAST(java.lang.Class type)
DOCUMENT ME!
Parameters:
type - DOCUMENT ME!
Returns:
DOCUMENT ME!

getChildASTs

public java.util.List getChildASTs(java.lang.Class type)
Returns all the child asts that match the supplied type.
Parameters:
type - the type to look for.
Returns:
 

getChildASTsExcluding

public java.util.List getChildASTsExcluding(java.lang.Class[] excluding)
Returns all the child asts that do not match the supplied classes.
Parameters:
excluding - the classes to exclude.
Returns:
all the child asts that do not match the supplied classes.

insertAfter

public void insertAfter(java.lang.Class afterType,
                        antlr.collections.AST newAst)
Helper method that inserts an ast after the last occurence of the supplied type.
Parameters:
afterType - DOCUMENT ME!
newAst - the new ast
Throws:
java.lang.RuntimeException - DOCUMENT ME!

insertFirst

public void insertFirst(antlr.collections.AST newAst)
Helper method that replaces a child or ast with a new ast.
Parameters:
newAst - the new ast

replaceAST

public boolean replaceAST(antlr.collections.AST oldAst,
                          antlr.collections.AST newAst)
Helper method that replaces a child or ast with a new ast.
Parameters:
oldAst - the ast to replace
newAst - the new ast
Returns:
 

write

public void write(NodeWriter nw)
DOCUMENT ME!
Parameters:
nw - DOCUMENT ME!
Throws:
java.lang.RuntimeException - DOCUMENT ME!

equals

public boolean equals(java.lang.Object o1,
                      java.lang.Object o2)
Compares two objects
Parameters:
o1 -  
o2 -  
Returns:
 

deepCopy

public BaseAST deepCopy()
Performs a deep copy of the node.
Returns:
 

deepCopy

public static antlr.collections.AST deepCopy(antlr.collections.AST ast)
Parameters:
ast -  
Returns:
 

toString

public java.lang.String toString(boolean includeComments)
Parameters:
includeComments -  
Returns:
 

toString

public java.lang.String toString()
Overrides:
toString in class antlr.BaseAST
Returns:
 

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
Parameters:
o -  
Returns:
 

setHiddenBefore

public void setHiddenBefore(BaseToken hiddenBefore)
Sets the token hidden before this ast.
Parameters:
hiddenBefore -  

setHiddenAfter

public void setHiddenAfter(BaseToken hiddenAfter)
Sets the token hidden after this ast.
Parameters:
hiddenAfter -  

setASTFactory

public void setASTFactory(DynASTFactory factory)
Sets the factory used to create this AST.

This method is invoked from the AST factory when the token is created.

The factory is used to signal that types have been changed.

Parameters:
factory - the factory that created the AST

setType

public void setType(int type)
Sets the type of this ast.

It also signals to the AST factory that we have modified the type so that the next call to the DynASTFactory scans the tree to replace the created AST with the new type.

Overrides:
setType in class antlr.CommonAST
Parameters:
type -  

setParentAst

public void setParentAst(antlr.collections.AST parent)
Sets the parent AST.
Parameters:
parent - the parent AST

getParentAst

public antlr.collections.AST getParentAst()
Returns the parent AST.
Returns:
the parent AST.

setFirstChild

public void setFirstChild(antlr.collections.AST child)
As we set the first child we update the parent of the child ast to this ast.

We need to update all the siblings of the first child as well.

Overrides:
setFirstChild in class antlr.BaseAST
Parameters:
child -  

setFirstChildForced

public void setFirstChildForced(antlr.collections.AST child)
As we set the first child we update the parent of the child ast to this ast.

We need to update all the siblings of the first child as well.

This method does not check that the new child has a parent specified.

Parameters:
child -  

setNextSibling

public void setNextSibling(antlr.collections.AST sib)
As we set the next sibling we update the parent ast to the same ast as this node.
Overrides:
setNextSibling in class antlr.BaseAST
Parameters:
sib -  

setNextSiblingForced

public void setNextSiblingForced(antlr.collections.AST sib)
As we set the next sibling we update the parent ast to the same ast as this node.

This method does not check that the supplied sibling has a parent AST specified.

Parameters:
sib -  


Copyright © 2003 El Icognito des Noboby. All Rights Reserved.