Class NodeChoice

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

    public class NodeChoice
    extends java.lang.Object
    implements INode
    Represents a grammar choice (|), e.g. ' ( A | B ) '.
    The class stores the node and the "which" choice indicator (0, 1, ...).
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      INode choice
      The real node
      int total
      The total number of choices
      int which
      The "which" choice indicator
      • Fields inherited from interface EDU.purdue.jtb.parser.syntaxtree.INode

        LS
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeChoice​(INode node)
      Constructs the NodeChoice with a given node and non standard (-1) which choice and total number of choices.
      NodeChoice​(INode node, int whichChoice, int totalChoices)
      Constructs the NodeChoice with a given node, a which choice and a total (not controlled).
    • Field Detail

      • choice

        public INode choice
        The real node
      • which

        public int which
        The "which" choice indicator
      • total

        public int total
        The total number of choices
    • Constructor Detail

      • NodeChoice

        public NodeChoice​(INode node)
        Constructs the NodeChoice with a given node and non standard (-1) which choice and total number of choices.
        Parameters:
        node - - the node
      • NodeChoice

        public NodeChoice​(INode node,
                          int whichChoice,
                          int totalChoices)
        Constructs the NodeChoice with a given node, a which choice and a total (not controlled).
        Parameters:
        node - - the node
        whichChoice - - the which choice
        totalChoices - - the total number of choices
    • Method Detail

      • 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