|
PageMixer API - 3.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jp.ne.dti.lares.foozy.pagemixer.mixer.Filter
|
+--jp.ne.dti.lares.foozy.pagemixer.mixer.SequenceEditFilter
|
+--jp.ne.dti.lares.foozy.pagemixer.mixer.SequenceTrimFilter
Abstraction of filter trimming token sequence.
This provieds control flow of sequence trimming.
If you want trim inside of or whole sequence,
you can create specific filter
by concretizing
shouldTrim(ConsumerContext) method
of SequenceTrimFilter.Inside or
SequenceTrimFilter.Whole derived class.
It must return true when you want trim given sequence,
and to decide return value, it may examine execution context.
If you want trim in your specific manner
(e.g.: trim only first or last token of sequence, and so on),
you should define SequenceTrimFilter.Strategy
implement class and
make getStrategy(boolean) returning its instance
when sequence should be trimmed.
You must concretize below method(s) to have this function.
| Inner Class Summary | |
static class |
SequenceTrimFilter.Inside
Trimming inside of sequence. |
protected static interface |
SequenceTrimFilter.Strategy
Strategy to handle tokens of sequence. |
static class |
SequenceTrimFilter.Whole
Trimming whole sequence. |
| Inner classes inherited from class jp.ne.dti.lares.foozy.pagemixer.mixer.Filter |
Filter.Factory |
| Field Summary | |
protected SequenceTrimFilter.Strategy |
DEFAULT
Strategy to pass tokens through. |
| Constructor Summary | |
SequenceTrimFilter(SequenceWatcher watcher)
Create sequence trimming filter. |
|
| Method Summary | |
protected void |
beforeFirst(ConsumerContext context)
Decide handling strategy for current processing. |
protected abstract SequenceTrimFilter.Strategy |
getStrategy(boolean trim)
Get strategy to handle tokens. |
protected void |
onFirst(ConsumerContext context,
Token token,
boolean empty)
Delegate processing of first token to strategy. |
protected void |
onInside(ConsumerContext context,
Token token)
Delegate processing of inside token to strategy. |
protected void |
onLast(ConsumerContext context,
Token token,
boolean empty)
Delegate processing of last token to strategy. |
protected abstract boolean |
shouldTrim(ConsumerContext context)
Examine which current sequence is interesting one or not. |
| Methods inherited from class jp.ne.dti.lares.foozy.pagemixer.mixer.SequenceEditFilter |
afterLast, consume, flush |
| Methods inherited from class jp.ne.dti.lares.foozy.pagemixer.mixer.Filter |
addCleanup, clear, connectTo, getConsumer |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final SequenceTrimFilter.Strategy DEFAULT
| Constructor Detail |
public SequenceTrimFilter(SequenceWatcher watcher)
watcher - watcher to identify target sub sequence.| Method Detail |
protected abstract boolean shouldTrim(ConsumerContext context)
This method allow you to judge whether current sequence should be trimmed or not at execution time.
This method is invoked only once per one sequence,
and result of it is passed to getStrategy(boolean).
context - context to depend onprotected abstract SequenceTrimFilter.Strategy getStrategy(boolean trim)
This method is invoked only once per one sequence, and result of it is used to handle tokens of sequence.
So SequenceTrimFilter.Strategy reduces
overhead of judgement what filter should do.
trim - whether current sequence should be trimmed or notprotected void beforeFirst(ConsumerContext context)
beforeFirst in class SequenceEditFiltercontext - conetxt to depend on
protected void onFirst(ConsumerContext context,
Token token,
boolean empty)
onFirst in class SequenceEditFiltercontext - conetxt to depend ontoken - token to be processedempty - whether sequence has only one token or not
protected void onInside(ConsumerContext context,
Token token)
onInside in class SequenceEditFiltercontext - conetxt to depend ontoken - token to be processed
protected void onLast(ConsumerContext context,
Token token,
boolean empty)
onLast in class SequenceEditFiltercontext - conetxt to depend ontoken - token to be processedempty - whether sequence has only one token or not
|
PageMixer API - 3.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||