Class AbstractJjtreeNode<B extends AbstractJjtreeNode<B,​N>,​N extends JjtreeNode<N>>

    • Field Detail

      • id

        protected final int id
    • Constructor Detail

      • AbstractJjtreeNode

        protected AbstractJjtreeNode​(int id)
        The id is an index in the constant names array generated by jjtree, it must be set to some value that depends on the node type, not some arbitrary "1" or "2", and not necessarily a unique value.
    • Method Detail

      • getImage

        public String getImage()
        Description copied from interface: Node
        Returns a string token, usually filled-in by the parser, which describes some textual characteristic of this node. This is usually an identifier, but you should check that using the Designer. On most nodes though, this method returns null.

        Note: This method will be deprecated in the future (#4787). It will be replaced with methods that have more specific names in node classes. In some cases, there are already alternatives available that should be used.

        Specified by:
        getImage in interface Node
      • setImage

        protected void setImage​(String image)
      • compareLocation

        public final int compareLocation​(Node other)
        Description copied from interface: Node
        Compare the coordinates of this node with the other one as if with Node.COORDS_COMPARATOR. The result is useless if both nodes are not from the same tree.
        Specified by:
        compareLocation in interface Node
        Parameters:
        other - Other node
        Returns:
        A positive integer if this node comes AFTER the other, 0 if they have the same position, a negative integer if this node comes BEFORE the other
      • jjtOpen

        protected void jjtOpen()
        This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.
      • jjtClose

        protected void jjtClose()
        This method is called after all the child nodes have been added.
      • addChild

        protected void addChild​(B child,
                                int index)
        Description copied from class: AbstractNode
        Set the child at the given index to the given node. This resizes the children array to be able to contain the given index. Implementations must take care that this does not leave any "holes" in the array. This method throws if there is already a child at the given index.

        Note that it is more efficient to add children in reverse (from right to left), because the array is resized only the first time.

        This method also calls AbstractNode.setParent(AbstractNode).

        Overrides:
        addChild in class AbstractNode<B extends AbstractJjtreeNode<B,​N>,​N extends JjtreeNode<N>>
        Parameters:
        child - The child to add
        index - The index to which the child will be added
      • insertChild

        protected void insertChild​(B child,
                                   int index)
        Description copied from class: AbstractNode
        Insert a child at the given index, shifting all the following children to the right.
        Overrides:
        insertChild in class AbstractNode<B extends AbstractJjtreeNode<B,​N>,​N extends JjtreeNode<N>>
        Parameters:
        child - New child
        index - Index (must be 0 <= index <= getNumChildren()), i.e. you cannot insert a node beyond the end, because that would leave holes in the array
      • fitTokensToChildren

        protected void fitTokensToChildren​(int index)
        Ensures that the first (resp. last) token of this node is before (resp. after) the first (resp. last) token of the child at the given index. The index
      • setLastToken

        protected void setLastToken​(JavaccToken token)
      • setFirstToken

        protected void setFirstToken​(JavaccToken token)