Class AbstractInputParameter<VT,CT>

java.lang.Object
nl.tudelft.simulation.dsol.model.inputparameters.AbstractInputParameter<VT,CT>
Type Parameters:
VT - Value type of the input parameter
CT - Calculated type of the input parameter (often the same as VT, except in complex maps)
All Implemented Interfaces:
Serializable, Cloneable, InputParameter<VT,CT>
Direct Known Subclasses:
AbstractInputParameterMap, InputParameterBoolean, InputParameterDistContinuous, InputParameterDistDiscrete, InputParameterDouble, InputParameterFloat, InputParameterInteger, InputParameterLong, InputParameterSelectionList, InputParameterSelectionMap, InputParameterString

public abstract class AbstractInputParameter<VT,CT> extends Object implements InputParameter<VT,CT>
Abstract input parameter.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

$LastChangedDate: 2016-05-28 11:33:31 +0200 (Sat, 28 May 2016) $, @version $Revision: 2051 $, by $Author: averbraeck $, initial version 18 dec. 2014

Author:
Peter Knoppers
See Also:
  • Constructor Details

    • AbstractInputParameter

      public AbstractInputParameter(String key, String shortName, String description, VT defaultValue, double displayPriority)
      Construct a new AbstractInputParameter.
      Parameters:
      key - String; unique (within this input parameter tree) name of the new AbstractInputParameter
      shortName - String; concise description of the input parameter
      description - String; long description of the input parameter (may use HTML markup)
      defaultValue - VT; the default value of this input parameter
      displayPriority - double; sorting order when properties are displayed to the user
      Throws:
      NullPointerException - when key, shortName, defaultValue, or description is null
      IllegalArgumentException - when displayPriority is NaN, or when key contains a period
  • Method Details

    • getKey

      public String getKey()
      Retrieve the key of this InputParameter. The key is set at time of construction and it is immutable.
      Specified by:
      getKey in interface InputParameter<VT,CT>
      Returns:
      String; the key of this InputParameter
    • getExtendedKey

      public String getExtendedKey()
      Retrieve the extended key of this AbstractInputParameter including parents with a dot-notation.
      Specified by:
      getExtendedKey in interface InputParameter<VT,CT>
      Returns:
      String; the extended key of this AbstractInputParameter
    • getValue

      public VT getValue()
      Retrieve the current value of the input parameter.
      Specified by:
      getValue in interface InputParameter<VT,CT>
      Returns:
      VT; the current value of the input parameter
    • setValue

      public void setValue(VT newValue) throws InputParameterException
      Change the value of the input parameter. This method is protected and final, so classes that extend this class must use their own method to set the value (e.g., setDoubleValue(...)), which has to call, in turn, super.setValue(...) to make the actual setting of the value happen. In case the setValue(...) method would be non-final and public, it would be too easy to forget to call super.setValue(...).
      Parameters:
      newValue - VT; the new value for the input parameter
      Throws:
      NullPointerException - when newValue is null
      InputParameterException - when this InputParameter is read-only, or newValue is not valid
    • getDefaultValue

      public VT getDefaultValue()
      Retrieve the default value of the input parameter.
      Specified by:
      getDefaultValue in interface InputParameter<VT,CT>
      Returns:
      VT; the default value of the input parameter
    • setDefaultValue

      public void setDefaultValue(VT newValue) throws InputParameterException
      Change the default value of the input parameter.
      Specified by:
      setDefaultValue in interface InputParameter<VT,CT>
      Parameters:
      newValue - VT; the new default value for the input parameter
      Throws:
      InputParameterException - when this InputParameter is read-only, or newValue is not valid
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Specify if the input parameter can be altered.
      Specified by:
      setReadOnly in interface InputParameter<VT,CT>
      Parameters:
      readOnly - boolean; true if this input parameter can not be altered, false if this input parameter can be altered
    • getDisplayPriority

      public double getDisplayPriority()
      Display priority determines the order in which properties should be displayed. Properties with lower values should be displayed above or before those with higher values.
      Specified by:
      getDisplayPriority in interface InputParameter<VT,CT>
      Returns:
      double; the display priority of this InputParameter
    • getShortName

      public String getShortName()
      Return a short description of the input parameter.
      Specified by:
      getShortName in interface InputParameter<VT,CT>
      Returns:
      String; a short description of the input parameter
    • getDescription

      public String getDescription()
      Return a description of the input parameter (may use HTML markup).
      Specified by:
      getDescription in interface InputParameter<VT,CT>
      Returns:
      String; the description of the input parameter
    • isReadOnly

      public boolean isReadOnly()
      Return true if the input parameter can not be altered.
      Specified by:
      isReadOnly in interface InputParameter<VT,CT>
      Returns:
      boolean; true if this input parameter can not be altered, false if this input parameter can be altered
    • setParent

      public void setParent(AbstractInputParameterMap<?> newParent)
      Set the parent of this AbstractInputParameter.
      Parameters:
      newParent - AbstractInputParameterMap<?>; the new parent of this AbstractInputParameter
    • getParent

      public AbstractInputParameterMap<?> getParent()
      Retrieve the parent input parameter.
      Specified by:
      getParent in interface InputParameter<VT,CT>
      Returns:
      the InputParameterMap that is the parent of this InputParameter (result is null if this input parameter is not contained in an InputParameterMap)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public AbstractInputParameter<?,?> clone()
      Provide the clone() method to make a deep copy.
      Specified by:
      clone in interface InputParameter<VT,CT>
      Overrides:
      clone in class Object
      Returns:
      a deep copy of the InputParameter