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.parameter
Class ParameterUtility

    java.lang.Object
      uchicago.src.sim.parameter.ParameterUtility

    public class ParameterUtility

extends java.lang.Object

Some utility methods for working with parameters. All parameter queries should now go through this class. This class is a singleton. The single instance can be retrieved with ParameterUtility.getInstance(). Before using this single instance, it must be created. All the controllers that come with repast do this in their constructors.

Various methods of ParameterUtility refer to default parameters. These are the parameters that are loaded via an external parameter file.

Version:
  $Revision: 1.11 $ $Date: 2004/11/15 17:22:34 $

Method Summary
`static void` | `createInstance()` Creates an instance of a ParameterUtility.
`static void` | `createInstance(ParameterSetter params)` Creates an instance of a ParameterUtility.
`ParameterSetter` | `createParameters(java.lang.Object o, java.lang.String[] properties)` Creates a Vector of Parameters based on the current property values of Object o.
`java.util.Hashtable` | `getDefaultParameters(SimModel model)` Returns a Hashtable whose keys are the names of the default parameters and whose values are the values of the parameters.
`java.util.ArrayList` | `getDynamicParameterNames()` Returns a list of the names of the dynamic default parameters associated with this ParameterUtility.
`static ParameterUtility` | `getInstance()` Returns the single instance of this ParameterUtility.
`java.util.Hashtable` | `getModelProperties(SimModel model)` Returns a Hashtable of all the current property name and value pairs for the specified model.
`java.lang.String` | `getPropertyNamesHeader(SimModel model)`
`java.lang.String` | `getPropertyValues(SimModel model)`
`boolean` | `isConstantDefaultParam(java.lang.String name)` Returns true if the named parameter is a default parameter and is a constant parameter.
`boolean` | `isDefaultParam(java.lang.String name)` Returns true if the named parameter is a default parameter.
`void` | `makeParameterFileFromCurVals(java.lang.Object o, java.lang.String[] props, java.lang.String fileName)` Creates and writes a parameter file for the specified properties of the specified object.

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

Method Detail

### createInstance

    public static void createInstance(ParameterSetter params)

  Creates an instance of a ParameterUtility.

  Parameters:
    `params` - a list of Parameter objects. These are the default parameters for this ParameterUtility instance.

### createInstance

    public static void createInstance()

  Creates an instance of a ParameterUtility.

### getInstance

    public static ParameterUtility getInstance()

  Returns the single instance of this ParameterUtility.

  Returns:

### isDefaultParam

    public boolean isDefaultParam(java.lang.String name)

  Returns true if the named parameter is a default parameter. A default parameter is a parameter names in a parameter file. Otherwise returns false.

  Parameters:
    `name` - the name of the parameter to check

### isConstantDefaultParam

    public boolean isConstantDefaultParam(java.lang.String name)

  Returns true if the named parameter is a default parameter and is a constant parameter. Otherwise returns false.

  Parameters:
    `name` - the name of the parameter to check.

### getDynamicParameterNames

    public java.util.ArrayList getDynamicParameterNames()

  Returns a list of the names of the dynamic default parameters associated with this ParameterUtility. The names are lower cased before they are returned.

### getDefaultParameters

    public java.util.Hashtable getDefaultParameters(SimModel model)
                                             throws java.beans.IntrospectionException,
                                                    java.lang.reflect.InvocationTargetException,
                                                    java.lang.IllegalAccessException

  Returns a Hashtable whose keys are the names of the default parameters and whose values are the values of the parameters. The value of the parameter is not necessarily the current value of the model parameter.

  Parameters:
    `model` - the model whose parameters we want to get
  Throws:
    `java.beans.IntrospectionException`
    `java.lang.reflect.InvocationTargetException`
    `java.lang.IllegalAccessException`

### createParameters

    public ParameterSetter createParameters(java.lang.Object o,
                                            java.lang.String[] properties)
                                     throws java.beans.IntrospectionException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException

  Creates a Vector of Parameters based on the current property values of Object o.

  Parameters:
    `o` - the Object whose properties should become the parameters
    `properties` - the array of properties to create parameters from
  Throws:
    `java.beans.IntrospectionException`
    `java.lang.IllegalAccessException`
    `java.lang.reflect.InvocationTargetException`

### getModelProperties

    public java.util.Hashtable getModelProperties(SimModel model)
                                           throws java.beans.IntrospectionException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException

  Returns a Hashtable of all the current property name and value pairs for the specified model. The properties are those specified by the models getInitParam() method and the value is the current value of that property in the model.

  Parameters:
    `model` - the model whose properties we want to get.
  Returns:
  Throws:
    `java.beans.IntrospectionException`
    `java.lang.IllegalAccessException`
    `java.lang.reflect.InvocationTargetException`

### makeParameterFileFromCurVals

    public void makeParameterFileFromCurVals(java.lang.Object o,
                                             java.lang.String[] props,
                                             java.lang.String fileName)
                                      throws java.beans.IntrospectionException,
                                             java.lang.IllegalAccessException,
                                             java.lang.reflect.InvocationTargetException,
                                             RepastException,
                                             java.io.IOException

  Creates and writes a parameter file for the specified properties of the specified object. The file write property name value pairs in repast's parameter file format.

  Parameters:
    `o` - the object whose properties we want to write
    `props` - the names of the properties to write
    `fileName` - the name of the file to write the properties to
  Throws:
    `java.beans.IntrospectionException`
    `java.lang.IllegalAccessException`
    `java.lang.reflect.InvocationTargetException`
    `RepastException`
    `java.io.IOException`

### getPropertyNamesHeader

    public java.lang.String getPropertyNamesHeader(SimModel model)

### getPropertyValues

    public java.lang.String getPropertyValues(SimModel model)

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