Package repast.simphony.parameter
Class AbstractSweepParameterSetter<T>
- java.lang.Object
-
- repast.simphony.parameter.AbstractSweepParameterSetter<T>
-
- All Implemented Interfaces:
OptimizableParameterSetter
,ParameterSetter
- Direct Known Subclasses:
ByteSteppedSetter
,IntSteppedSetter
,ListParameterSetter
,LongSteppedSetter
,ShortSteppedSetter
public abstract class AbstractSweepParameterSetter<T> extends Object implements OptimizableParameterSetter
An abstractParameterSetter
that is meant to dealt with only one parameter (hence the parameterName value it contains). This handles setting the parameter and the case where it is next'd when it is already finished (it returns the last value it had. TODO: rename this class- Author:
- Jerry Vos
-
-
Field Summary
Fields Modifier and Type Field Description static int
LAST_VALUE_INDEX
protected T
lastValue
protected String
parameterName
static int
RESET_INDEX
protected T
revertValue
-
Constructor Summary
Constructors Constructor Description AbstractSweepParameterSetter(String parameterName)
Constructs this with the given name to store its parameters to.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
atBeginning()
protected abstract boolean
atBeginning(T prevValue)
boolean
atEnd()
protected abstract boolean
atEnd(T prevValue)
String
getParameterName()
Gets the name of the parameter that this setter is responsible for setting.void
next(Parameters params)
If the object has finished its space this will set the parameter to the last value it generaetd, otherwise it will set it to the value returned by#nextValue()
.protected abstract T
nextValue(T prevValue)
Retrieves the next value for the parameter.void
previous(Parameters parameters)
protected abstract T
previousValue(T prevValue)
protected double
randDouble(double from, double to)
protected int
randInt(int from, int to)
void
random(Parameters parameters)
protected abstract T
randomValue()
void
reset(Parameters params)
protected abstract T
resetValue()
void
revert(Parameters params)
-
-
-
Field Detail
-
RESET_INDEX
public static final int RESET_INDEX
- See Also:
- Constant Field Values
-
LAST_VALUE_INDEX
public static final int LAST_VALUE_INDEX
- See Also:
- Constant Field Values
-
parameterName
protected String parameterName
-
lastValue
protected T lastValue
-
revertValue
protected T revertValue
-
-
Constructor Detail
-
AbstractSweepParameterSetter
public AbstractSweepParameterSetter(String parameterName)
Constructs this with the given name to store its parameters to.- Parameters:
parameterName
- the name of the parameter
-
-
Method Detail
-
getParameterName
public String getParameterName()
Gets the name of the parameter that this setter is responsible for setting.- Returns:
- the name of the parameter that this setter is responsible for setting.
-
next
public void next(Parameters params)
If the object has finished its space this will set the parameter to the last value it generaetd, otherwise it will set it to the value returned by#nextValue()
.- Specified by:
next
in interfaceParameterSetter
- Parameters:
params
- the parameter object values will be stored in
-
previous
public void previous(Parameters parameters)
- Specified by:
previous
in interfaceOptimizableParameterSetter
-
random
public void random(Parameters parameters)
- Specified by:
random
in interfaceOptimizableParameterSetter
-
nextValue
protected abstract T nextValue(T prevValue)
Retrieves the next value for the parameter. This will not be called when the space is finished.- Returns:
- the next parameter value
-
randomValue
protected abstract T randomValue()
-
resetValue
protected abstract T resetValue()
-
atEnd
protected abstract boolean atEnd(T prevValue)
-
atBeginning
protected abstract boolean atBeginning(T prevValue)
-
atBeginning
public boolean atBeginning()
- Specified by:
atBeginning
in interfaceOptimizableParameterSetter
-
atEnd
public boolean atEnd()
- Specified by:
atEnd
in interfaceParameterSetter
-
reset
public void reset(Parameters params)
- Specified by:
reset
in interfaceParameterSetter
-
randDouble
protected double randDouble(double from, double to)
-
randInt
protected int randInt(int from, int to)
-
revert
public void revert(Parameters params)
- Specified by:
revert
in interfaceOptimizableParameterSetter
-
-