avrora.actions
Class Action

java.lang.Object
  extended byavrora.util.help.HelpCategory
      extended byavrora.actions.Action
All Implemented Interfaces:
HelpItem
Direct Known Subclasses:
AnalyzeStackAction, CFGAction, DBBCAction, DisassembleAction, GUIAction, ISDLAction, ISEAAction, ODPPAction, SimAction, TestAction

public abstract class Action
extends HelpCategory

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
 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.
 
Fields inherited from class avrora.util.help.HelpCategory
COMPARATOR, help, name
 
Constructor Summary
protected Action(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
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 avrora.util.help.HelpCategory
addCommandExample, addListSection, addOptionSection, addSection, addSubcategorySection, getHelp, getName, printHelp, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

options

public final 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.

Constructor Detail

Action

protected Action(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.

Parameters:
h - the (unformatted) help string
Method Detail

run

public abstract void run(java.lang.String[] args)
                  throws java.lang.Exception
The run() method is called by the main class and is passed the remaining command line arguments after options have been stripped out.

Parameters:
args - the command line arguments
Throws:
java.lang.Exception

newOption

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.

Parameters:
name - the name of the option
val - the default value of the option
desc - a string representation of the help for this option
Returns:
an instance of Option representing the option created and registered

newOption

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.

Parameters:
name - the name of the option
val - the default value of the option
desc - a string representation of the help for this option
Returns:
an instance of Option representing the option created and registered

newOption

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.

Parameters:
name - the name of the option
val - the default value of the option
desc - a string representation of the help for this option
Returns:
an instance of Option representing the option created and registered

newOption

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. This particular method creates an interval option.

Parameters:
name - the name of the option
l - the default low value of the option
h - the default high value of the option
desc - a string representation of the help for this option
Returns:
an instance of Option representing the option created and registered

newOption

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.

Parameters:
name - the name of the option
val - the default value of the option as a string
desc - a string representation of the help for this option
Returns:
an instance of Option representing the option created and registered

newOptionList

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.

Parameters:
name - the name of the option
val - the default value of the option as a comma separated string
desc - a string representation of the help for this option
Returns:
an instance of Option representing the option created and registered