lolo.scans
Class Word
java.lang.Object
|
+--lolo.Scan
|
+--lolo.scans.Scan
|
+--lolo.scans.Word
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- XMLStartOfElement
- public class Word
- extends Scan
A recognizer class to scan for a string (a word).
- Author:
- Bernd Kühl
(bernd@informatik.uni-osnabrueck.de)
- See Also:
- Serialized Form
|
Field Summary |
protected int |
index
Marks the next character inside word to find. |
protected char[] |
word
The word. |
|
Constructor Summary |
Word(java.lang.String word)
Constructs an instance scanning the string word. |
|
Method Summary |
boolean |
equals(java.lang.Object o)
Compares the receiver to the specified object. |
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 |
word
protected final char[] word
- The word.
index
protected transient int index
- Marks the next character inside word to find.
Word
public Word(java.lang.String word)
throws java.lang.IllegalArgumentException
- Constructs an instance scanning the string word.
- Parameters:
word - the string to search.- Throws:
java.lang.IllegalArgumentException - if word is null or contains no character.
reset
public void reset()
- Description copied from class:
Scan
- Resets this instance.
- Overrides:
reset in class Scan
nextChar
public Scan.State nextChar(char ch)
- Description copied from class:
Scan
- Called by a Scanner for every new character.
- Overrides:
nextChar in class Scan
- 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
toString
public java.lang.String toString()
- Returns a string representation of the object.
- Overrides:
toString in class Scan
- Returns:
- a string representation of the object.
hashCode
public int hashCode()
- Returns a hash code value for this object.
- Overrides:
hashCode in class Scan
- Returns:
- a hash code value for this object.
equals
public boolean equals(java.lang.Object o)
- Compares the receiver to the specified object. The result is true if and only if
the argument is not null and is a Word object that represents the String
as this object..
- Overrides:
equals in class Scan
- Returns:
- Compares the receiver to the specified object. The result is true if and only if
the argument is not null and is a Word object that represents the String
as this object..