uchicago.src.sim.engine
Class ActionUtilities

java.lang.Object
  extended by uchicago.src.sim.engine.ActionUtilities

public class ActionUtilities
extends java.lang.Object

A collection of utility methods for the creation of SimActions and SimListActions. Used by ActionGroup, and Schedule in the creation of BasicActions. Under normal circumstances these methods should not be called by a user.

Version:
$Revision: 1.4 $ $Date: 2004/11/03 19:50:57 $
Author:
Nick Collier
See Also:
ActionGroup, Schedule

Constructor Summary
ActionUtilities()
           
 
Method Summary
static BasicAction createActionFor(java.lang.Object o, java.lang.String methodName)
          Creates a BasicAction whose execute method calls the specified method on the specified object.
static BasicAction createActionForEach(java.util.List list, java.lang.Class superClass, java.lang.String methodName)
          Creates a BasicAction whose execute method calls the specified method on every Object of the specified Class in the specified list.
static BasicAction createActionForEach(java.util.List list, java.lang.String methodName)
          Creates a BasicAction whose execute method calls the specified method on every object in the specified list.
static BasicAction createActionForEachRnd(java.util.List list, java.lang.Class superClass, java.lang.String methodName)
          Creates a BasicAction whose execute method calls the specified method on every Object of the specified Class in the specified list.
static BasicAction createActionForEachRnd(java.util.List list, java.lang.String methodName)
          Creates a BasicAction whose execute method calls the specified method on every object in the specified list.
static java.lang.reflect.Method getNoArgMethod(java.lang.Class c, java.lang.String name)
          Creates a java.lang.reflect.Method from the specified Class and the the specified methodName.
static java.lang.reflect.Method getNoArgMethod(java.lang.Object o, java.lang.String name)
          Creates a java.lang.reflect.Method from the specified object and the the specified methodName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionUtilities

public ActionUtilities()
Method Detail

createActionFor

public static BasicAction createActionFor(java.lang.Object o,
                                          java.lang.String methodName)
Creates a BasicAction whose execute method calls the specified method on the specified object. The method should take no arguments.

Parameters:
o - the object to the call the method on.
methodName - the name of the method to call.
Returns:
the created BasicAction

createActionForEach

public static BasicAction createActionForEach(java.util.List list,
                                              java.lang.String methodName)
Creates a BasicAction whose execute method calls the specified method on every object in the specified list. Assumes that all the objects in the list are of the same class. 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
Returns:
the created BasicAction

createActionForEachRnd

public static BasicAction createActionForEachRnd(java.util.List list,
                                                 java.lang.String methodName)
Creates a BasicAction whose execute method calls the specified method on every object in the specified list. Assumes that all the objects in the list are of the same class. The method should take no arguments. The list is randomized (shuffled) with SimUtilties.shuffle before iterating through it.

Parameters:
list - the list containing the object to call the method on
methodName - the name of the method to call
Returns:
the created BasicAction
See Also:
uchicago.src.sim.util.SimUtilties

createActionForEach

public static BasicAction createActionForEach(java.util.List list,
                                              java.lang.Class superClass,
                                              java.lang.String methodName)
Creates a BasicAction whose execute method calls the specified method on every Object of the specified Class in the specified list. This is used when the objects in the list are not all of the same class, but are children of a common super class.

Parameters:
list - the list containing the objects to call the method on
superClass - the class to use when creating the BasicAction.
methodName - the name of the method to call
Returns:
the created BasicAction
See Also:
uchicago.src.sim.util.SimUtilties

createActionForEachRnd

public static BasicAction createActionForEachRnd(java.util.List list,
                                                 java.lang.Class superClass,
                                                 java.lang.String methodName)
Creates a BasicAction whose execute method calls the specified method on every Object of the specified Class in the specified list. This is used when the objects in the list are not all of the same class, but are children of a common super class. The list is randomized (shuffled) with SimUtilties.shuffle before iterating through it.

Parameters:
list - the list containing the objects to call the method on
superClass - the class to use when creating the BasicAction.
methodName - the name of the method to call
Returns:
the created BasicAction

getNoArgMethod

public static java.lang.reflect.Method getNoArgMethod(java.lang.Object o,
                                                      java.lang.String name)
                                               throws java.lang.NoSuchMethodException
Creates a java.lang.reflect.Method from the specified object and the the specified methodName.

Parameters:
o - the object from which to create the Method
name - the name of the method to create
Returns:
the created Method
Throws:
java.lang.NoSuchMethodException - if the first object in the list does not have the specified method.

getNoArgMethod

public static java.lang.reflect.Method getNoArgMethod(java.lang.Class c,
                                                      java.lang.String name)
                                               throws java.lang.NoSuchMethodException
Creates a java.lang.reflect.Method from the specified Class and the the specified methodName.

Parameters:
c - the Class from which to create the Method
name - the name of the method to create
Returns:
the created Method
Throws:
java.lang.NoSuchMethodException - if the first object in the list does not have the specified method.