Class Parameter

java.lang.Object
org.opensourcephysics.tools.Parameter
All Implemented Interfaces:
FunctionEditor.FObject

public class Parameter extends Object implements FunctionEditor.FObject
This represents a parameter expression that is parsed and evaluated as a function of other parameters.
Author:
Douglas Brown
  • Field Details

  • Constructor Details

    • Parameter

      public Parameter(String name, String function)
      Constructor with name and function.
      Parameters:
      name - the name
      function - the function (parser expression)
    • Parameter

      public Parameter(String name, String function, String desc)
      Constructor with name, function and description.
      Parameters:
      name - the name
      function - the function (parser expression)
      desc - the description
  • Method Details

    • getName

      public String getName()
      Gets the name of this parameter.
      Returns:
      the name
    • getExpression

      public String getExpression()
      Gets the expression for this parameter.
      Returns:
      the expression
    • getDescription

      public String getDescription()
      Gets the description of this parameter. May return null.
      Returns:
      the description
    • setDescription

      public void setDescription(String desc)
      Sets the description of this parameter.
      Parameters:
      desc - the description
    • getValue

      public double getValue()
      Gets the current value of this parameter.
      Returns:
      the value (may be NaN)
    • isExpressionEditable

      public boolean isExpressionEditable()
      Returns true if this parameter's expression is user-editable.
      Returns:
      true if editable
    • setExpressionEditable

      public void setExpressionEditable(boolean edit)
      Sets the expression editable property.
      Parameters:
      edit - true if editable
    • isNameEditable

      public boolean isNameEditable()
      Returns true if this parameter's name is user-editable.
      Returns:
      true if editable
    • setNameEditable

      public void setNameEditable(boolean edit)
      Sets the name editable property.
      Parameters:
      edit - true if editable
    • isSynced

      public boolean isSynced()
      Returns true if this parameter is synced.
      Returns:
      true if synced
    • setSynced

      public void setSynced(boolean sync)
      Sets the synced property.
      Parameters:
      sync - true to sync
    • equals

      public boolean equals(Object obj)
      Determines if this is equal to another parameter.
      Overrides:
      equals in class Object
      Parameters:
      obj - another object
      Returns:
      true if equal
    • evaluate

      protected double evaluate(List<?> parameters)
      Determines the value of this parameter based on input parameter values.
      Parameters:
      parameters - the input parameters
      Returns:
      the value (may be NaN)
    • evaluate

      public double evaluate(Parameter[] parameters)
      Determines the value of this parameter based on input parameter values. This method assumes the array of parameters does not include this.
      Parameters:
      parameters - the input parameters
      Returns:
      the value (may be NaN)
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an ObjectLoader to save and load data for this class.
      Returns:
      the object loader
    • toString

      public String toString()
      Overrides:
      toString in class Object