Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.actions
Class Action

    java.lang.Object
      avrora.actions.Action

Direct Known Subclasses:
  AnalyzeStackAction, CFGAction, ListAction, SimAction, TestAction

public abstract class Action
extends java.lang.Object

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

### help

    public final java.lang.String help

  The `help` field stores a reference to the (unformatted) help string for this action.

### shortName

    public final java.lang.String shortName

  The `shortName` field stores a reference to the string that represents the short (abbreviated) name of this action.

### 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 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.

Parameters:
  `sn` - the short name of the action as a string
  `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`

### getHelp

    public java.lang.String getHelp()

  The `getHelp()` method returns a string that is used in reporting the command line help to the user.

  Returns:
    an unformatted paragraph that contains the text explanation of what this action does.

### getShortName

    public java.lang.String getShortName()

  The `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.

  Returns:
    the name of this action as a short string

### 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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD