Class OperatorTokenMatcher

java.lang.Object
com.singularsys.jep.configurableparser.matchers.OperatorTokenMatcher
All Implemented Interfaces:
TokenMatcher, Serializable
Direct Known Subclasses:
UpperCaseOperatorTokenMatcher

public class OperatorTokenMatcher extends Object implements TokenMatcher
TokenMatcher for matching operators from the operator set.
See Also:
  • Constructor Details

    • OperatorTokenMatcher

      public OperatorTokenMatcher()
      Default constructor. The operator set is supplied using the init(com.singularsys.jep.Jep) method.
  • Method Details

    • init

      public void init(Jep j)
      Initializes the map and tokens member from the list of operators in the operator table of the Jep instance.
      Specified by:
      init in interface TokenMatcher
      Parameters:
      j - Jep instance
    • init

      public void init(OperatorTableI os)
      Initializes the map and tokens member from the list of operators in the operator table.
      Parameters:
      os - the operator table to initialize with. In Jep 3.5 and later there is one OperatorToken for each alternate symbol.
    • getToken

      public OperatorToken getToken(String key)
      Gets the OperatorToken used for a give key.
      Parameters:
      key - symbol of the operator.
      Returns:
      matching token or null
      Since:
      Jep 4.1
    • match

      public Token match(String s)
      Quickly checks whether the first characters of the string match any of the supplied operator strings.
      Specified by:
      match in interface TokenMatcher
      Parameters:
      s - the string to match against
      Returns:
      if successful returns the corresponding token, return null if failed to match
    • toString

      public String toString()
      Overrides:
      toString in class Object