Class VariableToken

  • All Implemented Interfaces:
    java.io.Serializable

    public final class VariableToken
    extends Token
    represents a setVariable used in an expression
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      VariableToken​(java.lang.String name)
      Create a new instance
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      VariableToken copy()
      Retrieves a copy of this token
      java.lang.String getName()
      Get the name of the setVariable
      double getValue()
      Retrieves the currently assigned value for this Variable
      boolean isValueSet()
      Tells if a value has been set for this variable
      void setValue​(double value)
      Sets a new value for this Variable
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from class net.objecthunter.exp4j.tokenizer.Token

        getType
    • Constructor Detail

      • VariableToken

        public VariableToken​(java.lang.String name)
        Create a new instance
        Parameters:
        name - the name of the setVariable
    • Method Detail

      • getName

        public java.lang.String 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, and false otherwise
      • copy

        public VariableToken copy()
        Retrieves a copy of this token
        Returns:
        VariableToken
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object