public class PatternMatcher extends java.lang.Object implements PatternHandler
Implementation of the PatternHandler interface using the JDK 1.4
package java.util.regex.
PatternHandler.Result| Constructor and Description |
|---|
PatternMatcher(TokenizerProperty prop,
int globalFlags)
The constructor takes a pattern and the
TokenizerProperty object
associated with this instance of PatternMatcher. |
| Modifier and Type | Method and Description |
|---|---|
TokenizerProperty |
getProperty()
Retrieving the
TokenizerProperty of this PatternMatcher. |
boolean |
hasPattern()
The method is a dummy implementation for the interface
PatternHandler
and always returns true. |
PatternHandler.Result |
matches(DataProvider dataProvider)
This method checks if the start of a character range given through the
DataProvider matches a pattern. |
void |
setProperty(TokenizerProperty prop)
Setting the
TokenizerProperty for this PatternMatcher. |
public PatternMatcher(TokenizerProperty prop, int globalFlags) throws java.lang.NullPointerException
TokenizerProperty object
associated with this instance of PatternMatcher. The global
flags are passed to control the behaviour for attributes that are not
specified in the property itself (e.g. case-sensitivity).prop - the TokenizerProperty associated with this objectglobalFlags - flags that are to be used if not set explicitely in the propertyjava.lang.NullPointerException - if the given parameter is nullpublic boolean hasPattern()
PatternHandler
and always returns true.hasPattern in interface PatternHandlertruepublic PatternHandler.Result matches(DataProvider dataProvider) throws TokenizerException, java.lang.NullPointerException
DataProvider matches a pattern. See PatternHandler.matches(de.susebox.jtopas.spi.DataProvider)
for details.matches in interface PatternHandlerdataProvider - the source to get the data fromfreePatternOnly - if true only unbounded pattern should be
checked (pattern not enclosed in whitespaces, separators etc.)PatternHandler.Result object or null if no
match was foundTokenizerException - generic exceptionjava.lang.NullPointerException - if no DataProvider is givenpublic void setProperty(TokenizerProperty prop) throws java.lang.NullPointerException
TokenizerProperty for this PatternMatcher.
This method will recompile the regular expression pattern.prop - the TokenizerProperty associated with this objectjava.lang.NullPointerException - if the given parameter is nullpublic TokenizerProperty getProperty()
TokenizerProperty of this PatternMatcher.TokenizerProperty associated with this object