|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.actions.Action
The Action class defines a new action that the main driver is
capable of executing. Each instance of Action is inserted into
a hash map in the main class, with the key being its name. For example,
the action to simulate a program is inserted into this hash map with the key
"simulate", and an instance of avrora.actions.SimulateAction.
| Field Summary | |
java.lang.String |
help
The help field stores a reference to the (unformatted)
help string for this action. |
Options |
options
The options field stores a reference to an instance of
the Options class that encapsulates the command line
options available to this action. |
java.lang.String |
shortName
The shortName field stores a reference to the string
that represents the short (abbreviated) name of this action. |
| Constructor Summary | |
protected |
Action(java.lang.String sn,
java.lang.String h)
The constructor for the Action class initializes the
referneces to the short name and help string for this action as
well as creating the internal options. |
| Method Summary | |
java.lang.String |
getHelp()
The getHelp() method returns a string that is used in reporting
the command line help to the user. |
java.lang.String |
getShortName()
The getShortName() method returns the name of this action
as a short string. |
protected Option.Bool |
newOption(java.lang.String name,
boolean val,
java.lang.String desc)
The newOption() is used by subclasses to easily create
new options for this action. |
protected Option.Double |
newOption(java.lang.String name,
double val,
java.lang.String desc)
The newOption() is used by subclasses to easily create
new options for this action. |
protected Option.Interval |
newOption(java.lang.String name,
long l,
long h,
java.lang.String desc)
The newOption() is used by subclasses to easily create
new options for this action. |
protected Option.Long |
newOption(java.lang.String name,
long val,
java.lang.String desc)
The newOption() is used by subclasses to easily create
new options for this action. |
protected Option.Str |
newOption(java.lang.String name,
java.lang.String val,
java.lang.String desc)
The newOption() is used by subclasses to easily create
new options for this action. |
protected Option.List |
newOptionList(java.lang.String name,
java.lang.String val,
java.lang.String desc)
The newOptionList() is used by subclasses to easily create
new options for this action. |
abstract void |
run(java.lang.String[] args)
The run() method is called by the main class and is passed
the remaining command line arguments after options have been stripped out. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public final java.lang.String help
help field stores a reference to the (unformatted)
help string for this action.
public final java.lang.String shortName
shortName field stores a reference to the string
that represents the short (abbreviated) name of this action.
public final Options options
options field stores a reference to an instance of
the Options class that encapsulates the command line
options available to this action.
| Constructor Detail |
protected Action(java.lang.String sn,
java.lang.String h)
Action class initializes the
referneces to the short name and help string for this action as
well as creating the internal options.
sn - the short name of the action as a stringh - the (unformatted) help string| Method Detail |
public abstract void run(java.lang.String[] args)
throws java.lang.Exception
run() method is called by the main class and is passed
the remaining command line arguments after options have been stripped out.
args - the command line arguments
java.lang.Exceptionpublic java.lang.String getHelp()
getHelp() method returns a string that is used in reporting
the command line help to the user.
public java.lang.String getShortName()
getShortName() method returns the name of this action
as a short string. This short string is the name that it can be referred
to as from the command line. For example, to execute the BenchmarkAction,
the -action=benchmark option must be supplied.
protected Option.Bool newOption(java.lang.String name,
boolean val,
java.lang.String desc)
newOption() is used by subclasses to easily create
new options for this action.
name - the name of the optionval - the default value of the optiondesc - a string representation of the help for this option
Option representing the option
created and registered
protected Option.Long newOption(java.lang.String name,
long val,
java.lang.String desc)
newOption() is used by subclasses to easily create
new options for this action.
name - the name of the optionval - the default value of the optiondesc - a string representation of the help for this option
Option representing the option
created and registered
protected Option.Double newOption(java.lang.String name,
double val,
java.lang.String desc)
newOption() is used by subclasses to easily create
new options for this action.
name - the name of the optionval - the default value of the optiondesc - a string representation of the help for this option
Option representing the option
created and registered
protected Option.Interval newOption(java.lang.String name,
long l,
long h,
java.lang.String desc)
newOption() is used by subclasses to easily create
new options for this action. This particular method creates an interval
option.
name - the name of the optionl - the default low value of the optionh - the default high value of the optiondesc - a string representation of the help for this option
Option representing the option
created and registered
protected Option.Str newOption(java.lang.String name,
java.lang.String val,
java.lang.String desc)
newOption() is used by subclasses to easily create
new options for this action.
name - the name of the optionval - the default value of the option as a stringdesc - a string representation of the help for this option
Option representing the option
created and registered
protected Option.List newOptionList(java.lang.String name,
java.lang.String val,
java.lang.String desc)
newOptionList() is used by subclasses to easily create
new options for this action.
name - the name of the optionval - the default value of the option as a comma separated stringdesc - a string representation of the help for this option
Option representing the option
created and registered
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||