Package net.objecthunter.exp4j.tokenizer
Class VariableToken
java.lang.Object
net.objecthunter.exp4j.tokenizer.Token
net.objecthunter.exp4j.tokenizer.VariableToken
- All Implemented Interfaces:
Serializable
represents a setVariable used in an expression
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Retrieves a copy of this tokengetName()
Get the name of the setVariabledouble
getValue()
Retrieves the currently assigned value for this Variableboolean
Tells if a value has been set for this variablevoid
setValue
(double value) Sets a new value for this VariabletoString()
-
Constructor Details
-
VariableToken
Create a new instance- Parameters:
name
- the name of the setVariable
-
-
Method Details
-
getName
Get the name of the setVariable- Returns:
- the name
-
getValue
public double getValue()Retrieves the currently assigned value for this Variable- Returns:
- value
-
setValue
public void setValue(double value) Sets a new value for this Variable- Parameters:
value
- new value for this variable
-
isValueSet
public boolean isValueSet()Tells if a value has been set for this variable- Returns:
true
if a value has been set, andfalse
otherwise
-
copy
Retrieves a copy of this token- Returns:
VariableToken
-
toString
-