lolo.scans
Class SetMN
java.lang.Object
|
+--lolo.Scan
|
+--lolo.scans.Scan
|
+--lolo.scans.Set
|
+--lolo.scans.SetMN
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- Int
- public class SetMN
- extends Set
A recognizer class to scan for many characters from a set of characters.
- Author:
- Bernd Kühl
(bernd@informatik.uni-osnabrueck.de)
- See Also:
- Serialized Form
|
Field Summary |
protected int |
jog
Counts the current number of recognized characters. |
protected int |
m
The lower limit. |
protected int |
n
The upper limit. |
|
Constructor Summary |
SetMN(java.lang.String set,
boolean inside,
int m,
int n)
Constructs a recognizer which scans at least m and at most n characters. |
|
Method Summary |
boolean |
equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one. |
int |
hashCode()
Returns a hash code value for this object. |
Scan.State |
nextChar(char ch)
Called by a Scanner for every new character. |
void |
reset()
Resets this instance. |
java.lang.String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
m
protected final int m
- The lower limit.
n
protected final int n
- The upper limit.
jog
protected transient int jog
- Counts the current number of recognized characters.
SetMN
public SetMN(java.lang.String set,
boolean inside,
int m,
int n)
throws java.lang.IllegalArgumentException
- Constructs a recognizer which scans at least m and at most n characters.
If inside is true the characters have to be inside set,
else they have to be oustide of set.
- Parameters:
set - the set of characters.inside - marks if the symbol characters have to be inside or outside set.m - the minimal number of characters.n - the maximum number of characters.
reset
public void reset()
- Description copied from class:
Scan
- Resets this instance.
- Overrides:
reset in class Set
nextChar
public Scan.State nextChar(char ch)
- Description copied from class:
Scan
- Called by a Scanner for every new character.
- Overrides:
nextChar in class Set
- Following copied from class:
lolo.Scan
- Returns:
- a State object to signal whether more characters are wanted and whether a symbol is found.
- See Also:
Scan.State,
Scanner
equals
public boolean equals(java.lang.Object o)
- Indicates whether some other object is "equal to" this one.
- Overrides:
equals in class Set
- Returns:
- whether some other object is "equal to" this one.
hashCode
public int hashCode()
- Returns a hash code value for this object.
- Overrides:
hashCode in class Set
- Returns:
- a hash code value for this object.
toString
public java.lang.String toString()
- Returns a string representation of the object.
- Overrides:
toString in class Set
- Returns:
- a string representation of the object.