vmm3d.functions
Class Variable
- java.lang.Object
-
- vmm3d.functions.Variable
-
public class Variable extends java.lang.ObjectA real-valued variable. A Variable can be added to aParserso that it can be used in the defintion of functions and expressions that are parsed by that parser. It is possible to change the value of a variable with thesetVal(double)method, which will affect the value of any expressions and functions in which it is used.
-
-
Constructor Summary
Constructors Constructor and Description Variable(double x)Create a Variable with a specified initial value and with name initially equal to null.Variable(java.lang.String name)Create a variable with initial value zero.Variable(java.lang.String name, double x)Create a variable with a specified name and initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringgetName()Gets the name of this variable.doublegetVal()Returns the current value of this variable.voidsetName(java.lang.String name)Sets the name of this variable.voidsetVal(double x)Sets the value of this variable.
-
-
-
Constructor Detail
-
Variable
public Variable(java.lang.String name, double x)Create a variable with a specified name and initial value.- Parameters:
name- the name of the variable. This can be null. If the variable is to be added to a Parser, then the name must be non-null and should be a legal identifier (starting with a letter and containing only letters, digits and the underscore character).x- the initial value of the variable.
-
Variable
public Variable(java.lang.String name)
Create a variable with initial value zero.
-
Variable
public Variable(double x)
Create a Variable with a specified initial value and with name initially equal to null.
-
-
Method Detail
-
getVal
public double getVal()
Returns the current value of this variable.
-
setVal
public void setVal(double x)
Sets the value of this variable.
-
getName
public java.lang.String getName()
Gets the name of this variable. This can be null.
-
setName
public void setName(java.lang.String name)
Sets the name of this variable. The name should not be changed after the variable has been added to a Parser; even if the name is changed, the Parser will continue to use it under the name it had at the time it was added to the parser.
-
-
DMelt 3.0 © DataMelt by jWork.ORG