sjm.parse.chars
Class CharacterAssembly
java.lang.Object
|
+--sjm.parse.Assembly
|
+--sjm.parse.chars.CharacterAssembly
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Enumeration, PubliclyCloneable
- public class CharacterAssembly
- extends Assembly
A CharacterAssembly is an Assembly whose elements are
characters.
- Version:
- 1.0
- Author:
- Steven J. Metsker
- See Also:
Assembly
Field Summary |
protected java.lang.String |
string
the string to consume |
Constructor Summary |
CharacterAssembly(java.lang.String string)
Constructs a CharacterAssembly from the given String. |
Method Summary |
java.lang.String |
consumed(java.lang.String delimiter)
Returns a textual representation of the amount of this
characterAssembly that has been consumed. |
java.lang.String |
defaultDelimiter()
Returns the default string to show between elements
consumed or remaining. |
int |
length()
Returns the number of elements in this assembly. |
java.lang.Object |
nextElement()
Returns the next character. |
java.lang.Object |
peek()
Shows the next object in the assembly, without removing it |
java.lang.String |
remainder(java.lang.String delimiter)
Returns a textual representation of the amount of this
characterAssembly that remains to be consumed. |
Methods inherited from class sjm.parse.Assembly |
clone, elementsConsumed, elementsRemaining, getStack, getTarget, hasMoreElements, pop, push, setTarget, stackIsEmpty, toString, unget |
Methods inherited from class java.lang.Object |
, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
string
protected java.lang.String string
- the string to consume
CharacterAssembly
public CharacterAssembly(java.lang.String string)
- Constructs a CharacterAssembly from the given String.
- Parameters:
String
- the String to consume
consumed
public java.lang.String consumed(java.lang.String delimiter)
- Returns a textual representation of the amount of this
characterAssembly that has been consumed.
- Overrides:
consumed
in class Assembly
- Parameters:
delimiter
- the mark to show between consumed
elements- Returns:
- a textual description of the amount of this
assembly that has been consumed
defaultDelimiter
public java.lang.String defaultDelimiter()
- Returns the default string to show between elements
consumed or remaining.
- Overrides:
defaultDelimiter
in class Assembly
- Returns:
- the default string to show between elements
consumed or remaining
length
public int length()
- Returns the number of elements in this assembly.
- Overrides:
length
in class Assembly
- Returns:
- the number of elements in this assembly
nextElement
public java.lang.Object nextElement()
- Returns the next character.
- Returns:
- the next character from the associated token
string
- Throws:
ArrayIndexOutOfBoundsException
- if there are
no more characters in this assembly's string
peek
public java.lang.Object peek()
- Shows the next object in the assembly, without removing it
- Overrides:
peek
in class Assembly
- Returns:
- the next object
remainder
public java.lang.String remainder(java.lang.String delimiter)
- Returns a textual representation of the amount of this
characterAssembly that remains to be consumed.
- Overrides:
remainder
in class Assembly
- Parameters:
delimiter
- the mark to show between consumed
elements- Returns:
- a textual description of the amount of this
assembly that remains to be consumed