Class NumberTokenMatcher
- java.lang.Object
-
- com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
-
- com.singularsys.jep.configurableparser.matchers.NumberTokenMatcher
-
- All Implemented Interfaces:
TokenBuilder,TokenMatcher,java.io.Serializable
public class NumberTokenMatcher extends RegExpTokenMatcher
Matches numbers. The jep NumberFactory is used to create the number.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NumberTokenMatcher(java.lang.String regex)NumberTokenMatcher(java.util.regex.Pattern pattern)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenbuildToken(java.lang.String s)Builds a token following a successful match.static NumberTokenMatcherdefaultNumberTokenMatcher()Factory to create a matcher for decimal number without exponentsstatic NumberTokenMatcherexponentNumberTokenMatcher()Factory to create a matcher for decimal number with or without exponentsvoidinit(Jep jep)Initialize the matcher when the Jep instance is known.-
Methods inherited from class com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
match
-
-
-
-
Method Detail
-
buildToken
public Token buildToken(java.lang.String s)
Description copied from class:RegExpTokenMatcherBuilds a token following a successful match. Note new objects should be created each time as error reporting information is later attached to tokens.- Specified by:
buildTokenin interfaceTokenBuilder- Specified by:
buildTokenin classRegExpTokenMatcher- Parameters:
s- String representing the completed matched token- Returns:
- the appropriate type of token.
-
defaultNumberTokenMatcher
public static NumberTokenMatcher defaultNumberTokenMatcher()
Factory to create a matcher for decimal number without exponents- Returns:
- the matcher
-
exponentNumberTokenMatcher
public static NumberTokenMatcher exponentNumberTokenMatcher()
Factory to create a matcher for decimal number with or without exponents- Returns:
- the matcher
-
init
public void init(Jep jep)
Description copied from interface:TokenMatcherInitialize the matcher when the Jep instance is known.- Parameters:
jep- Jep instance
-
-