com.inxar.syntacs.grammar.regular
Class REInterval

java.lang.Object
  |
  +--com.inxar.syntacs.grammar.regular.REInterval
All Implemented Interfaces:
Cloneable, Interval, RegularExpression
Direct Known Subclasses:
REExpressionTerminator

public class REInterval
extends Object
implements Interval

Standard Interval implementation.


Constructor Summary
REInterval(REGrammar grammar, int ID, int lo, int hi)
          Constructs the REInterval on the given REGrammar, lo and hi interval points, and the assigned ID number.
 
Method Summary
 Object clone()
          See the general explanation of clone() given above.
 boolean equals(Object other)
           
 void follow()
          Triggers the process of computing the follow sets.
 IntSet getFirstSet()
          Returns the IntSet of Intervals which are visible at the logical beginning of the the expression.
 IntSet getFollowSet()
          Returns the "follow set", or the Intervals (input) that may occur directly after encountering this one.
 int getID()
          Returns the globally allocated ID for this Interval.
 IntSet getLastSet()
          Returns the IntSet of Intervals which are visible at the logical end of the the expression.
 int hi()
          Returns the high char in the Interval.
 boolean includes(int c)
          Returns true if the given char (as an int) is within the bounds of this character set.
 boolean isNullable()
          Returns true if this RegularExpression either *is* Epsilon or derives it.
 boolean isTerminator()
          Returns the RTTI specifically to check if this Interval is an instanceof ExpressionTerminator.
 IntIterator iterator()
          Returns an IntIterator over the chars named by this Interval of characters.
 int lo()
          Returns the low char in the Interval.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

REInterval

public REInterval(REGrammar grammar,
                  int ID,
                  int lo,
                  int hi)
Constructs the REInterval on the given REGrammar, lo and hi interval points, and the assigned ID number.
Method Detail

isNullable

public boolean isNullable()
Description copied from interface: RegularExpression
Returns true if this RegularExpression either *is* Epsilon or derives it.
Specified by:
isNullable in interface RegularExpression

getFirstSet

public IntSet getFirstSet()
Description copied from interface: RegularExpression
Returns the IntSet of Intervals which are visible at the logical beginning of the the expression.
Specified by:
getFirstSet in interface RegularExpression

getLastSet

public IntSet getLastSet()
Description copied from interface: RegularExpression
Returns the IntSet of Intervals which are visible at the logical end of the the expression.
Specified by:
getLastSet in interface RegularExpression

getFollowSet

public IntSet getFollowSet()
Description copied from interface: Interval
Returns the "follow set", or the Intervals (input) that may occur directly after encountering this one.
Specified by:
getFollowSet in interface Interval

follow

public void follow()
Description copied from interface: RegularExpression
Triggers the process of computing the follow sets.
Specified by:
follow in interface RegularExpression

iterator

public IntIterator iterator()
Description copied from interface: Interval
Returns an IntIterator over the chars named by this Interval of characters.
Specified by:
iterator in interface Interval

isTerminator

public boolean isTerminator()
Description copied from interface: Interval
Returns the RTTI specifically to check if this Interval is an instanceof ExpressionTerminator. This method is used by some DFA algorithms to find final NFA states in a DFA state. It is faster than the instanceof operator.
Specified by:
isTerminator in interface Interval

equals

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

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from interface: RegularExpression
See the general explanation of clone() given above.
Specified by:
clone in interface RegularExpression

toString

public String toString()
Overrides:
toString in class Object

includes

public boolean includes(int c)
Description copied from interface: Interval
Returns true if the given char (as an int) is within the bounds of this character set.
Specified by:
includes in interface Interval

lo

public int lo()
Description copied from interface: Interval
Returns the low char in the Interval.
Specified by:
lo in interface Interval

hi

public int hi()
Description copied from interface: Interval
Returns the high char in the Interval.
Specified by:
hi in interface Interval

getID

public int getID()
Description copied from interface: Interval
Returns the globally allocated ID for this Interval.
Specified by:
getID in interface Interval