|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprovided.token.ATokVisitor
public abstract class ATokVisitor
A visitor to an Token that implements ITokVisitor using a dictionary of commands.
Field Summary | |
---|---|
private java.util.Map<java.lang.String,ITokVisitorCmd> |
cmds
The dictionary mapping token id's (names) to associated commands. |
private ITokVisitorCmd |
defaultCmd
The default command to use if there are no command associated with the given host id. |
Constructor Summary | |
---|---|
ATokVisitor()
Constructor that sets the default cmd to one that throws and IllegalArgumentException" for any unknown tokens. |
|
ATokVisitor(ITokVisitorCmd defaultCmd)
Constructor that sets the default cmd to the given command. |
Method Summary | |
---|---|
void |
addCmd(java.lang.String id,
ITokVisitorCmd cmd)
Add a new cmd or replace an existing cmd associated with the given host id. |
java.lang.Object |
caseAt(java.lang.String id,
Token host,
java.lang.Object... params)
Delegates to the ITokVisitorCmd associated with the given host id (name), or if nothing is associated with the id, use the default cmd. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private ITokVisitorCmd defaultCmd
private java.util.Map<java.lang.String,ITokVisitorCmd> cmds
Constructor Detail |
---|
public ATokVisitor()
public ATokVisitor(ITokVisitorCmd defaultCmd)
defaultCmd
- the default cmd to use.Method Detail |
---|
public java.lang.Object caseAt(java.lang.String id, Token host, java.lang.Object... params)
caseAt
in interface ITokVisitor
id
- the name of the host Tokenhost
- the host token itself.params
- vararg list of input parameters that the processing might need.
public void addCmd(java.lang.String id, ITokVisitorCmd cmd)
id
- the id of the host to associate with this visitor.cmd
- The command to associate with the given key value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |