PageMixer API - 3.1

jp.ne.dti.lares.foozy.pagemixer.mixer
Interface Producer

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
FixedProducer, MutableProducer

public interface Producer
extends java.io.Serializable

Producer of token sequence.

This provides abstraction of token sequence producer. You can separate implementation of token sequence generation from token providing mechanism.

ATTENTION:

Implementation class should be "Serializable" because it may be stored for later use.


Inner Class Summary
static interface Producer.Factory
          Factory interface to create "Producer".
 
Method Summary
 void produce(ConsumerContext context, Consumer consumer)
          Produce token sequence.
 void resolve(SymbolSet symbolSet)
          Resolve symbol of containing tokens.
 

Method Detail

produce

public void produce(ConsumerContext context,
                    Consumer consumer)
             throws java.io.IOException
Produce token sequence.

Produce token sequence, and provide it to specified consumer.

For Consumer re-use, implementation classes should invoke Consumer.flush(ConsumerContext) at the end of successfully token sequence consuming. Otherwise(e.g.: exception raising), implementation should invoke Consumer.clear().

For performance efficiency, only one of those should be invoked.

Parameters:
context - context processing depends on
consumer - consumer to provide token sequence to
Throws:
java.io.IOException - if MixingIOException is caught

resolve

public void resolve(SymbolSet symbolSet)
Resolve symbol of containing tokens.

Symbol of name may not be unified in some situations (e.g.: after objec deserialization). It causes comparation mistakes, because one of Symbol implementations uses pointer comparation to examine string equalitiy.

This method gives tokens the chance to unify Symbol by resolving with specified SymbolSet (= invoking SymbolSet.lookup(Symbol))

Parameters:
symbolSet - set to resolve with

PageMixer API - 3.1