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
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Retrieves a copy of this tokengetName()Get the name of the setVariabledoublegetValue()Retrieves the currently assigned value for this VariablebooleanTells if a value has been set for this variablevoidsetValue(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:
trueif a value has been set, andfalseotherwise
-
copy
Retrieves a copy of this token- Returns:
VariableToken
-
toString
-