Class SymbolTokenMatcher
java.lang.Object
com.singularsys.jep.configurableparser.matchers.SymbolTokenMatcher
- All Implemented Interfaces:
TokenMatcher,Serializable
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(SymbolToken t) Adds a new SymbolToken to be matched.Gets the root SymbolToken for this string.voidInitialize the matcher when the Jep instance is known.Match the start of the string.
-
Constructor Details
-
SymbolTokenMatcher
public SymbolTokenMatcher()
-
-
Method Details
-
match
Match the start of the string.- Specified by:
matchin interfaceTokenMatcher- Parameters:
s- a string to be matched- Returns:
- a clone of the matching symbol
-
add
Adds a new SymbolToken to be matched.- Parameters:
t- a SymbolToken- Returns:
- true (as specified by
Collection.add)
-
init
Description copied from interface:TokenMatcherInitialize the matcher when the Jep instance is known.- Specified by:
initin interfaceTokenMatcher- Parameters:
j- Jep instance
-
getSymbolToken
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
-