| de.susebox.jtopas.spi.PatternHandler
All known Subclasses: de.susebox.jtopas.impl.PatternMatcher,
Inner Class :public static interface Result | |
hasPattern | public boolean hasPattern()(Code) | | This method can be used by a
de.susebox.jtopas.Tokenizer implementation
for a fast detection if pattern matching must be performed at all. If the method
returns false time-consuming preparations can be skipped.
true if there actually are pattern that can be testedfor a match, false otherwise. |
matches | public PatternHandler.Result matches(DataProvider dataProvider) throws TokenizerException, NullPointerException(Code) | | This method checks if the start of a character range given through the
DataProvider matches a pattern. An implementation should use
a
de.susebox.jtopas.TokenizerException to report problems.
The method returns null if the beginning of the character range
doesn't match a pattern known to the PatternHandler . Otherwise
it returns an object with the implemented interface
PatternHandler.Result .
The pattern check is repeated if the method returns a match that is exactly
as long as the given data range and more data is available. Since it is
probably a rare case, that where are not enough data to find a complete or
no match, the overhead of a repeated check on part of the data is neglected.
If a pattern handler has more than one pattern that could be applied to the
given data, it should return the longest possible match.
Parameters: dataProvider - the source to get the data from Parameters: lengthOfMatch - if a match is found, the method places the length ofit into the first element of this array a PatternHandler.Result object or null if nomatch was found throws: TokenizerException - generic exception throws: NullPointerException - if no DataProvider is given |
|
|