Package org.extendj.neobeaver.ast
Class GGrammar
- java.lang.Object
-
- org.extendj.neobeaver.ast.ASTNode<ASTNode>
-
- org.extendj.neobeaver.ast.GGrammar
-
- All Implemented Interfaces:
java.lang.Cloneable,Parser.Symbol
public class GGrammar extends ASTNode<ASTNode> implements java.lang.Cloneable
-
-
Field Summary
-
Fields inherited from class org.extendj.neobeaver.ast.ASTNode
children, generatedWithCacheCycle, numChildren, parent
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddGDecl(GDecl node)Append an element to the GDecl list.voidaddGDeclNoTransform(GDecl node)GGrammarclone()GGrammarcopy()voidflushAttrCache()voidflushCollectionCache()GGrammarfullCopy()Deprecated.Please use treeCopy or treeCopyNoTransform insteadGDeclgetGDecl(int i)Retrieves the element at indexiin the GDecl list.List<GDecl>getGDeclList()Retrieves the GDecl list.List<GDecl>getGDeclListNoTransform()Retrieves the GDecl list.GDeclgetGDeclNoTransform(int i)List<GDecl>getGDecls()Retrieves the GDecl list.List<GDecl>getGDeclsNoTransform()Retrieves the GDecl list.intgetNumGDecl()Retrieves the number of children in the GDecl list.intgetNumGDeclNoTransform()Retrieves the number of children in the GDecl list.booleanhasGDecl()Check whether the GDecl list has any children.voidinit$Children()Initializes the child array to the correct size.protected booleanis$Equal(ASTNode node)protected intnumChildren()voidsetGDecl(GDecl node, int i)Replaces the GDecl list element at indexiwith the new nodenode.voidsetGDeclList(List<GDecl> list)Replaces the GDecl list.GGrammartreeCopy()Create a deep copy of the AST subtree at this node.GGrammartreeCopyNoTransform()Create a deep copy of the AST subtree at this node.-
Methods inherited from class org.extendj.neobeaver.ast.ASTNode
accept, addChild, astChildIterator, astChildren, doFullTraversal, flushAttrAndCollectionCache, flushCache, flushTreeCache, getChild, getChildNoTransform, getIndexOfChild, getNumChild, getNumChildNoTransform, getParent, getPosition, insertChild, is$Equal, removeChild, resetState, rewrittenNode, setChild, setParent, setPosition, state
-
-
-
-
Method Detail
-
init$Children
public void init$Children()
Initializes the child array to the correct size. Initializes List and Opt nta children.- Overrides:
init$Childrenin classASTNode<ASTNode>
-
numChildren
protected int numChildren()
- Overrides:
numChildrenin classASTNode<ASTNode>
-
flushAttrCache
public void flushAttrCache()
- Overrides:
flushAttrCachein classASTNode<ASTNode>
-
flushCollectionCache
public void flushCollectionCache()
- Overrides:
flushCollectionCachein classASTNode<ASTNode>
-
clone
public GGrammar clone() throws java.lang.CloneNotSupportedException
-
fullCopy
@Deprecated public GGrammar fullCopy()
Deprecated.Please use treeCopy or treeCopyNoTransform insteadCreate a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
-
treeCopyNoTransform
public GGrammar treeCopyNoTransform()
Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.- Overrides:
treeCopyNoTransformin classASTNode<ASTNode>- Returns:
- dangling copy of the subtree at this node
-
treeCopy
public GGrammar treeCopy()
Create a deep copy of the AST subtree at this node. The subtree of this node is traversed to trigger rewrites before copy. The copy is dangling, i.e. has no parent.
-
setGDeclList
public void setGDeclList(List<GDecl> list)
Replaces the GDecl list.- Parameters:
list- The new list node to be used as the GDecl list.
-
getNumGDecl
public int getNumGDecl()
Retrieves the number of children in the GDecl list.- Returns:
- Number of children in the GDecl list.
-
getNumGDeclNoTransform
public int getNumGDeclNoTransform()
Retrieves the number of children in the GDecl list. Calling this method will not trigger rewrites.- Returns:
- Number of children in the GDecl list.
-
getGDecl
public GDecl getGDecl(int i)
Retrieves the element at indexiin the GDecl list.- Parameters:
i- Index of the element to return.- Returns:
- The element at position
iin the GDecl list.
-
hasGDecl
public boolean hasGDecl()
Check whether the GDecl list has any children.- Returns:
trueif it has at least one child,falseotherwise.
-
addGDecl
public void addGDecl(GDecl node)
Append an element to the GDecl list.- Parameters:
node- The element to append to the GDecl list.
-
addGDeclNoTransform
public void addGDeclNoTransform(GDecl node)
-
setGDecl
public void setGDecl(GDecl node, int i)
Replaces the GDecl list element at indexiwith the new nodenode.- Parameters:
node- The new node to replace the old list element.i- The list index of the node to be replaced.
-
getGDeclList
@ListChild(name="GDecl") public List<GDecl> getGDeclList()
Retrieves the GDecl list.- Returns:
- The node representing the GDecl list.
-
getGDeclListNoTransform
public List<GDecl> getGDeclListNoTransform()
Retrieves the GDecl list.This method does not invoke AST transformations.
- Returns:
- The node representing the GDecl list.
-
getGDeclNoTransform
public GDecl getGDeclNoTransform(int i)
- Returns:
- the element at index
iin the GDecl list without triggering rewrites.
-
getGDecls
public List<GDecl> getGDecls()
Retrieves the GDecl list.- Returns:
- The node representing the GDecl list.
-
-