Package org.opensourcephysics.tools
Class Parameter
java.lang.Object
org.opensourcephysics.tools.Parameter
- All Implemented Interfaces:
FunctionEditor.FObject
This represents a parameter expression that is parsed and evaluated as a
function of other parameters.
- Author:
- Douglas Brown
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if this is equal to another parameter.protected double
Determines the value of this parameter based on input parameter values.double
Determines the value of this parameter based on input parameter values.Gets the description of this parameter.Gets the expression for this parameter.static XML.ObjectLoader
Returns an ObjectLoader to save and load data for this class.getName()
Gets the name of this parameter.double
getValue()
Gets the current value of this parameter.boolean
Returns true if this parameter's expression is user-editable.boolean
Returns true if this parameter's name is user-editable.boolean
isSynced()
Returns true if this parameter is synced.void
setDescription
(String desc) Sets the description of this parameter.void
setExpressionEditable
(boolean edit) Sets the expression editable property.void
setNameEditable
(boolean edit) Sets the name editable property.void
setSynced
(boolean sync) Sets the synced property.toString()
-
Field Details
-
PROPERTY_PARAMETER_SYNCED
- See Also:
-
-
Constructor Details
-
Parameter
Constructor with name and function.- Parameters:
name
- the namefunction
- the function (parser expression)
-
Parameter
Constructor with name, function and description.- Parameters:
name
- the namefunction
- the function (parser expression)desc
- the description
-
-
Method Details
-
getName
Gets the name of this parameter.- Returns:
- the name
-
getExpression
Gets the expression for this parameter.- Returns:
- the expression
-
getDescription
Gets the description of this parameter. May return null.- Returns:
- the description
-
setDescription
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
Determines if this is equal to another parameter. -
evaluate
Determines the value of this parameter based on input parameter values.- Parameters:
parameters
- the input parameters- Returns:
- the value (may be NaN)
-
evaluate
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
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
toString
-