R - The type of the return valueI - The type of the index valueP - The type of the input parametersH - The type of the host, restricted to being a subclass of IExtVisitorHost<I, ? super H>public abstract class AExtVisitor<R,I,P,H extends IExtVisitorHost<I,? super H>> extends java.lang.Object implements IExtVisitor<R,I,P,H>
public class MyExtVisitor extends AExtVisitor<MyReturn, MyIndex, MyReturn, MyExtVisitorHost> {...}
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<I,IExtVisitorCmd<R,I,P,H>> |
cmds
The dictionary used to store the commands
|
private IExtVisitorCmd<R,I,P,H> |
defaultCmd
The default command to use if no command is associated with a case index value.
|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
AExtVisitor(IExtVisitorCmd<R,I,P,H> defaultCmd)
Constructor that takes a default command to use.
|
AExtVisitor(R noOpResult)
A convenience constructor that takes a value that the default command will return.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends IExtVisitorHost<I,? super H>> |
caseAt(I idx,
T host,
P... params)
Concrete implementation of the parameterized case method that takes
the index value, retrieves an associated IExtVisitor command and
executes the command with the given host and input parameters.
|
IExtVisitorCmd<R,I,P,H> |
getCmd(I idx)
Retrieve the command associated with given index value.
|
IExtVisitorCmd<R,I,P,H> |
getDefaultCmd()
Retrieve the current default command
|
void |
setCmd(I idx,
IExtVisitorCmd<R,I,P,H> cmd)
Associates the given index value with the given command
|
void |
setDefaultCmd(IExtVisitorCmd<R,I,P,H> defaultCmd)
Set the default command to a new value.
|
private static final long serialVersionUID
private java.util.Map<I,IExtVisitorCmd<R,I,P,H extends IExtVisitorHost<I,? super H>>> cmds
private IExtVisitorCmd<R,I,P,H extends IExtVisitorHost<I,? super H>> defaultCmd
public AExtVisitor(IExtVisitorCmd<R,I,P,H> defaultCmd)
defaultCmd - The default command to use.public AExtVisitor(R noOpResult)
noOpResult - The value for the default command to return.public void setCmd(I idx, IExtVisitorCmd<R,I,P,H> cmd)
idx - The index value to use associate with the command.cmd - The command associated with the index valuepublic IExtVisitorCmd<R,I,P,H> getCmd(I idx)
idx - An index valuepublic IExtVisitorCmd<R,I,P,H> getDefaultCmd()
public void setDefaultCmd(IExtVisitorCmd<R,I,P,H> defaultCmd)
defaultCmd - The new default commandpublic <T extends IExtVisitorHost<I,? super H>> R caseAt(I idx, T host, P... params)
caseAt in interface IExtVisitor<R,I,P,H extends IExtVisitorHost<I,? super H>>T - The type of the host the is expected to call this method. T is restricted to be a subclass of IExtVisitorHost<I, ? super H>idx - The index value for the casehost - The visitor's host.params - Vararg input parameters for the case