uchicago.src.sim.parameter.rpl
Class NumericRPLParameter

java.lang.Object
  extended by uchicago.src.sim.parameter.rpl.AbstractRPLParameter
      extended by uchicago.src.sim.parameter.rpl.AbstractDynamicParameter
          extended by uchicago.src.sim.parameter.rpl.NumericRPLParameter
All Implemented Interfaces:
RPLParameter

public class NumericRPLParameter
extends AbstractDynamicParameter

Defines a dynamic numeric parameter. A NumericRPLParameter has a starting value, an ending value and an amount to increment. Every call to "next" will increment the current value by the amount to increment and set the current value to that new value. Once the current value is more than the ending value this will not increment.

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

Field Summary
 
Fields inherited from class uchicago.src.sim.parameter.rpl.AbstractRPLParameter
childConsts, childParams, convertor, curIndex, getMethod, name, setMethod, type
 
Constructor Summary
NumericRPLParameter(java.lang.String name, double start, double end)
          Creates a NumericRPLParameter with the specified name, starting value and ending value.
NumericRPLParameter(java.lang.String name, double start, double end, double incr)
          Creates a NumericRPLParameter with the specified name, starting value, ending value and amount to increment.
 
Method Summary
protected  java.lang.Object getValue()
          Returns the current value of this NumericRPLParameter as a Double.
protected  boolean incrementSelf()
          Increments the current value of this parameter by the amount to increment.
protected  void invokeSet(SimModel model)
          Invokes the model's appropriate set method with this parameters's current value as an argument.
 void reset()
          Resets this NumericRPLParameter to its starting value.
 java.lang.String toString()
           
 
Methods inherited from class uchicago.src.sim.parameter.rpl.AbstractDynamicParameter
addToParent, next
 
Methods inherited from class uchicago.src.sim.parameter.rpl.AbstractRPLParameter
addChildConstant, addChildParameter, constantIterator, getName, getValue, parameterIterator, setModelParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumericRPLParameter

public NumericRPLParameter(java.lang.String name,
                           double start,
                           double end)
Creates a NumericRPLParameter with the specified name, starting value and ending value. The amount to increment defaults to 1.

Parameters:
name - the name of the parameter
start - the starting value
end - the ending value

NumericRPLParameter

public NumericRPLParameter(java.lang.String name,
                           double start,
                           double end,
                           double incr)
Creates a NumericRPLParameter with the specified name, starting value, ending value and amount to increment.

Parameters:
name - the name of the parameter
start - the starting value
end - the ending value
incr - the amount to increment
Method Detail

reset

public void reset()
Resets this NumericRPLParameter to its starting value.

Specified by:
reset in interface RPLParameter
Overrides:
reset in class AbstractDynamicParameter

incrementSelf

protected boolean incrementSelf()
Increments the current value of this parameter by the amount to increment. The curent value is then set to this new value.

Specified by:
incrementSelf in class AbstractDynamicParameter
Returns:
returns true if the new current value is less than or equal the ending value, otherwise false.

invokeSet

protected void invokeSet(SimModel model)
                  throws RepastException
Invokes the model's appropriate set method with this parameters's current value as an argument.

Specified by:
invokeSet in class AbstractRPLParameter
Parameters:
model - the model to invoke the set method on
Throws:
RepastException - if the method fails

getValue

protected java.lang.Object getValue()
Returns the current value of this NumericRPLParameter as a Double.

Specified by:
getValue in class AbstractRPLParameter
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object