Package org.extendj.neobeaver.ast
Class GProduction
- java.lang.Object
-
- org.extendj.neobeaver.ast.ASTNode<ASTNode>
-
- org.extendj.neobeaver.ast.GDecl
-
- org.extendj.neobeaver.ast.GProduction
-
- All Implemented Interfaces:
java.lang.Cloneable,Parser.Symbol
public class GProduction extends GDecl implements java.lang.Cloneable
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringtokenString_Name-
Fields inherited from class org.extendj.neobeaver.ast.ASTNode
children, generatedWithCacheCycle, numChildren, parent
-
-
Constructor Summary
Constructors Constructor Description GProduction()GProduction(Opt<Type> p0, java.lang.String p1, List<GRule> p2)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(GVisitor vis)voidaddGRule(GRule node)Append an element to the GRule list.voidaddGRuleNoTransform(GRule node)GProductionclone()GProductioncopy()voidflushAttrCache()voidflushCollectionCache()GProductionfullCopy()Deprecated.Please use treeCopy or treeCopyNoTransform insteadGRulegetGRule(int i)Retrieves the element at indexiin the GRule list.List<GRule>getGRuleList()Retrieves the GRule list.List<GRule>getGRuleListNoTransform()Retrieves the GRule list.GRulegetGRuleNoTransform(int i)List<GRule>getGRules()Retrieves the GRule list.List<GRule>getGRulesNoTransform()Retrieves the GRule list.java.lang.StringgetName()Retrieves the value for the lexeme Name.intgetNumGRule()Retrieves the number of children in the GRule list.intgetNumGRuleNoTransform()Retrieves the number of children in the GRule list.TypegetType()Retrieves the (optional) Type child.Opt<Type>getTypeOpt()Retrieves the optional node for the Type child.Opt<Type>getTypeOptNoTransform()Retrieves the optional node for child Type.booleanhasGRule()Check whether the GRule list has any children.booleanhasType()Check whether the optional Type child exists.voidinit$Children()Initializes the child array to the correct size.protected booleanis$Equal(ASTNode node)protected intnumChildren()voidsetGRule(GRule node, int i)Replaces the GRule list element at indexiwith the new nodenode.voidsetGRuleList(List<GRule> list)Replaces the GRule list.voidsetName(java.lang.String value)Replaces the lexeme Name.voidsetType(Type node)Replaces the (optional) Type child.voidsetTypeOpt(Opt<Type> opt)Replaces the optional node for the Type child.GProductiontreeCopy()Create a deep copy of the AST subtree at this node.GProductiontreeCopyNoTransform()Create a deep copy of the AST subtree at this node.-
Methods inherited from class org.extendj.neobeaver.ast.ASTNode
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 classGDecl
-
numChildren
protected int numChildren()
- Overrides:
numChildrenin classGDecl
-
flushAttrCache
public void flushAttrCache()
- Overrides:
flushAttrCachein classGDecl
-
flushCollectionCache
public void flushCollectionCache()
- Overrides:
flushCollectionCachein classGDecl
-
clone
public GProduction clone() throws java.lang.CloneNotSupportedException
-
copy
public GProduction copy()
-
fullCopy
@Deprecated public GProduction 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 GProduction treeCopyNoTransform()
Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.- Specified by:
treeCopyNoTransformin classGDecl- Returns:
- dangling copy of the subtree at this node
-
treeCopy
public GProduction 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.
-
setTypeOpt
public void setTypeOpt(Opt<Type> opt)
Replaces the optional node for the Type child. This is theOptnode containing the child Type, not the actual child!- Parameters:
opt- The new node to be used as the optional node for the Type child.
-
setType
public void setType(Type node)
Replaces the (optional) Type child.- Parameters:
node- The new node to be used as the Type child.
-
hasType
public boolean hasType()
Check whether the optional Type child exists.- Returns:
trueif the optional Type child exists,falseif it does not.
-
getType
public Type getType()
Retrieves the (optional) Type child.- Returns:
- The Type child, if it exists. Returns
nullotherwise.
-
getTypeOpt
@OptChild(name="Type") public Opt<Type> getTypeOpt()
Retrieves the optional node for the Type child. This is theOptnode containing the child Type, not the actual child!- Returns:
- The optional node for child the Type child.
-
getTypeOptNoTransform
public Opt<Type> getTypeOptNoTransform()
Retrieves the optional node for child Type. This is theOptnode containing the child Type, not the actual child!This method does not invoke AST transformations.
- Returns:
- The optional node for child Type.
-
setName
public void setName(java.lang.String value)
Replaces the lexeme Name.- Parameters:
value- The new value for the lexeme Name.
-
getName
@Token(name="Name") public java.lang.String getName()
Retrieves the value for the lexeme Name.- Returns:
- The value for the lexeme Name.
-
setGRuleList
public void setGRuleList(List<GRule> list)
Replaces the GRule list.- Parameters:
list- The new list node to be used as the GRule list.
-
getNumGRule
public int getNumGRule()
Retrieves the number of children in the GRule list.- Returns:
- Number of children in the GRule list.
-
getNumGRuleNoTransform
public int getNumGRuleNoTransform()
Retrieves the number of children in the GRule list. Calling this method will not trigger rewrites.- Returns:
- Number of children in the GRule list.
-
getGRule
public GRule getGRule(int i)
Retrieves the element at indexiin the GRule list.- Parameters:
i- Index of the element to return.- Returns:
- The element at position
iin the GRule list.
-
hasGRule
public boolean hasGRule()
Check whether the GRule list has any children.- Returns:
trueif it has at least one child,falseotherwise.
-
addGRule
public void addGRule(GRule node)
Append an element to the GRule list.- Parameters:
node- The element to append to the GRule list.
-
addGRuleNoTransform
public void addGRuleNoTransform(GRule node)
-
setGRule
public void setGRule(GRule node, int i)
Replaces the GRule 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.
-
getGRuleList
@ListChild(name="GRule") public List<GRule> getGRuleList()
Retrieves the GRule list.- Returns:
- The node representing the GRule list.
-
getGRuleListNoTransform
public List<GRule> getGRuleListNoTransform()
Retrieves the GRule list.This method does not invoke AST transformations.
- Returns:
- The node representing the GRule list.
-
getGRuleNoTransform
public GRule getGRuleNoTransform(int i)
- Returns:
- the element at index
iin the GRule list without triggering rewrites.
-
getGRules
public List<GRule> getGRules()
Retrieves the GRule list.- Returns:
- The node representing the GRule list.
-
-