uchicago.src.sim.parameter.rpl
Class AbstractRPLParameter

java.lang.Object
  extended by uchicago.src.sim.parameter.rpl.AbstractRPLParameter
All Implemented Interfaces:
RPLParameter
Direct Known Subclasses:
AbstractConstantParameter, AbstractDynamicParameter

public abstract class AbstractRPLParameter
extends java.lang.Object
implements RPLParameter

Default but not complete implementation of the RPLParameter interface.

Version:
$Revision: 1.6 $ $Date: 2004/10/19 18:12:55 $

Field Summary
protected  java.util.List childConsts
           
protected  java.util.List childParams
           
protected  uchicago.src.sim.parameter.rpl.AbstractRPLParameter.NumberConvertor convertor
           
protected  int curIndex
           
protected  java.lang.reflect.Method getMethod
           
protected  java.lang.String name
           
protected  java.lang.reflect.Method setMethod
           
protected  java.lang.Class type
           
 
Constructor Summary
AbstractRPLParameter(java.lang.String name)
          Creates an AbstractRPLParameter with the specified name.
 
Method Summary
 void addChildConstant(RPLParameter child)
          Adds the specified RPLParameter as a child constant parameter of this RPLParameter.
 void addChildParameter(RPLParameter child)
          Adds the specified RPLParameter as a child parameter of this RPLParameter.
 java.util.Iterator constantIterator()
          Gets an Iterator over the child constant parameters of this RPLParameter.
 java.lang.String getName()
          Gets the name of this RPLParameter.
protected abstract  java.lang.Object getValue()
          Gets the current value of this AbstractRPLParameter.
 java.lang.Object getValue(SimModel model)
          Gets the current value of this RPLParameter.
protected abstract  void invokeSet(SimModel model)
          Invokes the model's set method for this parameter's value.
 java.util.Iterator parameterIterator()
          Gets an Iterator over the child constant parameters of this RPLParameter.
 void setModelParameter(SimModel model)
          Sets the model parameter to the current value of this RPLParameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uchicago.src.sim.parameter.rpl.RPLParameter
addToParent, next, reset
 

Field Detail

name

protected java.lang.String name

childParams

protected java.util.List childParams

childConsts

protected java.util.List childConsts

setMethod

protected java.lang.reflect.Method setMethod

getMethod

protected java.lang.reflect.Method getMethod

type

protected java.lang.Class type

curIndex

protected int curIndex

convertor

protected uchicago.src.sim.parameter.rpl.AbstractRPLParameter.NumberConvertor convertor
Constructor Detail

AbstractRPLParameter

public AbstractRPLParameter(java.lang.String name)
Creates an AbstractRPLParameter with the specified name.

Parameters:
name - the name of the parameter.
Method Detail

getName

public java.lang.String getName()
Gets the name of this RPLParameter.

Specified by:
getName in interface RPLParameter

addChildParameter

public void addChildParameter(RPLParameter child)
Adds the specified RPLParameter as a child parameter of this RPLParameter.

Specified by:
addChildParameter in interface RPLParameter
Parameters:
child - the child RPLParameter

addChildConstant

public void addChildConstant(RPLParameter child)
Adds the specified RPLParameter as a child constant parameter of this RPLParameter.

Specified by:
addChildConstant in interface RPLParameter
Parameters:
child - the child RPLParameter to add

setModelParameter

public void setModelParameter(SimModel model)
                       throws RepastException
Sets the model parameter to the current value of this RPLParameter.

Specified by:
setModelParameter in interface RPLParameter
Parameters:
model - the model whose parameter we want to set
Throws:
RepastException - if there is an error setting the parameter

invokeSet

protected abstract void invokeSet(SimModel model)
                           throws RepastException
Invokes the model's set method for this parameter's value. The actual invocation is deferred to a subclass, so that subclass do any necessary conversion of method args.

Parameters:
model - the model to invoke the set method on
Throws:
RepastException - if the method fails

constantIterator

public java.util.Iterator constantIterator()
Gets an Iterator over the child constant parameters of this RPLParameter.

Specified by:
constantIterator in interface RPLParameter

parameterIterator

public java.util.Iterator parameterIterator()
Gets an Iterator over the child constant parameters of this RPLParameter.

Specified by:
parameterIterator in interface RPLParameter

getValue

public java.lang.Object getValue(SimModel model)
                          throws RepastException
Gets the current value of this RPLParameter.

Specified by:
getValue in interface RPLParameter
Parameters:
model - the model associated with this RPLParameter
Throws:
RepastException - if the value cannot be returned

getValue

protected abstract java.lang.Object getValue()
Gets the current value of this AbstractRPLParameter. The actual implementation is deferred to a subclass so that the subclass can do any conversion if necessary.

Returns:
the value of this parameter.