Package com.singularsys.jep.configurableparser.matchers

# Class SymbolTokenMatcher

java.lang.Object
com.singularsys.jep.configurableparser.matchers.SymbolTokenMatcher

All Implemented Interfaces:
  `TokenMatcher`, `Serializable`

public class SymbolTokenMatcher extends Object implements TokenMatcher
Matches a fixed set of symbols, each represented by a SymbolToken. Each SymbolToken behaves like a singleton, only one instance is created and this is returned by the match method.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SymbolTokenMatcher()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `add(SymbolToken t)`
  Adds a new SymbolToken to be matched.
  `SymbolToken`
  `getSymbolToken(String s)`
  Gets the root SymbolToken for this string.
  `void`
  `init(Jep j)`
  Initialize the matcher when the Jep instance is known.
  `Token`
  `match(String s)`
  Match the start of the string.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SymbolTokenMatcher

    public SymbolTokenMatcher()

- ## Method Details

  - ### match

    public Token match(String s)
    Match the start of the string.
    Specified by:
      `match` in interface `TokenMatcher`
    Parameters:
      `s` - a string to be matched
    Returns:
      a clone of the matching symbol

  - ### add

    public boolean add(SymbolToken t)
    Adds a new SymbolToken to be matched.
    Parameters:
      `t` - a SymbolToken
    Returns:
      true (as specified by `Collection.add`)

  - ### init

    public void init(Jep j)
    Description copied from interface: `TokenMatcher`
    Initialize the matcher when the Jep instance is known.
    Specified by:
      `init` in interface `TokenMatcher`
    Parameters:
      `j` - Jep instance

  - ### getSymbolToken

    public SymbolToken getSymbolToken(String s)
    Gets the root SymbolToken for this string. Unlike the match method which returns a clone of the token, this returns the base symbol.
    Parameters:
      `s` - a string to be matched exactly
    Returns:
      the symbol token or null is no such symbol