public class SequenceStore extends java.lang.Object implements SequenceHandler, KeywordHandler
StandardTokenizerProperties
to store and search special sequences, comments and strings as well as
keywords. The class is not suitable for standalone use since it does not check
parameters for null
values, assumes a thread-safe context etc.StandardTokenizerProperties
,
SequenceHandler
Modifier and Type | Field and Description |
---|---|
static char |
DIRECT_INDEX_COUNT
This number is the size of the array that is directly indexed by letters
|
Constructor and Description |
---|
SequenceStore(boolean useExactLength)
The constructor initializes a
SequenceStore with the given
comparision policy (prefix comparison). |
Modifier and Type | Method and Description |
---|---|
TokenizerProperty |
addKeyword(TokenizerProperty property)
Addingt or replacing a keyword.
|
TokenizerProperty |
addSpecialSequence(TokenizerProperty property)
Addingt or replacing a special sequence, comment or string.
|
TokenizerProperty |
getKeyword(java.lang.String image)
Get the full description of a keyword property.
|
java.util.Iterator |
getKeywords()
This method returns an
Iterator of TokenizerProperty
objects describing keywords. |
int |
getSequenceMaxLength()
This method returns the length of the longest special sequence, comment or
string prefix that is known to this
SequenceStore . |
TokenizerProperty |
getSpecialSequence(java.lang.String image)
Get the full description of a special sequence property.
|
java.util.Iterator |
getSpecialSequences(int type)
This method returns an
Iterator of TokenizerProperty
objects. |
boolean |
hasKeywords()
This method returns
true if there are any keywords registered
in this instance. |
boolean |
hasSequenceCommentOrString()
This method returns
true if there are any special sequences,
strings or comments registered in this instance. |
TokenizerProperty |
isKeyword(DataProvider dataProvider)
This method checks if the given data form a keyword.
|
TokenizerProperty |
removeKeyword(java.lang.String image)
Removing a special sequence from the store.
|
TokenizerProperty |
removeSpecialSequence(java.lang.String image)
Removing a special sequence from the store.
|
TokenizerProperty |
startsWithSequenceCommentOrString(DataProvider dataProvider)
This method checks if a given range of data starts with a special sequence,
a comment or a string.
|
public static char DIRECT_INDEX_COUNT
public SequenceStore(boolean useExactLength)
SequenceStore
with the given
comparision policy (prefix comparison).useExactLength
- if true
search only for a property that
has the length of DataProvider.getLength()
public boolean hasSequenceCommentOrString()
true
if there are any special sequences,
strings or comments registered in this instance. See the
SequenceHandler
interface for details.hasSequenceCommentOrString
in interface SequenceHandler
true
if there are any special sequences, strings or
comments available, false
otherwise.public TokenizerProperty startsWithSequenceCommentOrString(DataProvider dataProvider) throws TokenizerException, java.lang.NullPointerException
SequenceHandler
for
details.startsWithSequenceCommentOrString
in interface SequenceHandler
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 givenpublic int getSequenceMaxLength()
SequenceStore
. See
SequenceHandler
for details.getSequenceMaxLength
in interface SequenceHandler
public boolean hasKeywords()
true
if there are any keywords registered
in this instance. See the KeywordHandler
interface for details.hasKeywords
in interface KeywordHandler
true
if there are any keywords available,
false
otherwise.public TokenizerProperty isKeyword(DataProvider dataProvider) throws TokenizerException, java.lang.NullPointerException
KeywordHandler
for details.isKeyword
in interface KeywordHandler
dataProvider
- the source to get the data range fromTokenizerProperty
if keyword has been found,
null
otherwiseTokenizerException
- generic exceptionjava.lang.NullPointerException
- if no DataProvider
is givenpublic TokenizerProperty addSpecialSequence(TokenizerProperty property)
property
- the description of the new sequencenull
public TokenizerProperty removeSpecialSequence(java.lang.String image)
null
.image
- sequence to removenull
if the sequence was not foundpublic TokenizerProperty getSpecialSequence(java.lang.String image)
image
- sequence to findnull
public java.util.Iterator getSpecialSequences(int type)
Iterator
of TokenizerProperty
objects.type
- type of special sequence like Token.STRING
TokenizerProperty
objectspublic TokenizerProperty addKeyword(TokenizerProperty property)
property
- the description of the new keywordnull
public TokenizerProperty removeKeyword(java.lang.String image)
null
.image
- sequence to removenull
if the sequence was not foundpublic TokenizerProperty getKeyword(java.lang.String image)
image
- keyword candidate to look fornull
public java.util.Iterator getKeywords()
Iterator
of TokenizerProperty
objects describing keywords.TokenizerProperty
objects representing
keywords