Package org.extendj.neobeaver.ast
Class GRule
- java.lang.Object
-
- org.extendj.neobeaver.ast.ASTNode<ASTNode>
-
- org.extendj.neobeaver.ast.GRule
-
- All Implemented Interfaces:
java.lang.Cloneable,Parser.Symbol
public class GRule extends ASTNode<ASTNode> implements java.lang.Cloneable
-
-
Field Summary
-
Fields inherited from class org.extendj.neobeaver.ast.ASTNode
children, generatedWithCacheCycle, numChildren, parent
-
-
Constructor Summary
Constructors Constructor Description GRule()GRule(List<GComponent> p0, Opt<GPrecedence> p1, Opt<GAction> p2)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(GVisitor vis)voidaddGComponent(GComponent node)Append an element to the GComponent list.voidaddGComponentNoTransform(GComponent node)GRuleclone()GRulecopy()voidflushAttrCache()voidflushCollectionCache()GRulefullCopy()Deprecated.Please use treeCopy or treeCopyNoTransform insteadGActiongetAction()Retrieves the (optional) Action child.Opt<GAction>getActionOpt()Retrieves the optional node for the Action child.Opt<GAction>getActionOptNoTransform()Retrieves the optional node for child Action.GComponentgetGComponent(int i)Retrieves the element at indexiin the GComponent list.List<GComponent>getGComponentList()Retrieves the GComponent list.List<GComponent>getGComponentListNoTransform()Retrieves the GComponent list.GComponentgetGComponentNoTransform(int i)List<GComponent>getGComponents()Retrieves the GComponent list.List<GComponent>getGComponentsNoTransform()Retrieves the GComponent list.intgetNumGComponent()Retrieves the number of children in the GComponent list.intgetNumGComponentNoTransform()Retrieves the number of children in the GComponent list.GPrecedencegetPrecedence()Retrieves the (optional) Precedence child.Opt<GPrecedence>getPrecedenceOpt()Retrieves the optional node for the Precedence child.Opt<GPrecedence>getPrecedenceOptNoTransform()Retrieves the optional node for child Precedence.booleanhasAction()Check whether the optional Action child exists.booleanhasGComponent()Check whether the GComponent list has any children.booleanhasPrecedence()Check whether the optional Precedence child exists.voidinit$Children()Initializes the child array to the correct size.protected booleanis$Equal(ASTNode node)protected intnumChildren()voidsetAction(GAction node)Replaces the (optional) Action child.voidsetActionOpt(Opt<GAction> opt)Replaces the optional node for the Action child.voidsetGComponent(GComponent node, int i)Replaces the GComponent list element at indexiwith the new nodenode.voidsetGComponentList(List<GComponent> list)Replaces the GComponent list.voidsetPrecedence(GPrecedence node)Replaces the (optional) Precedence child.voidsetPrecedenceOpt(Opt<GPrecedence> opt)Replaces the optional node for the Precedence child.GRuletreeCopy()Create a deep copy of the AST subtree at this node.GRuletreeCopyNoTransform()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
-
-
-
-
Constructor Detail
-
GRule
public GRule()
-
GRule
@Constructor(name={"GComponent","Precedence","Action"}, type={"List<GComponent>","Opt<GPrecedence>","Opt<GAction>"}, kind={"List","Opt","Opt"}) public GRule(List<GComponent> p0, Opt<GPrecedence> p1, Opt<GAction> p2)
-
-
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 GRule clone() throws java.lang.CloneNotSupportedException
-
fullCopy
@Deprecated public GRule 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 GRule 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 GRule 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.
-
setGComponentList
public void setGComponentList(List<GComponent> list)
Replaces the GComponent list.- Parameters:
list- The new list node to be used as the GComponent list.
-
getNumGComponent
public int getNumGComponent()
Retrieves the number of children in the GComponent list.- Returns:
- Number of children in the GComponent list.
-
getNumGComponentNoTransform
public int getNumGComponentNoTransform()
Retrieves the number of children in the GComponent list. Calling this method will not trigger rewrites.- Returns:
- Number of children in the GComponent list.
-
getGComponent
public GComponent getGComponent(int i)
Retrieves the element at indexiin the GComponent list.- Parameters:
i- Index of the element to return.- Returns:
- The element at position
iin the GComponent list.
-
hasGComponent
public boolean hasGComponent()
Check whether the GComponent list has any children.- Returns:
trueif it has at least one child,falseotherwise.
-
addGComponent
public void addGComponent(GComponent node)
Append an element to the GComponent list.- Parameters:
node- The element to append to the GComponent list.
-
addGComponentNoTransform
public void addGComponentNoTransform(GComponent node)
-
setGComponent
public void setGComponent(GComponent node, int i)
Replaces the GComponent 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.
-
getGComponentList
@ListChild(name="GComponent") public List<GComponent> getGComponentList()
Retrieves the GComponent list.- Returns:
- The node representing the GComponent list.
-
getGComponentListNoTransform
public List<GComponent> getGComponentListNoTransform()
Retrieves the GComponent list.This method does not invoke AST transformations.
- Returns:
- The node representing the GComponent list.
-
getGComponentNoTransform
public GComponent getGComponentNoTransform(int i)
- Returns:
- the element at index
iin the GComponent list without triggering rewrites.
-
getGComponents
public List<GComponent> getGComponents()
Retrieves the GComponent list.- Returns:
- The node representing the GComponent list.
-
getGComponentsNoTransform
public List<GComponent> getGComponentsNoTransform()
Retrieves the GComponent list.This method does not invoke AST transformations.
- Returns:
- The node representing the GComponent list.
-
setPrecedenceOpt
public void setPrecedenceOpt(Opt<GPrecedence> opt)
Replaces the optional node for the Precedence child. This is theOptnode containing the child Precedence, not the actual child!- Parameters:
opt- The new node to be used as the optional node for the Precedence child.
-
setPrecedence
public void setPrecedence(GPrecedence node)
Replaces the (optional) Precedence child.- Parameters:
node- The new node to be used as the Precedence child.
-
hasPrecedence
public boolean hasPrecedence()
Check whether the optional Precedence child exists.- Returns:
trueif the optional Precedence child exists,falseif it does not.
-
getPrecedence
public GPrecedence getPrecedence()
Retrieves the (optional) Precedence child.- Returns:
- The Precedence child, if it exists. Returns
nullotherwise.
-
getPrecedenceOpt
@OptChild(name="Precedence") public Opt<GPrecedence> getPrecedenceOpt()
Retrieves the optional node for the Precedence child. This is theOptnode containing the child Precedence, not the actual child!- Returns:
- The optional node for child the Precedence child.
-
getPrecedenceOptNoTransform
public Opt<GPrecedence> getPrecedenceOptNoTransform()
Retrieves the optional node for child Precedence. This is theOptnode containing the child Precedence, not the actual child!This method does not invoke AST transformations.
- Returns:
- The optional node for child Precedence.
-
setActionOpt
public void setActionOpt(Opt<GAction> opt)
Replaces the optional node for the Action child. This is theOptnode containing the child Action, not the actual child!- Parameters:
opt- The new node to be used as the optional node for the Action child.
-
setAction
public void setAction(GAction node)
Replaces the (optional) Action child.- Parameters:
node- The new node to be used as the Action child.
-
hasAction
public boolean hasAction()
Check whether the optional Action child exists.- Returns:
trueif the optional Action child exists,falseif it does not.
-
getAction
public GAction getAction()
Retrieves the (optional) Action child.- Returns:
- The Action child, if it exists. Returns
nullotherwise.
-
getActionOpt
@OptChild(name="Action") public Opt<GAction> getActionOpt()
Retrieves the optional node for the Action child. This is theOptnode containing the child Action, not the actual child!- Returns:
- The optional node for child the Action child.
-
-