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 abstract
ParameterSetter
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
-
Constructor Summary
ConstructorDescriptionAbstractSweepParameterSetter
(String parameterName) Constructs this with the given name to store its parameters to. -
Method Summary
Modifier and TypeMethodDescriptionboolean
protected abstract boolean
atBeginning
(T prevValue) boolean
atEnd()
protected abstract boolean
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
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
void
reset
(Parameters params) protected abstract T
void
revert
(Parameters params)
-
Field Details
-
RESET_INDEX
public static final int RESET_INDEX- See Also:
-
LAST_VALUE_INDEX
public static final int LAST_VALUE_INDEX- See Also:
-
parameterName
-
lastValue
-
revertValue
-
-
Constructor Details
-
AbstractSweepParameterSetter
Constructs this with the given name to store its parameters to.- Parameters:
parameterName
- the name of the parameter
-
-
Method Details
-
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
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
- Specified by:
previous
in interfaceOptimizableParameterSetter
-
random
- Specified by:
random
in interfaceOptimizableParameterSetter
-
nextValue
Retrieves the next value for the parameter. This will not be called when the space is finished.- Returns:
- the next parameter value
-
randomValue
-
previousValue
-
resetValue
-
atEnd
-
atBeginning
-
atBeginning
public boolean atBeginning()- Specified by:
atBeginning
in interfaceOptimizableParameterSetter
-
atEnd
public boolean atEnd()- Specified by:
atEnd
in interfaceParameterSetter
-
reset
- Specified by:
reset
in interfaceParameterSetter
-
randDouble
protected double randDouble(double from, double to) -
randInt
protected int randInt(int from, int to) -
revert
- Specified by:
revert
in interfaceOptimizableParameterSetter
-