|
PageMixer API - 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Abstraction of token sequence watching.
This interface separates "judgement whether you have interest in current token sequence" from "processing which you want do on them".
"Token sequence" means the part of token stream
consisting of one or more tokens
(e.g.: tokens between
StartTagToken
representing "<div>" to
EndTagToken
representing "</div>").
Even though primitive inner classes are defined, you can create your specific watcher like as below:
SequenceEditFilter
,
TokenWatcher
,
TokenEditFilter
Inner Class Summary | |
static class |
SequenceWatcher.Attr
Find sequences by attribute of token. |
static class |
SequenceWatcher.Name
Find sequences by name of token. |
static class |
SequenceWatcher.NameAttr
Find sequences by name and attribute of token. |
static class |
SequenceWatcher.NameBased
Template of name based sequence watcher. |
Method Summary | |
void |
clear()
Clear internal status to reuse itself. |
boolean |
gainsInterest(ConsumerContext context,
Token token)
Examine whether specified token is first one of interest sequence. |
boolean |
losesInterest(ConsumerContext context,
Token token)
Examine whether specified token is last one of interest sequence. |
Method Detail |
public boolean gainsInterest(ConsumerContext context, Token token)
This method is never invoked until
losesInterest()
returns true after once this returns true.
ATTENTION:
The token with which this method returns true is included by "sequence" as part of it.
context
- context to depend ontoken
- token to be examinedpublic boolean losesInterest(ConsumerContext context, Token token)
This method is not invoked before
gainsInterest()
returns true,
but invoked on the same token which causes
gainsInterest()
returning true.
You can implement watcher which returns true both
gainsInterest()
and this on the same token.
In this case, the "interest sequence" consists of only one token.
ATTENTION:
The token with which this method returns true is included by "sequence" as part of it.
context
- context to depend ontoken
- token to be examinedpublic void clear()
This is invoked at the end of token (sub)sequence
(= when associated filter is flush
ed),
or at the invocation of Filter.clear()
.
This allows you to re-use watcher instance after invocation of this method even though it is context-full.
|
PageMixer API - 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |