public interface TokenizerProperties
The interface TokenizerProperties
declares constants and methods
to maintain the characteristics of a Tokenizer
, e. g. comments, keywords
and special sequences. A TokenizerProperties
implementation instance
can be used by one or more Tokenizer
instances.
A TokenizerProperties
object that is used to parse Java or C code
including line and column information, would be setup like this:
TokenizerProperties props = new StandardTokenizerProperties(); props.setParseFlags(Flags.F_COUNT_LINES); props.addLineComment("//"); props.addBlockComment(TokenizerProperties.DEFAULT_BLOCK_COMMENT_START, TokenizerProperties.DEFAULT_BLOCK_COMMENT_END); props.addString("\"", "\"", "\\"); props.addString("'", "'", "\\"); props.addSpecialSequence(">>"); props.addSpecialSequence("<<"); props.addSpecialSequence("++"); props.addSpecialSequence("--"); ... props.addKeyword("class"); props.addKeyword("if"); props.addKeyword("then"); props.addKeyword("while"); props.addKeyword("do"); ...
Beside the dedicated method groups for comments, strings, keywords and
special sequences (e.g. addKeyword(java.lang.String)
, removeKeyword(java.lang.String)
and
keywordExists(java.lang.String)
) there is a set of generic methods working with
TokenizerProperty
objects:
addProperty(de.susebox.jtopas.TokenizerProperty)
,
removeProperty(de.susebox.jtopas.TokenizerProperty)
and
propertyExists(de.susebox.jtopas.TokenizerProperty)
.
When adding a property through one of the add...
calls without
the flags
parameter, the currently active flags of the
TokenizerProperties
instance will be used for the property.
This interface is separated from the Tokenizer
interface mainly to
distinguish between the more static information, the actual source of data
and the tokenizing process. Especially in multithreaded environments where
multible instances of "equal" tokenizers are run at the same time, it saves
both memory resources and setup effort to have one TokenizerProperties
instance for all Tokenizer
instances.
Beside its function as a store for lexical element descriptions, this interface also provides an event mechanism to notify all interested objects about changes (additions, modifications and removals) of such lexical element descriptions.
This interface partly replaces the older de.susebox.java.util.Tokenizer
interface which is deprecated.
Token
,
Tokenizer
,
TokenizerProperty
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_BLOCK_COMMENT_END
Default end sequence of a block comment (Java, C/C++).
|
static java.lang.String |
DEFAULT_BLOCK_COMMENT_START
Default starting sequence of a block comment (Java, C/C++).
|
static java.lang.String |
DEFAULT_CHAR_END
The well-known character ending sequence of C/C++, Java and other languages.
|
static java.lang.String |
DEFAULT_CHAR_ESCAPE
The well-known escape sequence for character literals in C/C++, Java and other
languages.
|
static java.lang.String |
DEFAULT_CHAR_START
The well-known character starting sequence of C/C++, Java and other languages.
|
static java.lang.String |
DEFAULT_LINE_COMMENT
Default line comment seqence (Java, C++)
|
static java.lang.String |
DEFAULT_SEPARATORS
Separators are otherwise not remarkable characters.
|
static java.lang.String |
DEFAULT_STRING_END
The well-known string ending sequence of C/C++, Java and other languages.
|
static java.lang.String |
DEFAULT_STRING_ESCAPE
The well-known escape sequence for strings in C/C++, Java and other languages.
|
static java.lang.String |
DEFAULT_STRING_START
The well-known string starting sequence " of C/C++, Java and other languages.
|
static java.lang.String |
DEFAULT_WHITESPACES
Whitespaces are portions of the text, that contain one or more characters
that separate the significant parts of the text.
|
Modifier and Type | Method and Description |
---|---|
void |
addBlockComment(java.lang.String start,
java.lang.String end)
Registering a block comment with the parser.
|
void |
addBlockComment(java.lang.String start,
java.lang.String end,
java.lang.Object companion)
Registering a block comment with the parser.
|
void |
addBlockComment(java.lang.String start,
java.lang.String end,
java.lang.Object companion,
int flags)
Registering a block comment.
|
void |
addBlockComment(java.lang.String start,
java.lang.String end,
java.lang.Object companion,
int flags,
int flagMask)
Registering a block comment with a set of flags and an associated flag mask.
|
void |
addKeyword(java.lang.String keyword)
Registering a keyword.
|
void |
addKeyword(java.lang.String keyword,
java.lang.Object companion)
Registering a keyword.
|
void |
addKeyword(java.lang.String keyword,
java.lang.Object companion,
int flags)
Registering a keyword.
|
void |
addKeyword(java.lang.String keyword,
java.lang.Object companion,
int flags,
int flagMask)
Registering a keyword with a set of flags and an associated flag mask..
|
void |
addLineComment(java.lang.String lineComment)
Registering a the starting sequence of a line comment.
|
void |
addLineComment(java.lang.String lineComment,
java.lang.Object companion)
Registering a the starting sequence of a line comment.
|
void |
addLineComment(java.lang.String lineComment,
java.lang.Object companion,
int flags)
Registering a the starting sequence of a line comment.
|
void |
addLineComment(java.lang.String lineComment,
java.lang.Object companion,
int flags,
int flagMask)
Registering a line comment with a set of flags and an associated flag mask.
|
void |
addPattern(java.lang.String pattern)
Registering a pattern.
|
void |
addPattern(java.lang.String pattern,
java.lang.Object companion)
Registering a pattern with an associated object.
|
void |
addPattern(java.lang.String pattern,
java.lang.Object companion,
int flags)
Registering a pattern with an associated object.
|
void |
addPattern(java.lang.String pattern,
java.lang.Object companion,
int flags,
int flagMask)
Registering a pattern with an associated object and explicitely given flags.
|
void |
addProperty(TokenizerProperty property)
Registering a
TokenizerProperty . |
void |
addSeparators(java.lang.String separators)
Adding new separators to the existing set.
|
void |
addSpecialSequence(java.lang.String specSeq)
Registering a special sequence of characters.
|
void |
addSpecialSequence(java.lang.String specSeq,
java.lang.Object companion)
Registering a special sequence of characters.
|
void |
addSpecialSequence(java.lang.String specSeq,
java.lang.Object companion,
int flags)
Registering a special sequence of characters.
|
void |
addSpecialSequence(java.lang.String specSeq,
java.lang.Object companion,
int flags,
int flagMask)
Registering a special sequence with a set of flags and an associated flag mask.
|
void |
addString(java.lang.String start,
java.lang.String end,
java.lang.String escape)
Registering a string description.
|
void |
addString(java.lang.String start,
java.lang.String end,
java.lang.String escape,
java.lang.Object companion)
Registering a the sequences that are used for string-like text parts.
|
void |
addString(java.lang.String start,
java.lang.String end,
java.lang.String escape,
java.lang.Object companion,
int flags)
Registering a the sequences that are used for string-like text parts.
|
void |
addString(java.lang.String start,
java.lang.String end,
java.lang.String escape,
java.lang.Object companion,
int flags,
int flagMask)
Registering a string with a set of flags and an associated flag mask.
|
void |
addTokenizerPropertyListener(TokenizerPropertyListener listener)
Registering a new
TokenizerPropertyListener . |
void |
addWhitespaces(java.lang.String whitespaces)
Adding new whitespaces to the existing set.
|
boolean |
blockCommentExists(java.lang.String start)
Checks if the give block comment is known.
|
TokenizerProperty |
getBlockComment(java.lang.String start)
Get the full description of a block comment property starting with the given
prefix.
|
java.lang.Object |
getBlockCommentCompanion(java.lang.String start)
Retrieving a certain block comment.
|
java.util.Iterator |
getBlockComments()
This method returns an
Iterator of TokenizerProperty
objects. |
TokenizerProperty |
getKeyword(java.lang.String keyword)
Get the full description of a keyword property.
|
java.lang.Object |
getKeywordCompanion(java.lang.String keyword)
Retrieving the companion of the given special sequence.
|
java.util.Iterator |
getKeywords()
This method returns an
Iterator of TokenizerProperty
objects. |
TokenizerProperty |
getLineComment(java.lang.String lineComment)
Get the full description of a line comment property starting with the given
prefix.
|
java.lang.Object |
getLineCommentCompanion(java.lang.String lineComment)
Retrieving the associated object of a certain line comment.
|
java.util.Iterator |
getLineComments()
This method returns an
Iterator of TokenizerProperty
objects. |
int |
getParseFlags()
Retrieving the parser control flags.
|
TokenizerProperty |
getPattern(java.lang.String pattern)
Get the full description of a pattern property.
|
java.lang.Object |
getPatternCompanion(java.lang.String pattern)
Retrieving the information associated with a given pattern.
|
java.util.Iterator |
getPatterns()
This method returns an
Iterator of TokenizerProperty
objects. |
java.util.Iterator |
getProperties()
This method returns an
Iterator of TokenizerProperty
objects. |
java.lang.String |
getSeparators()
Obtaining the separator set of the
TokenizerProperties . |
TokenizerProperty |
getSpecialSequence(java.lang.String specSeq)
Get the full description of a special sequence property.
|
java.lang.Object |
getSpecialSequenceCompanion(java.lang.String specSeq)
Retrieving the companion of the given special sequence.
|
java.util.Iterator |
getSpecialSequences()
This method returns an
Iterator of TokenizerProperty
objects. |
TokenizerProperty |
getString(java.lang.String start)
Get the full description of a string property starting with the given
prefix.
|
java.lang.Object |
getStringCompanion(java.lang.String start)
Retrieving the information associated with a certain string.
|
java.util.Iterator |
getStrings()
This method returns an
Iterator of TokenizerProperty
objects. |
java.lang.String |
getWhitespaces()
Obtaining the whitespace character set.
|
boolean |
isFlagSet(int flag)
Returns
true if a given flag is set in the current parse flags. |
boolean |
isFlagSet(TokenizerProperty prop,
int flag)
Checks if a given flag (see
Flags ) is set for the given TokenizerProperty
in the context of this TokenizerProperties instance. |
boolean |
keywordExists(java.lang.String keyword)
Checks if the given keyword is known to the
TokenizerProperties . |
boolean |
lineCommentExists(java.lang.String lineComment)
Checks if the give line comment is known.
|
boolean |
patternExists(java.lang.String pattern)
Checks if the given pattern is known to the parser.
|
boolean |
propertyExists(TokenizerProperty property)
Checks if the given
TokenizerProperty is known to this TokenizerProperties
instance. |
void |
removeBlockComment(java.lang.String start)
Removing a certain block comment.
|
void |
removeKeyword(java.lang.String keyword)
Removing a keyword property from the store.
|
void |
removeLineComment(java.lang.String lineComment)
Removing a certain line comment.
|
void |
removePattern(java.lang.String pattern)
Removing a pattern.
|
void |
removeProperty(TokenizerProperty property)
Deregistering a
TokenizerProperty from the store. |
void |
removeSeparators(java.lang.String separators)
Removing separators from the existing set.
|
void |
removeSpecialSequence(java.lang.String specSeq)
Removing a special sequence property from the store.
|
void |
removeString(java.lang.String start)
Removing a string description.
|
void |
removeTokenizerPropertyListener(TokenizerPropertyListener listener)
Removing a listener from the list of registered
TokenizerPropertyListener
instances. |
void |
removeWhitespaces(java.lang.String whitespaces)
Removing whitespaces from the existing set.
|
void |
setParseFlags(int flags)
Setting the control flags of the
TokenizerProperties . |
void |
setSeparators(java.lang.String separators)
Setting the separator set.
|
void |
setWhitespaces(java.lang.String whitespaces)
Setting the whitespace character set of the tokenizer.
|
boolean |
specialSequenceExists(java.lang.String specSeq)
Checks if the given special sequence is known to the
TokenizerProperties . |
boolean |
stringExists(java.lang.String start)
Checks if the given starting sequence of the string is known to the parser.
|
static final java.lang.String DEFAULT_WHITESPACES
static final java.lang.String DEFAULT_SEPARATORS
addSpecialSequence(java.lang.String)
) takes
precedence.static final java.lang.String DEFAULT_BLOCK_COMMENT_START
static final java.lang.String DEFAULT_BLOCK_COMMENT_END
static final java.lang.String DEFAULT_LINE_COMMENT
static final java.lang.String DEFAULT_STRING_START
static final java.lang.String DEFAULT_STRING_END
static final java.lang.String DEFAULT_STRING_ESCAPE
static final java.lang.String DEFAULT_CHAR_START
static final java.lang.String DEFAULT_CHAR_END
static final java.lang.String DEFAULT_CHAR_ESCAPE
void setParseFlags(int flags)
TokenizerProperties
. Use a
combination of the Flags
for the parameter.
Tokenizer
objects
sharing this TokenizerProperties
instance. Some flags can be set
for single tokenizers separately.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_MODIFIED
each time it is called with different flag masks. The passed TokenizerProperty
has the type TokenizerProperty.PARSE_FLAG_MASK
.flags
- the parser control flagsint getParseFlags()
Flags
constants is returned. These flags are the ones set for all Tokenizer
instances sharing this TokenizerProperties
object and may be
partially overridden in these tokenizers.setParseFlags(int)
boolean isFlagSet(int flag)
true
if a given flag is set in the current parse flags.
If the parameter contains more than one bit the method returns only
true
if all bits are set.flag
- the flag to testtrue
if all bits in flag are set.setParseFlags(int)
,
getParseFlags()
,
isFlagSet(TokenizerProperty, int)
boolean isFlagSet(TokenizerProperty prop, int flag) throws java.lang.NullPointerException
Flags
) is set for the given TokenizerProperty
in the context of this TokenizerProperties
instance.
TokenizerProperty
object
if it is contained in the flag mask of the property (see TokenizerProperty.containsFlag(int)
).
Otherwise it falls back to the flag state set globally for this
TokenizerProperties
instance.prop
- the TokenizerProperty
concernedflag
- the flag to check (may contain more than one bit)true
if the flag is set either explicit in the property
or globally for this TokenizerProperties
object,
false
otherwisejava.lang.NullPointerException
- if no property is givenvoid setWhitespaces(java.lang.String whitespaces) throws java.lang.IllegalArgumentException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
or
TokenizerPropertyEvent.PROPERTY_MODIFIED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
).
whitespaces
- the whitespace setjava.lang.IllegalArgumentException
- when null
is passed or incomplete
ranges are specified (e.g. "a-"
)getWhitespaces()
,
addWhitespaces(java.lang.String)
,
removeWhitespaces(java.lang.String)
void addWhitespaces(java.lang.String whitespaces) throws java.lang.IllegalArgumentException
DEFAULT_WHITESPACES
set).
setWhitespaces(java.lang.String)
.whitespaces
- additional whitespaces for the whitespace setjava.lang.IllegalArgumentException
- when null
is passed or incomplete
ranges are specified (e.g. "a-"
)getWhitespaces()
,
setWhitespaces(java.lang.String)
,
removeWhitespaces(java.lang.String)
void removeWhitespaces(java.lang.String whitespaces) throws java.lang.IllegalArgumentException
DEFAULT_WHITESPACES
set).
Especially, this method can be used to remove a known single whitespace
without bothering about the other whitespaces
setWhitespaces(java.lang.String)
.whitespaces
- whitespaces to remove from the whitespace setjava.lang.IllegalArgumentException
- when null
is passed or incomplete
ranges are specified (e.g. "a-"
)getWhitespaces()
,
setWhitespaces(java.lang.String)
,
addWhitespaces(java.lang.String)
java.lang.String getWhitespaces()
setWhitespaces(java.lang.String)
void setSeparators(java.lang.String separators) throws java.lang.IllegalArgumentException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
or
TokenizerPropertyEvent.PROPERTY_MODIFIED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
).
separators
- the set of separating charactersjava.lang.IllegalArgumentException
- when null
is passed or incomplete
ranges are specified (e.g. "[-"
)getSeparators()
void addSeparators(java.lang.String separators) throws java.lang.IllegalArgumentException
DEFAULT_SEPARATORS
set).
setSeparators(java.lang.String)
.separators
- additional set of separating charactersjava.lang.IllegalArgumentException
- when null
is passed or incomplete
ranges are specified (e.g. "a-"
)getSeparators()
,
setSeparators(java.lang.String)
,
removeSeparators(java.lang.String)
void removeSeparators(java.lang.String separators) throws java.lang.IllegalArgumentException
DEFAULT_SEPARATORS
set).
Especially, this method can be used to remove a known single separator
without bothering about the other separators.
setSeparators(java.lang.String)
.separators
- separating characters to remove from the separator setjava.lang.IllegalArgumentException
- when null
is passed or incomplete
ranges are specified (e.g. "a-"
)getSeparators()
,
setSeparators(java.lang.String)
,
addSeparators(java.lang.String)
java.lang.String getSeparators()
TokenizerProperties
. The set
may contain ranges or may be empty.setSeparators(java.lang.String)
void addString(java.lang.String start, java.lang.String end, java.lang.String escape) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new string TokenizerProperty
if the string is a new one, or of type TokenizerPropertyEvent.PROPERTY_MODIFIED
if the string is re-registered.
null
or an empty string for the escape sequence means
that no escapes are used in the described string element.start
- the starting sequence of a stringend
- the finishing sequence of a stringescape
- the escape sequence inside the stringjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for start or endjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddString(String, String, String, Object)
,
addString(String, String, String, Object, int)
,
removeString(java.lang.String)
void addString(java.lang.String start, java.lang.String end, java.lang.String escape, java.lang.Object companion) throws java.lang.IllegalArgumentException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new string TokenizerProperty
if the string is a new one, or of type TokenizerPropertyEvent.PROPERTY_MODIFIED
if the string is re-registered.
null
or an empty string for the escape sequence means
that no escapes are used in the described string element.start
- the starting sequence of a stringend
- the finishing sequence of a stringescape
- the escape sequence inside the stringcompanion
- the associated informationjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for start or endjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddString(String, String, String)
,
addString(String, String, String, Object, int)
,
removeString(java.lang.String)
void addString(java.lang.String start, java.lang.String end, java.lang.String escape, java.lang.Object companion, int flags) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addString
supports a bitmask of the
Flags
to modify the general tokenizer settings (see
setParseFlags(int)
for this special element.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new string TokenizerProperty
if the string is a new one, or of type TokenizerPropertyEvent.PROPERTY_MODIFIED
if the string is re-registered.
null
or an empty string for the escape sequence means
that no escapes are used in the described string element.
addString(start, end, escape, flags, flags)
.start
- the starting sequence of a stringend
- the finishing sequence of a stringescape
- the escape sequence inside the stringcompanion
- the associated informationflags
- modification flagsjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for start or endjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddString(String, String, String)
,
addString(String, String, String, Object)
,
addString(String, String, String, Object, int, int)
,
removeString(java.lang.String)
void addString(java.lang.String start, java.lang.String end, java.lang.String escape, java.lang.Object companion, int flags, int flagMask) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
#addString(String, Object, int)
having a bitmask for the flags that are explicitely specified for the block
comment property. All other flag values (states) should be taken from the
TokenizerProperty
instance or from the Tokenizer
.start
- the starting sequence of a stringend
- the finishing sequence of a stringescape
- the escape sequence inside the stringcompanion
- the associated informationflags
- modification flagsflagMask
- flags that have valid values in the parameter flags
java.lang.IllegalArgumentException
- when null
or an empty string
is passed for keywordjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddString(String, String, String)
,
addString(String, String, String, Object)
,
addString(String, String, String, Object, int)
,
removeString(java.lang.String)
void removeString(java.lang.String start) throws java.lang.IllegalArgumentException
start
sequence is not known to this
TokenizerProperties
instance. The method may throw an
IllegalArgumentException
if the given string start is
null
or empty.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_REMOVED
to all registered
listeners (see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) if a string is actually
removed.start
- the starting sequence of a stringjava.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.lang.Object getStringCompanion(java.lang.String start) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
null
will be returned.stringExists(java.lang.String)
.start
- the starting sequence of a stringnull
java.lang.IllegalArgumentException
- when null
or an emtpy string
is passedjava.lang.UnsupportedOperationException
boolean stringExists(java.lang.String start)
null
strings for start
by returning false
.
addString(String, String, String, Object, int)
method), since it
makes generally no sense to "overload" properties. A string might be introduced
by the starting case-insensitive sequence STR
, but there shouldn't
be a case-sensitive start str
.start
- the starting sequence of a stringtrue
if the string is registered,
false
otherwiseTokenizerProperty getString(java.lang.String start) throws java.lang.IllegalArgumentException
null
if the passed start
parameter cannot be mapped to a known string description (stringExists(java.lang.String)
would return false
).start
- the starting sequence of a stringnull
java.lang.IllegalArgumentException
- when null
is passedjava.util.Iterator getStrings()
Iterator
of TokenizerProperty
objects. Each TokenizerProperty
object contains the starting,
finishing and escaping sequence of a string description and the companion if
it exists.TokenizerProperty
objectsvoid addLineComment(java.lang.String lineComment) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
lineComment
- the starting sequence of the line commentjava.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddLineComment(String, Object)
,
addLineComment(String, Object, int)
,
removeLineComment(java.lang.String)
void addLineComment(java.lang.String lineComment, java.lang.Object companion) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new line comment
TokenizerProperty
if the line comment is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the line comment is
re-registered.lineComment
- the starting sequence of a line commentcompanion
- the associated informationjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for lineCommentjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddLineComment(String)
,
addLineComment(String, Object, int)
,
removeLineComment(java.lang.String)
void addLineComment(java.lang.String lineComment, java.lang.Object companion, int flags) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addLineComment
supports a bitmask of the
Flags
to modify the general tokenizer settings (see
setParseFlags(int)
) for this special element.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new line comment
TokenizerProperty
if the line comment is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the line comment is
re-registered.
addLineComment(lineComment, companion, flags, flags)
.lineComment
- the starting sequence of a line commentcompanion
- the associated informationflags
- modification flagsjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for lineCommentjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddLineComment(String)
,
addLineComment(String, Object)
,
addLineComment(String, Object, int, int)
,
removeLineComment(java.lang.String)
void addLineComment(java.lang.String lineComment, java.lang.Object companion, int flags, int flagMask) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addLineComment(String, Object, int)
having a bitmask for the flags that are explicitely specified for the block
comment property. All other flag values (states) should be taken from the
TokenizerProperty
instance or from the Tokenizer
.lineComment
- the starting sequence of a line commentcompanion
- the associated informationflags
- modification flagsflagMask
- flags that have valid values in the parameter flags
java.lang.IllegalArgumentException
- when null
or an empty string
is passed for keywordjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddLineComment(String)
,
addLineComment(String, Object)
,
addLineComment(String, Object, int)
,
removeLineComment(java.lang.String)
void removeLineComment(java.lang.String lineComment) throws java.lang.IllegalArgumentException
TokenizerProperties
instance, the method does nothing.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_REMOVED
to all registered
listeners if a line comment property is actually removed.lineComment
- the starting sequence of the line commentjava.lang.IllegalArgumentException
- when null
or an empty string
is passedaddLineComment(String)
,
addLineComment(String, Object)
,
addLineComment(String, Object, int)
java.lang.Object getLineCommentCompanion(java.lang.String lineComment) throws java.lang.IllegalArgumentException
null
.lineCommentExists(java.lang.String)
.lineComment
- the starting sequence of the line commentjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for lineCommentlineCommentExists(java.lang.String)
boolean lineCommentExists(java.lang.String lineComment)
null
strings for lineComment
by returning
false
.lineComment
- the starting sequence of the line commenttrue
if the line comment is known,
false
otherwiseTokenizerProperty getLineComment(java.lang.String lineComment) throws java.lang.IllegalArgumentException
null
if the passed lineComment
parameter cannot be mapped to a known line comment description (lineCommentExists(java.lang.String)
would return false
).lineComment
- the starting sequence of the line commentnull
java.lang.IllegalArgumentException
- when null
or an empty string
is passedlineCommentExists(java.lang.String)
java.util.Iterator getLineComments()
Iterator
of TokenizerProperty
objects. Each TokenizerProperty
object contains one starting
sequence of a line comment and its companion if it exists.TokenizerProperty
objectsvoid addBlockComment(java.lang.String start, java.lang.String end) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new block comment
TokenizerProperty
if the comment is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the comment is
re-registered.start
- the starting sequence of the block commentend
- the finishing sequence of the block commentjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for start or endjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddBlockComment(String, String, Object)
,
addBlockComment(String, String, Object, int)
,
removeBlockComment(java.lang.String)
void addBlockComment(java.lang.String start, java.lang.String end, java.lang.Object companion) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new block comment
TokenizerProperty
if the comment is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the comment is
re-registered.start
- the starting sequence of the block commentend
- the finishing sequence of the block commentcompanion
- information object associated with this block commentjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for start or endjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddBlockComment(String, String)
,
addBlockComment(String, String, Object, int)
,
removeBlockComment(java.lang.String)
void addBlockComment(java.lang.String start, java.lang.String end, java.lang.Object companion, int flags) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addBlockComment
supports a bitmask of the
Flags
to modify the general tokenizer settings (see
setParseFlags(int)
) for this special element.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new block comment
TokenizerProperty
if the comment is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the comment is
re-registered.
addBlockComment(start, end, companion, flags, flags)
.start
- the starting sequence of the block commentend
- the finishing sequence of the block commentcompanion
- information object associated with this block commentflags
- modification flagsjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for start or endjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddBlockComment(String, String)
,
addBlockComment(String, String, Object)
,
addBlockComment(String, String, Object, int, int)
,
removeBlockComment(java.lang.String)
void addBlockComment(java.lang.String start, java.lang.String end, java.lang.Object companion, int flags, int flagMask) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addBlockComment(String, String, Object, int)
having a bitmask for the flags that are explicitely specified for the block
comment property. All other flag values (states) should be taken from the
TokenizerProperty
instance or from the Tokenizer
.start
- the starting sequence of the block commentend
- the finishing sequence of the block commentcompanion
- information object associated with this block commentflags
- modification flagsflagMask
- flags that have valid values in the parameter flags
java.lang.IllegalArgumentException
- when null
or an empty string
is passed for keywordjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddBlockComment(String, String)
,
addBlockComment(String, String, Object)
,
addBlockComment(String, String, Object, int)
,
removeBlockComment(java.lang.String)
void removeBlockComment(java.lang.String start) throws java.lang.IllegalArgumentException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_REMOVED
to all registered
listeners if a block comment property is actually removed.start
- the starting sequence of the block commentjava.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.lang.Object getBlockCommentCompanion(java.lang.String start) throws java.lang.IllegalArgumentException
null
is returned.lineCommentExists(java.lang.String)
.start
- the starting sequence of the block commentjava.lang.IllegalArgumentException
- when null
or an empty string
is passedboolean blockCommentExists(java.lang.String start)
null
strings for start
by returning false
.start
- the starting sequence of the block commenttrue
if the block comment is known,
false
otherwiseTokenizerProperty getBlockComment(java.lang.String start) throws java.lang.IllegalArgumentException
null
if the passed start
parameter cannot be mapped to a known block comment description (blockCommentExists(java.lang.String)
would return false
).start
- the starting sequence of the block commentnull
java.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.util.Iterator getBlockComments()
Iterator
of TokenizerProperty
objects. Each TokenizerProperty
object contains the starting and
finishing sequence of a block comment and the companion if it exists.TokenizerProperty
objectsvoid addSpecialSequence(java.lang.String specSeq) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
>>
is the prefix of the shift operator
>>>
), always the longest possible match is returned.
Testing on special sequences takes place after whitespaces and comments are ruled
out, but before ordinary separators are tested.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new special sequence
TokenizerProperty
if the sequence is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the sequence is
re-registered.specSeq
- special sequence to registerjava.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddSpecialSequence(String, Object)
,
addSpecialSequence(String, Object, int)
,
removeSpecialSequence(java.lang.String)
void addSpecialSequence(java.lang.String specSeq, java.lang.Object companion) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
>>
is the prefix of the shift operator
>>>
), always the longest possible match is returned.
Testing on special sequences takes place after whitespaces and comments are ruled
out, but before ordinary separators are tested.
This form of addSpecialSequence
also takes an object associated with
the special sequence, called the companion.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new special sequence
TokenizerProperty
if the sequence is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the sequence is
re-registered.specSeq
- special sequence to registercompanion
- information object associated with this special sequencejava.lang.IllegalArgumentException
- when null
or an empty string
is passed for specSeqjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddSpecialSequence(String)
,
addSpecialSequence(String, Object, int)
,
removeSpecialSequence(java.lang.String)
void addSpecialSequence(java.lang.String specSeq, java.lang.Object companion, int flags) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
>>
is the prefix of the shift operator
>>>
), always the longest possible match is returned.
Testing on special sequences takes place after whitespaces and comments are ruled
out, but before ordinary separators are tested.
This form of addSpecialSequence
also takes an object associated with
the special sequence, called the companion.
addSpecialSequence
supports a bitmask of the
Flags
to modify the general tokenizer settings (see
setParseFlags(int)
) for this special element.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new special sequence
TokenizerProperty
if the sequence is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the sequence is
re-registered.
addSpecialSequence(keyword, companion, flags, flags)
.specSeq
- special sequence to registercompanion
- information object associated with this special sequenceflags
- modification flagsjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for specSeqjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddSpecialSequence(String)
,
addSpecialSequence(String, Object)
,
addSpecialSequence(String, Object, int, int)
,
removeSpecialSequence(java.lang.String)
void addSpecialSequence(java.lang.String specSeq, java.lang.Object companion, int flags, int flagMask) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addSpecialSequence(String, Object, int)
having
a bitmask for the flags that are explicitely specified for the special sequence
property. All other flag values (states) should be taken from the
TokenizerProperty
instance or from the Tokenizer
.specSeq
- special sequence to registercompanion
- information object associated with this special sequenceflags
- modification flagsflagMask
- flags that have valid values in the parameter flags
java.lang.IllegalArgumentException
- when null
or an empty string
is passed for keywordjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddSpecialSequence(String)
,
addSpecialSequence(String, Object)
,
addSpecialSequence(String, Object, int)
,
removeSpecialSequence(java.lang.String)
void removeSpecialSequence(java.lang.String specSeq) throws java.lang.IllegalArgumentException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_REMOVED
to all registered
listeners if a special sequence property is actually removed.specSeq
- sequence to removejava.lang.IllegalArgumentException
- when null
or an empty string
is passedaddSpecialSequence(String)
,
addSpecialSequence(String, Object)
,
addSpecialSequence(String, Object, int)
java.lang.Object getSpecialSequenceCompanion(java.lang.String specSeq) throws java.lang.IllegalArgumentException
null
.specSeq
- sequence to removejava.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.util.Iterator getSpecialSequences()
Iterator
of TokenizerProperty
objects. Each TokenizerProperty
object contains a special
sequence and the companion if it exists.TokenizerProperty
objectsboolean specialSequenceExists(java.lang.String specSeq)
TokenizerProperties
.
The method accepts both empty and null
strings for specSeq
by returning false
.specSeq
- sequence to checktrue
if the block comment is known,
false
otherwiseTokenizerProperty getSpecialSequence(java.lang.String specSeq) throws java.lang.IllegalArgumentException
null
if the passed specSeq
image is unknown
(specialSequenceExists(java.lang.String)
would return false
).specSeq
- sequence to findnull
java.lang.IllegalArgumentException
- when null
or an empty string
is passedvoid addKeyword(java.lang.String keyword) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
TokenizerProperties
then it is simply re-registered. If the known keyword has an associated
companion it will be removed.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new keyword
TokenizerProperty
if the keyword is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the keyword is
re-registered.keyword
- keyword to registerjava.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddKeyword(String, Object)
,
addKeyword(String, Object, int)
,
removeKeyword(java.lang.String)
void addKeyword(java.lang.String keyword, java.lang.Object companion) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
TokenizerProperties
then it is simply re-registered. If the known keyword has an associated
companion it will be replaced against the given one.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new keyword
TokenizerProperty
if the keyword is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the keyword is
re-registered.keyword
- keyword to registercompanion
- information object associated with this keywordjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for keyword
java.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddKeyword(String)
,
addKeyword(String, Object, int)
,
removeKeyword(java.lang.String)
void addKeyword(java.lang.String keyword, java.lang.Object companion, int flags) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
TokenizerProperties
then it is simply re-registered. If the known keyword has an associated
companion it will be replaced against the given one.
addKeyword
supports a bitmask of the
Flags
to modify the general tokenizer settings (see
setParseFlags(int)
) for this special element.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new keyword
TokenizerProperty
if the keyword is a new one, or of type
TokenizerPropertyEvent.PROPERTY_MODIFIED
if the keyword is
re-registered.
addKeyword(keyword, companion, flags, flags)
.keyword
- keyword to registercompanion
- information object associated with this keywordflags
- modification flagsjava.lang.IllegalArgumentException
- when null
or an empty string
is passed for keywordjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddKeyword(String)
,
addKeyword(String, Object)
,
removeKeyword(java.lang.String)
void addKeyword(java.lang.String keyword, java.lang.Object companion, int flags, int flagMask) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addKeyword(String, Object, int)
having
a bitmask for the flags that are explicitely specified for the pattern
property. All other flag values (states) should be taken from the
TokenizerProperty
instance or from the Tokenizer
.keyword
- keyword to registercompanion
- information object associated with this keywordflags
- modification flagsflagMask
- flags that have valid values in the parameter flags
java.lang.IllegalArgumentException
- when null
or an empty string
is passed for keywordjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceaddKeyword(String)
,
addKeyword(String, Object)
,
removeKeyword(java.lang.String)
void removeKeyword(java.lang.String keyword) throws java.lang.IllegalArgumentException
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_REMOVED
to all registered
listeners if a keyword property is actually removed.keyword
- keyword to removejava.lang.IllegalArgumentException
- when null
or an empty string
is passedaddKeyword(String)
,
addKeyword(String, Object)
,
addKeyword(String, Object, int)
java.lang.Object getKeywordCompanion(java.lang.String keyword) throws java.lang.IllegalArgumentException
null
.keyword
- keyword thats companion is soughtjava.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.util.Iterator getKeywords()
Iterator
of TokenizerProperty
objects. Each TokenizerProperty
object contains a keyword and
the companion if it exists.TokenizerProperty
objectsboolean keywordExists(java.lang.String keyword)
TokenizerProperties
.
The method accepts both empty and null
strings for keyword
by returning false
.keyword
- keyword to searchtrue
if the keyword is known,
false
otherwiseTokenizerProperty getKeyword(java.lang.String keyword) throws java.lang.IllegalArgumentException
null
if the passed keyword
image is unknown
(keywordExists(java.lang.String)
would return false
).keyword
- keyword to searchnull
java.lang.IllegalArgumentException
- when null
or an empty string
is passedvoid addPattern(java.lang.String pattern) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
Pattern
.
But implementations of PatternHandler
may use
other pattern syntaxes, for example the simpler syntax used for file path
matching.
Tokenizer
. On the other hand, pattern may
be used instead of string or comment descriptions (see addString(java.lang.String, java.lang.String, java.lang.String)
etc.)
or if a pattern matching would be performed after the return of a token of
type Token.NORMAL
.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new pattern TokenizerProperty
if the pattern is a new one, or of type TokenizerPropertyEvent.PROPERTY_MODIFIED
if the pattern is re-registered.pattern
- the regular expression to be addedjava.lang.IllegalArgumentException
- when null
or an empty pattern
is passedjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceremovePattern(java.lang.String)
,
addPattern(String, Object)
,
addPattern(String, Object, int)
void addPattern(java.lang.String pattern, java.lang.Object companion) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addPattern(String)
for details on pattern.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new pattern TokenizerProperty
if the pattern is a new one, or of type TokenizerPropertyEvent.PROPERTY_MODIFIED
if the pattern is re-registered.pattern
- the regular expression to be addedcompanion
- information object associated with this patternjava.lang.IllegalArgumentException
- when null
or an empty pattern
is passedjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceremovePattern(java.lang.String)
,
addPattern(String)
,
addPattern(String, Object, int)
void addPattern(java.lang.String pattern, java.lang.Object companion, int flags) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addPattern(String)
for details on pattern.
addPattern
supports a bitmask of the
Flags
to modify the general tokenizer settings (see
setParseFlags(int)
) for this special pattern.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) with the new pattern TokenizerProperty
if the pattern is a new one, or of type TokenizerPropertyEvent.PROPERTY_MODIFIED
if the pattern is re-registered.
addPattern(pattern, companion, flags, flags)
.pattern
- the regular expression to be addedcompanion
- information object associated with this keywordflags
- modification flagsjava.lang.IllegalArgumentException
- when null
or an empty pattern
is passedjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceremovePattern(java.lang.String)
,
addPattern(String)
,
addPattern(String, Object)
void addPattern(java.lang.String pattern, java.lang.Object companion, int flags, int flagMask) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
addPattern(String)
for details on pattern.
addPattern(String, Object, int)
having
a bitmask for the flags that are specified for the pattern property.
All other flag values (states) should be taken from the
TokenizerProperty
instance or from the Tokenizer
.pattern
- the regular expression to be addedcompanion
- information object associated with this keywordflags
- values for modification flagsflagMask
- flags that have valid values in the parameter flags
java.lang.IllegalArgumentException
- when null
or an empty pattern
is passedjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfaceremovePattern(java.lang.String)
,
addPattern(String)
,
addPattern(String, Object)
,
addPattern(String, Object, int)
void removePattern(java.lang.String pattern) throws java.lang.IllegalArgumentException
TokenizerProperties
instance. The method may throw an
IllegalArgumentException
if the given pattern is
null
or empty.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_REMOVED
to all registered
listeners (see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
) if a pattern is actually
removed.pattern
- the regular expression to be removedjava.lang.IllegalArgumentException
- when null
or an empty string
is passedjava.lang.Object getPatternCompanion(java.lang.String pattern) throws java.lang.IllegalArgumentException
null
will be returned.
TokenizerProperties
instance with or without a companion, use the method patternExists(java.lang.String)
instead.pattern
- the regular expression to be removednull
java.lang.IllegalArgumentException
- when null
or an emtpy pattern
is passedboolean patternExists(java.lang.String pattern)
null
strings for pattern
by returning
false
.
addString(String, String, String, Object, int)
method), since it
makes generally no sense to "overload" properties.pattern
- the regular expression to be looked fortrue
if the pattern is registered,
false
otherwiseTokenizerProperty getPattern(java.lang.String pattern) throws java.lang.IllegalArgumentException
null
if the passed pattern
parameter cannot be mapped to a known
pattern description (patternExists(java.lang.String)
would return false
).pattern
- the regular expression to be looked fornull
java.lang.IllegalArgumentException
- when null
or an emtpy pattern
is passedjava.util.Iterator getPatterns()
Iterator
of TokenizerProperty
objects. Each TokenizerProperty
object contains a pattern and
its companion if such an associated object exists.TokenizerProperty
objectsvoid addProperty(TokenizerProperty property) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
TokenizerProperty
. This can be a keyword, comment etc.,
even whitespaces, separators and property types not defined in Token
.
TokenizerProperties
instance then it is simply re-registered.
TokenizerPropertyEvent
of type TokenizerPropertyEvent.PROPERTY_ADDED
or
TokenizerPropertyEvent.PROPERTY_MODIFIED
to all registered listeners
(see addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
).
property
- property to registerjava.lang.IllegalArgumentException
- when null
, an incomplete or
otherwise unusable property is passedjava.lang.UnsupportedOperationException
- if the method is not available for an
implementation of the TokenizerProperties
interfacevoid removeProperty(TokenizerProperty property) throws java.lang.IllegalArgumentException
TokenizerProperty
from the store. If the property is
not known the method does nothing.property
- property to registerjava.lang.IllegalArgumentException
- when null
, an incomplete or
otherwise unusable property is passedjava.util.Iterator getProperties()
Iterator
of TokenizerProperty
objects.TokenizerProperty
objectsboolean propertyExists(TokenizerProperty property)
TokenizerProperty
is known to this TokenizerProperties
instance. The method compares the characteristics given in property
against all known properties.
null
for property
by returning
false
.property
- the property to searchtrue
if the property is known,
false
otherwisevoid addTokenizerPropertyListener(TokenizerPropertyListener listener)
TokenizerPropertyListener
. An implementation of
the TokenizerProperties
interface should call the approbriate
methods in the TokenizerPropertyListener
interface for all
registered listeners whenever a TokenizerProperty
is added, removed
or modified.
add...
calls like addKeyword(java.lang.String)
or addString(java.lang.String, java.lang.String, java.lang.String)
.
setWhitespaces(java.lang.String)
and setSeparators(java.lang.String)
are modifications.
remove...
calls, for instance
removeKeyword(java.lang.String)
.
null
does nothing.listener
- the new TokenizerPropertyListener
removeTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
void removeTokenizerPropertyListener(TokenizerPropertyListener listener)
TokenizerPropertyListener
instances. If the given listener is null
or unknown, nothing
is done.listener
- the TokenizerPropertyListener
to deregisteraddTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)