avrora.actions
Class SimAction

java.lang.Object
  extended byavrora.actions.Action
      extended byavrora.actions.SimAction
Direct Known Subclasses:
BenchmarkAction, MultiSimulateAction, SimulateAction

public abstract class SimAction
extends Action

The SimAction is an abstract class that collects many of the options common to single node and multiple-node simulations into one place.


Field Summary
 Option.Str CHIP
           
 Option.Long ICOUNT
           
protected  java.util.LinkedList monitorFactoryList
           
protected  java.util.HashMap monitorListMap
           
protected  java.util.HashMap monitorNameMap
           
 Option.List MONITORS
           
 Option.Str PLATFORM
           
 Option.Double SECONDS
           
 Option.Long TIMEOUT
           
 
Fields inherited from class avrora.actions.Action
help, options, shortName
 
Constructor Summary
protected SimAction(java.lang.String sn, java.lang.String h)
           
 
Method Summary
protected  MicrocontrollerFactory getMicrocontroller()
          The getMicrocontroller() method is used to get the current microcontroller from the library of implemented ones, based on the command line option that was specified (-chip=xyz).
protected  PlatformFactory getPlatform()
          The getPlatform() method is used to get the current platform from the library of implemented ones, based on the command line option that was specified (-platform=xyz).
protected  boolean hasMonitors(Simulator s)
           
protected  Simulator newSimulator(Program p)
          The newSimulator() method is used by subclasses of this action to create a new instance of a simulator with the correct platform.
protected  void processMonitorList()
          The processMonitorList() method builds a list of MonitorFactory instances from the list of strings given as an option at the command line.
protected  void processTimeout(Simulator s)
           
protected  void reportMonitors(Simulator s)
          The reportMonitors() method gets a list of Monitor instances attached to the simulator and calls each of their report() methods.
protected  void reportQuantity(java.lang.String name, float val, java.lang.String units)
           
protected  void reportQuantity(java.lang.String name, long val, java.lang.String units)
           
protected  void reportQuantity(java.lang.String name, java.lang.String val, java.lang.String units)
           
 
Methods inherited from class avrora.actions.Action
getHelp, getShortName, newOption, newOption, newOption, newOption, newOption, newOptionList, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICOUNT

public final Option.Long ICOUNT

SECONDS

public final Option.Double SECONDS

TIMEOUT

public final Option.Long TIMEOUT

CHIP

public final Option.Str CHIP

PLATFORM

public final Option.Str PLATFORM

MONITORS

public final Option.List MONITORS

monitorNameMap

protected java.util.HashMap monitorNameMap

monitorFactoryList

protected java.util.LinkedList monitorFactoryList

monitorListMap

protected java.util.HashMap monitorListMap
Constructor Detail

SimAction

protected SimAction(java.lang.String sn,
                    java.lang.String h)
Method Detail

getMicrocontroller

protected MicrocontrollerFactory getMicrocontroller()
The getMicrocontroller() method is used to get the current microcontroller from the library of implemented ones, based on the command line option that was specified (-chip=xyz).

Returns:
an instance of MicrocontrollerFactory for the microcontroller specified on the command line.

getPlatform

protected PlatformFactory getPlatform()
The getPlatform() method is used to get the current platform from the library of implemented ones, based on the command line option that was specified (-platform=xyz).

Returns:
an instance of PlatformFactory for the platform specified on the command line

reportQuantity

protected void reportQuantity(java.lang.String name,
                              long val,
                              java.lang.String units)

reportQuantity

protected void reportQuantity(java.lang.String name,
                              float val,
                              java.lang.String units)

reportQuantity

protected void reportQuantity(java.lang.String name,
                              java.lang.String val,
                              java.lang.String units)

processMonitorList

protected void processMonitorList()
The processMonitorList() method builds a list of MonitorFactory instances from the list of strings given as an option at the command line. The list of MonitorFactory instances is used to create monitors for each simulator as it is created.


newSimulator

protected Simulator newSimulator(Program p)
The newSimulator() method is used by subclasses of this action to create a new instance of a simulator with the correct platform. This method also creates monitors for the simulator instance as specified from the command line.

Parameters:
p - the program to load onto the simulator
Returns:
an instance of the Simulator class that has the specified programs loaded onto it and has monitors attached to as specified on the command line

processTimeout

protected void processTimeout(Simulator s)

reportMonitors

protected void reportMonitors(Simulator s)
The reportMonitors() method gets a list of Monitor instances attached to the simulator and calls each of their report() methods.

Parameters:
s - the simulator for which to report all the monitors

hasMonitors

protected boolean hasMonitors(Simulator s)