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 Details

    • RESET_INDEX

      public static final int RESET_INDEX
      See Also:
    • LAST_VALUE_INDEX

      public static final int LAST_VALUE_INDEX
      See Also:
    • parameterName

      protected String parameterName
    • lastValue

      protected T lastValue
    • revertValue

      protected T revertValue
  • Constructor Details

    • AbstractSweepParameterSetter

      public AbstractSweepParameterSetter(String parameterName)
      Constructs this with the given name to store its parameters to.
      Parameters:
      parameterName - the name of the parameter
  • Method Details

    • 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 interface ParameterSetter
      Parameters:
      params - the parameter object values will be stored in
    • previous

      public void previous(Parameters parameters)
      Specified by:
      previous in interface OptimizableParameterSetter
    • random

      public void random(Parameters parameters)
      Specified by:
      random in interface OptimizableParameterSetter
    • 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()
    • previousValue

      protected abstract T previousValue(T prevValue)
    • 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 interface OptimizableParameterSetter
    • atEnd

      public boolean atEnd()
      Specified by:
      atEnd in interface ParameterSetter
    • reset

      public void reset(Parameters params)
      Specified by:
      reset in interface ParameterSetter
    • 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 interface OptimizableParameterSetter