com.inxar.syntacs.grammar.context_free
Class CFNonTerminal

java.lang.Object
  |
  +--com.inxar.syntacs.grammar.context_free.CFNonTerminal
All Implemented Interfaces:
GrammarSymbol, NonTerminal

public class CFNonTerminal
extends Object
implements NonTerminal

Standard NonTerminal implementation.


Method Summary
 boolean equals(Object other)
           
 IntSet getFirstSet()
          Computes the IntSet Of terminals that is the first set for this GrammarSymbol.
 int getID()
          The globally assigned integer identifier for this GrammarSymbol.
 String getName()
          The common name of the GrammarSymbol.
 IntArray getProductionItems()
          Returns the set of Item ID's which mention this NonTerminal as an IntArray.
 IntArray getReductions()
          Returns an IntArray of Productions which have this NonTerminal as the left hand side.
 int hashCode()
          Since we assume that nonTerminals have unique ID's, we base the hashCode solely upon this (also equals()).
 boolean isNullable()
          Returns true if this item either is Epsilon (case of Terminal) or derives it (case of NonTerminal).
 boolean isTerminal()
          Returns true if this GrammarSymbol is an instanceof Terminal and may safely be cast to a Terminal (or vice versa).
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getID

public int getID()
Description copied from interface: GrammarSymbol
The globally assigned integer identifier for this GrammarSymbol.
Specified by:
getID in interface GrammarSymbol

getName

public String getName()
Description copied from interface: GrammarSymbol
The common name of the GrammarSymbol.
Specified by:
getName in interface GrammarSymbol

isTerminal

public boolean isTerminal()
Description copied from interface: GrammarSymbol
Returns true if this GrammarSymbol is an instanceof Terminal and may safely be cast to a Terminal (or vice versa).
Specified by:
isTerminal in interface GrammarSymbol

getProductionItems

public IntArray getProductionItems()
Description copied from interface: NonTerminal
Returns the set of Item ID's which mention this NonTerminal as an IntArray. This is useful in the calculation of follow sets. Each member in the array corresponds to the ID of an Item [ a dot b ] where a is equal to this NonTerminal.
Specified by:
getProductionItems in interface NonTerminal

getReductions

public IntArray getReductions()
Description copied from interface: NonTerminal
Returns an IntArray of Productions which have this NonTerminal as the left hand side.
Specified by:
getReductions in interface NonTerminal

getFirstSet

public IntSet getFirstSet()
Description copied from interface: GrammarSymbol
Computes the IntSet Of terminals that is the first set for this GrammarSymbol.
Specified by:
getFirstSet in interface GrammarSymbol

isNullable

public boolean isNullable()
Description copied from interface: GrammarSymbol
Returns true if this item either is Epsilon (case of Terminal) or derives it (case of NonTerminal).
Specified by:
isNullable in interface GrammarSymbol

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Since we assume that nonTerminals have unique ID's, we base the hashCode solely upon this (also equals()).
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object