Class NodeOptional

  • All Implemented Interfaces:
    INode, java.io.Serializable

    public class NodeOptional
    extends java.lang.Object
    implements INode
    Represents a grammar optional node (? or []), e.g. ' ( A )? ' or ' [ A ] '.
    The class stores the node.
    See Also:
    Serialized Form
    • Field Detail

      • node

        public INode node
        The node (if null there is no node)
    • Constructor Detail

      • NodeOptional

        public NodeOptional()
        Initializes an empty NodeOptional.
      • NodeOptional

        public NodeOptional​(INode n)
        Initializes a NodeOptional with a node.
        Parameters:
        n - - the node
    • Method Detail

      • addNode

        public void addNode​(INode n)
        Adds a node to the NodeOptional.
        Parameters:
        n - - the node to add
      • present

        public boolean present()
        Returns:
        true if the node exists, false otherwise
      • accept

        public int accept​(IIntVisitor vis)
        Accepts a IIntVisitor visitor with user return data.
        Specified by:
        accept in interface INode
        Parameters:
        vis - - the visitor
        Returns:
        the user Return data
      • accept

        public void accept​(IVoidVisitor vis)
        Accepts a IVoidVisitor visitor} visitor with user return data.
        Specified by:
        accept in interface INode
        Parameters:
        vis - - the visitor