Class NodeChoice

java.lang.Object
EDU.purdue.jtb.parser.syntaxtree.NodeChoice
All Implemented Interfaces:
INode, Serializable

public class NodeChoice extends 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:
  • Field Details

    • 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 Details

    • 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 Details

    • 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