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

## uchicago.src.sim.engine
Class ActionGroup

    java.lang.Object
      uchicago.src.sim.engine.BasicAction
          uchicago.src.sim.engine.ActionGroup

    public class ActionGroup

extends BasicAction

A collection of BasicActions to be executed by a schedule. An ActionGroup has no notion of time. All the BasicActions added to an ActionGroup execute during the same simulation clock tick. The BasicActions in the ActionGroup can be executed sequentialy in the order they were added or randomly. An ActionGroup is added to a Schedule which can then execute the Group and in doing so execute the BasicActions within the ActionGroup at some specified simulation clock tick.

Version:
  $Revision: 1.9 $ $Date: 2004/11/03 19:50:57 $
Author:
  Nick Collier
See Also:
  `Schedule`, `BasicAction`

Field Summary
`static int` | `RANDOM` Random type
`static int` | `SEQUENTIAL` Sequential type

Fields inherited from class uchicago.src.sim.engine.BasicAction
`INTERVAL_UPDATER, ONE_TIME_UPDATER, updater`

Constructor Summary
`ActionGroup()` Constructs an ActionGroup with a default sequential execution.
`ActionGroup(int type)` Constructs an ActionGroup with execution of the specified type.

Method Summary
`void` | `addAction(BasicAction action)` Adds a BasicAction to the list of BasicActions to execute.
`void` | `createActionFor(java.lang.Object o, java.lang.String methodName)` Creates a BasicAction consisting of the specified method to be called on the specified object, and adds the action to this ActionGroup.
`void` | `createActionForEach(java.util.ArrayList list, java.lang.Class superClass, java.lang.String methodName)` Creates a BasicAction consisting of the specified method to be called on every Object in the specified list, and adds the BasicAction to this ActionGroup.
`void` | `createActionForEach(java.util.ArrayList list, java.lang.String methodName)` Creates a BasicAction consisting of the specified method to be called on every object in the specified list, and adds the action to this ActionGroup.
`void` | `execute()` Executes the BasicActions contained by this ActionGroup.
`int` | `getType()` Gets the type (ActionGroup.SEQUENTIAL or ActionGroup.RANDOM) of this ActionGroup.
`void` | `removeAction(BasicAction action)` Removes the specified BasicAction from the group.
`void` | `setRng(cern.jet.random.Uniform rng)` Sets the random number generator used by this ActionGroup when randomizing the BasicActions to execute.

Methods inherited from class uchicago.src.sim.engine.BasicAction
`addToGroup, getIntervalTime, getName, getNextTime, reSchedule, setIntervalTime, setName, setNextTime`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SEQUENTIAL

    public static final int SEQUENTIAL

  Sequential type

  See Also:
    Constant Field Values

### RANDOM

    public static final int RANDOM

  Random type

  See Also:
    Constant Field Values

Constructor Detail

### ActionGroup

    public ActionGroup()

  Constructs an ActionGroup with a default sequential execution.

### ActionGroup

    public ActionGroup(int type)

  Constructs an ActionGroup with execution of the specified type.

  Parameters:
    `type` - the type (Sequential or Random) of ActionGroup to construct. Type can be specified by the constants ActionGroup.SEQUENTIAL and ActionGroup.RANDOM.

Method Detail

### getType

    public int getType()

  Gets the type (ActionGroup.SEQUENTIAL or ActionGroup.RANDOM) of this ActionGroup.

### setRng

    public void setRng(cern.jet.random.Uniform rng)

  Sets the random number generator used by this ActionGroup when randomizing the BasicActions to execute. An ActionGroup will use the global rng if this is not set.

### execute

    public void execute()

  Executes the BasicActions contained by this ActionGroup.

  Specified by:
    `execute` in class `BasicAction`

### createActionFor

    public void createActionFor(java.lang.Object o,
                                java.lang.String methodName)

  Creates a BasicAction consisting of the specified method to be called on the specified object, and adds the action to this ActionGroup. The method should take no arguments.

  Parameters:
    `o` - the object to the call the method on.
    `methodName` - the name of the method to call. The method should take no arguments

### createActionForEach

    public void createActionForEach(java.util.ArrayList list,
                                    java.lang.String methodName)
                             throws java.lang.NoSuchMethodException

  Creates a BasicAction consisting of the specified method to be called on every object in the specified list, and adds the action to this ActionGroup. Uses the first object in the list the BasicAction. The method should take no arguments.

  Parameters:
    `list` - the list containing the object to call the method on
    `methodName` - the name of the method to call. The method should take no arguments
  Throws:
    `java.lang.NoSuchMethodException` - if the first object in the list does not have the specified method.

### createActionForEach

    public void createActionForEach(java.util.ArrayList list,
                                    java.lang.Class superClass,
                                    java.lang.String methodName)
                             throws java.lang.NoSuchMethodException

  Creates a BasicAction consisting of the specified method to be called on every Object in the specified list, and adds the BasicAction to this ActionGroup. Use this method to create actions when the objects in the list are not all of the same class, but are children of a common super class. The specified method must be a method of this superclass.

  Parameters:
    `list` - the list containing the object to call the method on
    `superClass` - the class to use when creating the BasicAction.
    `methodName` - the name of the method to call. The method should take no arguments
  Throws:
    `java.lang.NoSuchMethodException` - if the first object in the list does not have the specified method.

### addAction

    public void addAction(BasicAction action)

  Adds a BasicAction to the list of BasicActions to execute.

  Parameters:
    `action` - the BasicAction to add

### removeAction

    public void removeAction(BasicAction action)

  Removes the specified BasicAction from the group.

  Parameters:
    `action` - the BasicAction to remove

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