Class GrammarRule

java.lang.Object
  extended byGrammarRule
Direct Known Subclasses:
AugmentedGrammarRule

public class GrammarRule
extends java.lang.Object

A GrammarRule consists of a left-hand side (a single Constituent, the ``product'' or ``mother'' of the rule), and a right-hand side (a list of Constituents, the ``preconditions'' or ``daughters'' of the rule). GrammarRules also have an id for use in tracing, etc.


Field Summary
(package private)  Symbol id
          The id of this GrammarRule.
(package private)  Constituent lhs
          The left-hand side of this GrammarRule.
(package private)  java.util.List rhs
          The right-hand side of this GrammarRule.
 
Constructor Summary
GrammarRule(Symbol id, Constituent lhs, java.util.List rhs)
          Create a new GrammarRule with given parameters.
 
Method Summary
 Symbol getId()
          Return the id of this GrammarRule.
 Constituent getLhs()
          Return the left-hand side of this GrammarRule (a Constituent).
 java.util.List getRhs()
          Return the right-hand side of this GrammarRule (a List of Constituents).
 java.lang.String toString()
          Returns the printable representation of this GrammarRule.
 java.lang.String toString(int next)
          Returns the printable representation of this GrammarRule with the ``index'' marker at position NEXT of the rhs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

Symbol id
The id of this GrammarRule.


lhs

Constituent lhs
The left-hand side of this GrammarRule.


rhs

java.util.List rhs
The right-hand side of this GrammarRule.

Constructor Detail

GrammarRule

public GrammarRule(Symbol id,
                   Constituent lhs,
                   java.util.List rhs)
Create a new GrammarRule with given parameters.

Method Detail

getId

public Symbol getId()
Return the id of this GrammarRule.


getLhs

public Constituent getLhs()
Return the left-hand side of this GrammarRule (a Constituent).


getRhs

public java.util.List getRhs()
Return the right-hand side of this GrammarRule (a List of Constituents).


toString

public java.lang.String toString()
Returns the printable representation of this GrammarRule.


toString

public java.lang.String toString(int next)
Returns the printable representation of this GrammarRule with the ``index'' marker at position NEXT of the rhs.