Class GRule

  • All Implemented Interfaces:
    java.lang.Cloneable, Parser.Symbol

    public class GRule
    extends ASTNode<ASTNode>
    implements java.lang.Cloneable
    • Method Detail

      • init$Children

        public void init$Children()
        Initializes the child array to the correct size. Initializes List and Opt nta children.
        Overrides:
        init$Children in class ASTNode<ASTNode>
      • clone

        public GRule clone()
                    throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class ASTNode<ASTNode>
        Throws:
        java.lang.CloneNotSupportedException
      • fullCopy

        @Deprecated
        public GRule fullCopy()
        Deprecated.
        Please use treeCopy or treeCopyNoTransform instead
        Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
        Overrides:
        fullCopy in class ASTNode<ASTNode>
        Returns:
        dangling copy of the subtree at this node
      • 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:
        treeCopyNoTransform in class ASTNode<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.
        Overrides:
        treeCopy in class ASTNode<ASTNode>
        Returns:
        dangling copy of the subtree at this node
      • 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 index i in the GComponent list.
        Parameters:
        i - Index of the element to return.
        Returns:
        The element at position i in the GComponent list.
      • hasGComponent

        public boolean hasGComponent()
        Check whether the GComponent list has any children.
        Returns:
        true if it has at least one child, false otherwise.
      • 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 index i with the new node node.
        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 i in 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 the Opt node 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:
        true if the optional Precedence child exists, false if it does not.
      • getPrecedence

        public GPrecedence getPrecedence()
        Retrieves the (optional) Precedence child.
        Returns:
        The Precedence child, if it exists. Returns null otherwise.
      • getPrecedenceOpt

        @OptChild(name="Precedence")
        public Opt<GPrecedence> getPrecedenceOpt()
        Retrieves the optional node for the Precedence child. This is the Opt node 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 the Opt node 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 the Opt node 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:
        true if the optional Action child exists, false if it does not.
      • getAction

        public GAction getAction()
        Retrieves the (optional) Action child.
        Returns:
        The Action child, if it exists. Returns null otherwise.
      • getActionOpt

        @OptChild(name="Action")
        public Opt<GAction> getActionOpt()
        Retrieves the optional node for the Action child. This is the Opt node containing the child Action, not the actual child!
        Returns:
        The optional node for child the Action child.
      • getActionOptNoTransform

        public Opt<GAction> getActionOptNoTransform()
        Retrieves the optional node for child Action. This is the Opt node containing the child Action, not the actual child!

        This method does not invoke AST transformations.

        Returns:
        The optional node for child Action.