public interface SequenceHandler
This interface must be implemented by classes that should be used as a
special sequence, string and comment start sequence checker for
Tokenizer
implementations.
Tokenizer
,
TokenizerProperties
,
DataMapper
Modifier and Type | Method and Description |
---|---|
int |
getSequenceMaxLength()
This method returns the length of the longest special sequence, comment or
string prefix that is known to this
SequenceHandler . |
boolean |
hasSequenceCommentOrString()
This method can be used by a
Tokenizer implementation
for a fast detection if special sequence checking must be performed at all. |
TokenizerProperty |
startsWithSequenceCommentOrString(DataProvider dataProvider)
This method checks if a given range of data starts with a special sequence,
a comment or a string.
|
boolean hasSequenceCommentOrString()
Tokenizer
implementation
for a fast detection if special sequence checking 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 tested
for a match, false
otherwise.TokenizerProperty startsWithSequenceCommentOrString(DataProvider dataProvider) throws TokenizerException, java.lang.NullPointerException
null
if no special sequence, comment or string
could matches the the leading part of the data range given through the
DataProvider
.
Tokenizer
.dataProvider
- the source to get the data range fromTokenizerProperty
if a special sequence,
comment or string could be detected, null
otherwiseTokenizerException
- generic exceptionjava.lang.NullPointerException
- if no DataProvider
is givenint getSequenceMaxLength()
SequenceHandler
. When
calling startsWithSequenceCommentOrString(de.susebox.jtopas.spi.DataProvider)
, the passed DataProvider
parameter will supply at least this number of characters (see DataProvider.getLength()
).
If less characters are provided, EOF is reached.
Tokenizer
(represented by the given DataProvider
) can supply enough data for
the startsWithSequenceCommentOrString(de.susebox.jtopas.spi.DataProvider)
method.