|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.argouml.util.CustomSeparator
Base class for custom separators.
It can be instantiated directly, and then works like a separator in the delimiter string. For that purpose you should use the delimiter string in MyTokenizer, unless your token is wider than 32 characters.
You can also subclass this class to provide for more intricate recogition of the tokens. It is known that this class has been subclassed to recognize quoted strings, and balanced parentheses.
You should have this mental image of the tokenizing process:
MyTokenizer
Constructor Summary | |
---|---|
protected |
CustomSeparator()
This constructor is only availible to subclasses of this class. |
|
CustomSeparator(char start)
This constructor creates a new custom separator that matches the character start. |
|
CustomSeparator(java.lang.String start)
This constructor creates a new custom separator that matches the string start. |
Method Summary | |
---|---|
boolean |
addChar(char c)
Called to allow you to decide if you want to capure control of the matching process. |
boolean |
endChar(char c)
Called to check if more characters are expected in the free part of the token. |
boolean |
hasFreePart()
Called to check if more characters are expected to follow after addChar has returned true. |
void |
reset()
Called to reset the separator before staring to look for a new token. |
int |
tokenLength()
Returns the length of the matched token. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected CustomSeparator()
addChar
to recognize when your separator should that control. If you don't,
then you may block all other separators.
public CustomSeparator(char start)
addChar
, the
default behaviour is to return false in addChar until start is
encountered and then hasFreePart returns false.
start
- The start character.public CustomSeparator(java.lang.String start)
addChar
, the
default behaviour is to return false in addChar until start is
encountered and then hasFreePart returns false.
start
- The start String.Method Detail |
public void reset()
public int tokenLength()
public boolean addChar(char c)
hasFreePart
will be checked to see if you
expect more things to follow.
The default behaviour is to return false until the character or String given as parameter to the constructor has been matched.
c
- The next character in the sequence being tokenized.
public boolean hasFreePart()
The default behaviour is to return false.
public boolean endChar(char c)
c
- The next character in the sequence being tokenized.
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2003 (20040229) | ArgoUML Project Home | ArgoUML Cookbook |