|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Payload
An index payload.
The main responsibility of this class is that of providing efficient ways to read and write a payload from and to bit streams. An instance of this class has at any given time a current value, which is set when reading. and output when writing.
The current value can be modified using set(Object)
, and
each implementation must document thoroughly which objects are
accepted by this method.
It is expected that in most implementations reading and writing is much more efficient than reading, getting a value, setting that value in another instance, and finally writing.
Implementation of a payload might have parameters. If you need to know
whether two instances are compatible, in the sense that each
instance can read correctly data written by the other one, you can invoke
the compatibleWith(Payload)
method.
Optionally, implementations can feature a parse(String)
method
that returns an object of the correct type for set(Object)
. This method
can be used (for instance, by reflection) to try to build a payload from a string
specification (this is what happens in DocumentIteratorBuilderVisitor
).
Method Summary | |
---|---|
boolean |
compatibleWith(Payload payload)
Returns true if this payload instance is compatible with another instance. |
Payload |
copy()
Returns a copy of this payload. |
Object |
get()
Returns the value of this payload. |
Predicate |
rangeFilter(Payload left,
Payload right)
Returns a payload filter matching the interval defined by the given parameters. |
int |
read(InputBitStream ibs)
Sets the current value of this payload by reading from an input bit stream. |
void |
set(Object o)
Sets the current value of this payload. |
int |
write(OutputBitStream obs)
Serialises the current value of this payload to the given output bit stream. |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Method Detail |
---|
int write(OutputBitStream obs) throws IOException
obs
- the bit stream receiving the bits.
IllegalStateException
- if this serialiser contains no object.
IOException
int read(InputBitStream ibs) throws IOException
ibs
- a bit stream.
IOException
Object get()
Implementing classes are expected to override covariantly the return value to the actual class stored by the payload.
void set(Object o)
o
- the new value of this payload.Payload copy()
Implementing classes are expected to override covariantly the return value to the actual payload type.
boolean compatibleWith(Payload payload)
Predicate rangeFilter(Payload left, Payload right)
left
- the left extreme of the interval (inclusive). It will be cached (but not copied) internally.right
- the right extreme of the interval (exclusive). It will be cached (but not copied) internally.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |