Package repast.simphony.parameter
Class ListParameterSetter<T>
- java.lang.Object
-
- repast.simphony.parameter.AbstractSweepParameterSetter<T>
-
- repast.simphony.parameter.ListParameterSetter<T>
-
- All Implemented Interfaces:
OptimizableParameterSetter
,ParameterSetter
public class ListParameterSetter<T> extends AbstractSweepParameterSetter<T>
An initializer that will go through a list of parameters.- Author:
- Jerry Vos
-
-
Field Summary
-
Fields inherited from class repast.simphony.parameter.AbstractSweepParameterSetter
LAST_VALUE_INDEX, lastValue, parameterName, RESET_INDEX, revertValue
-
-
Constructor Summary
Constructors Constructor Description ListParameterSetter(String parameterName, T[] list)
Constructs this with the specified parameter name (where the parameter will be stored) and iterating through the given parameter list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
atBeginning()
protected boolean
atBeginning(T prevValue)
boolean
atEnd()
Compares the index to the number of elements in the list/protected boolean
atEnd(T prevValue)
protected T
nextValue(T prevValue)
Fetches the next element in the list and increments the index.protected T
previousValue(T prevValue)
protected T
randomValue()
void
reset(Parameters params)
Resets the index of the parameters to the next value.protected T
resetValue()
void
revert(Parameters params)
String
toString()
-
Methods inherited from class repast.simphony.parameter.AbstractSweepParameterSetter
getParameterName, next, previous, randDouble, randInt, random
-
-
-
-
Constructor Detail
-
ListParameterSetter
public ListParameterSetter(String parameterName, T[] list)
Constructs this with the specified parameter name (where the parameter will be stored) and iterating through the given parameter list.- Parameters:
parameterName
- the name of the parameter values will be stored inlist
- the list of values to go through
-
-
Method Detail
-
reset
public void reset(Parameters params)
Resets the index of the parameters to the next value.- Specified by:
reset
in interfaceParameterSetter
- Overrides:
reset
in classAbstractSweepParameterSetter<T>
-
atEnd
public boolean atEnd()
Compares the index to the number of elements in the list/- Specified by:
atEnd
in interfaceParameterSetter
- Overrides:
atEnd
in classAbstractSweepParameterSetter<T>
- Returns:
- true if the list's index is greater than the list's length
-
nextValue
protected T nextValue(T prevValue)
Fetches the next element in the list and increments the index.- Specified by:
nextValue
in classAbstractSweepParameterSetter<T>
- Returns:
- the next element in the list
-
revert
public void revert(Parameters params)
- Specified by:
revert
in interfaceOptimizableParameterSetter
- Overrides:
revert
in classAbstractSweepParameterSetter<T>
-
atBeginning
public boolean atBeginning()
- Specified by:
atBeginning
in interfaceOptimizableParameterSetter
- Overrides:
atBeginning
in classAbstractSweepParameterSetter<T>
-
previousValue
protected T previousValue(T prevValue)
- Specified by:
previousValue
in classAbstractSweepParameterSetter<T>
-
randomValue
protected T randomValue()
- Specified by:
randomValue
in classAbstractSweepParameterSetter<T>
-
resetValue
protected T resetValue()
- Specified by:
resetValue
in classAbstractSweepParameterSetter<T>
-
atEnd
protected boolean atEnd(T prevValue)
- Specified by:
atEnd
in classAbstractSweepParameterSetter<T>
-
atBeginning
protected boolean atBeginning(T prevValue)
- Specified by:
atBeginning
in classAbstractSweepParameterSetter<T>
-
-