public interface TokenizerPropertyListener
The interface TokenizerPropertyListener
is implemented by classes
that are interested in changes in TokenizerProperties
objects. Such
changes are adding, removing and modifying of properties like keywords, special
sequences etc. or parse flags.
Usually, a Tokenizer
implementation will also implement this interface.
An example is StandardTokenizer
. With the listener design pattern,
a tokenizer can cache information for fast access that is originally held in
its associated TokenizerProperties
object, without the danger of
using out-of-date data.
The method TokenizerProperties.addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
is used to
register a listener. De-registering is done via
TokenizerProperties.removeTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
. The whole mechanism
is therefore the same as the event listener schemes used in the AWT or the
Swing packages of the JDK.
TokenizerProperties
,
Tokenizer
,
TokenizerPropertyEvent
Modifier and Type | Method and Description |
---|---|
void |
propertyChanged(TokenizerPropertyEvent event)
Event handler method.
|
void propertyChanged(TokenizerPropertyEvent event)
TokenizerPropertyEvent
parameter
contains the nessecary information about the property change. We choose
one single method in favour of various more specialized methods since the
reactions on adding, removing and modifying tokenizer properties are often
the same (flushing cash, rereading information etc.) or not very different.
TokenizerProperties
object calling its listeners should do this in
the order the listeners were registered with the
TokenizerProperties.addTokenizerPropertyListener(de.susebox.jtopas.TokenizerPropertyListener)
method.event
- the TokenizerPropertyEvent
that describes the change