Class DefaultParameters

java.lang.Object
repast.simphony.parameter.DefaultParameters
All Implemented Interfaces:
Cloneable, MutableParameters, Parameters
Direct Known Subclasses:
BoundParameters

public class DefaultParameters extends Object implements MutableParameters
Default implementation of Parameters. Individual paramters are created via the add method. This is intended to be used in conjuction with a ParametersCreator.
Author:
Nick Collier
  • Field Details

  • Constructor Details

    • DefaultParameters

      public DefaultParameters()
      Creates a new DefaultParameters object.
    • DefaultParameters

      public DefaultParameters(Parameters params)
      Creates a new DefaultParameters using the parameters in the specified Parameters object.
      Parameters:
      param - parameters whose values we want to copy into this DefaultParameters
  • Method Details

    • clone

      public Parameters clone()
      Description copied from interface: Parameters
      Method to clone a Parameter object.
      Specified by:
      clone in interface Parameters
      Overrides:
      clone in class Object
      Returns:
      a Parameter clone.
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Adds listener that will listen for parameter changes on this Parameters.
      Specified by:
      addPropertyChangeListener in interface Parameters
      Parameters:
      listener -
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Removes the specified listener from the listeners listening to this Parameters object.
      Specified by:
      removePropertyChangeListener in interface Parameters
      Parameters:
      listener -
    • removeParameter

      public boolean removeParameter(String name)
      Removes the named parameter
      Specified by:
      removeParameter in interface MutableParameters
      Parameters:
      name - the name of the parameter
      Returns:
      whether or not removal was successful
    • addParameter

      public void addParameter(String name, String displayName, Class type, Object value, boolean isReadOnly)
      Adds a parameter to this Parameters.
      Specified by:
      addParameter in interface MutableParameters
      Parameters:
      name - the name of the parameter
      displayName - the display name for the parameter
      type - the type of the parameter
      value - the default value of the parameter
      isReadOnly - whether or not the parameter is read only.
    • addConstraint

      public void addConstraint(String name, List constrainingList)
      Constains the value of the named to parameter to those in the list.
      Specified by:
      addConstraint in interface MutableParameters
      Parameters:
      name - the name of the parameter
      constrainingList - a list containing the possible values for the named parameter
    • addConvertor

      public void addConvertor(String name, StringConverter converter)
      Adds a converter to convert the named parameter back and forth to a String.
      Specified by:
      addConvertor in interface MutableParameters
      Parameters:
      name - the name of the parameter
      converter - the converter
    • addConstraint

      public void addConstraint(String name, SteppedRange constrainingRange)
      Constrains the value of the named parameter to those in the specified range.
      Specified by:
      addConstraint in interface MutableParameters
      Parameters:
      name - the name of the parmaeter
      constrainingRange - a range of the possible values for the named parameter
    • addParameter

      protected void addParameter(String name, Class type, Object value, boolean isReadOnly)
      Adds a parameter to this Parameters.
      Parameters:
      name - the name of the parameter
      type - the type of the parameter
      value - the default value of the parameter
      isReadOnly - whether or not the parameter is read only.
    • getSchema

      public Schema getSchema()
      Gets the Schema for this Parameters object.
      Specified by:
      getSchema in interface Parameters
      Returns:
      the Schema for this Parameters object.
    • getValue

      public Object getValue(String paramName)
      Gets the value associated with the specified parameter name.
      Specified by:
      getValue in interface Parameters
      Parameters:
      paramName - the name of the parameter whose value we want
      Returns:
      the value associated with the specified parameter name.
    • getDouble

      public Double getDouble(String paramName)
      Gets the Double value associated with the specified parameter name.
      Specified by:
      getDouble in interface Parameters
      Parameters:
      paramName - the name of the parameter whose value we want
      Returns:
      the value associated with the specified parameter name.
    • getInteger

      public Integer getInteger(String paramName)
      Gets the Integer value associated with the specified parameter name.
      Specified by:
      getInteger in interface Parameters
      Parameters:
      paramName - the name of the parameter whose value we want
      Returns:
      the value associated with the specified parameter name.
    • getBoolean

      public Boolean getBoolean(String paramName)
      Gets the Boolean value associated with the specified parameter name.
      Specified by:
      getBoolean in interface Parameters
      Parameters:
      paramName - the name of the parameter whose value we want
      Returns:
      the value associated with the specified parameter name.
    • getString

      public String getString(String paramName)
      Gets the String value associated with the specified parameter name.
      Specified by:
      getString in interface Parameters
      Parameters:
      paramName - the name of the parameter whose value we want
      Returns:
      the value associated with the specified parameter name.
    • getLong

      public Long getLong(String paramName)
      Gets the Boolean value associated with the specified parameter name.
      Specified by:
      getLong in interface Parameters
      Parameters:
      paramName - the name of the parameter whose value we want
      Returns:
      the value associated with the specified parameter name.
    • getFloat

      public Float getFloat(String paramName)
      Gets the Float value associated with the specified parameter name.
      Specified by:
      getFloat in interface Parameters
      Parameters:
      paramName - the name of the parameter whose value we want
      Returns:
      the value associated with the specified parameter name.
    • getValueAsString

      public String getValueAsString(String paramName)
      Gets a String representation of the specified parameter's value.
      Specified by:
      getValueAsString in interface Parameters
      Parameters:
      paramName - the name of the parameter
      Returns:
      a String representation of the specified parameters's value.
    • isReadOnly

      public boolean isReadOnly(String paramName)
      True if parameter is read only.
      Specified by:
      isReadOnly in interface Parameters
      Parameters:
      paramName - the name of the parameter
      Returns:
      true if parameter is read-only otherwise false.
    • setValue

      public void setValue(String paramName, Object val)
      Sets the specified parameter name to the specified value.
      Specified by:
      setValue in interface Parameters
      Parameters:
      paramName - the name of the parameter to set to the new value
      val - the new value
    • getDisplayName

      public String getDisplayName(String paramName)
      Gets the display name for the specified parameter name.
      Specified by:
      getDisplayName in interface Parameters
      Parameters:
      paramName - the parameter name
      Returns:
      the display name for the specified parameter name.