it.unimi.di.mg4j.index.payload
Class DatePayload

java.lang.Object
  extended by it.unimi.di.mg4j.index.payload.AbstractPayload
      extended by it.unimi.di.mg4j.index.payload.DatePayload
All Implemented Interfaces:
Payload, Serializable, Comparable<Payload>

public class DatePayload
extends AbstractPayload

A payload containing a date expressed as seconds from the Epoch and stored using δ coding.

Note that since the date is stored in seconds, it is possible that setting a current value and getting it back does not given an equal Date object.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class it.unimi.di.mg4j.index.payload.AbstractPayload
AbstractPayload.ComparatorPayloadPredicate
 
Field Summary
protected  long secondsFromEpoch
           
 
Constructor Summary
DatePayload()
           
 
Method Summary
 int compareTo(Payload o)
           
 boolean compatibleWith(Payload payload)
          Returns true if this payload instance is compatible with another instance.
 DatePayload copy()
          Returns a copy of this payload.
 boolean equals(Payload o)
           
 Date get()
          Returns the value of this payload.
 int hashCode()
           
 Date parse(String spec)
           
 int read(InputBitStream ibs)
          Sets the current value of this payload by reading from an input bit stream.
 void set(Object date)
          Sets the current value of this payload.
 String toString()
           
 int write(OutputBitStream obs)
          Serialises the current value of this payload to the given output bit stream.
 
Methods inherited from class it.unimi.di.mg4j.index.payload.AbstractPayload
rangeFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

secondsFromEpoch

protected long secondsFromEpoch
Constructor Detail

DatePayload

public DatePayload()
Method Detail

get

public Date get()
Description copied from interface: Payload
Returns the value of this payload.

Implementing classes are expected to override covariantly the return value to the actual class stored by the payload.

Returns:
the current value of this payload.

set

public void set(Object date)
Description copied from interface: Payload
Sets the current value of this payload.

Parameters:
date - the new value of this payload.

read

public int read(InputBitStream ibs)
         throws IOException
Description copied from interface: Payload
Sets the current value of this payload by reading from an input bit stream.

Parameters:
ibs - a bit stream.
Returns:
the number of bits read.
Throws:
IOException

write

public int write(OutputBitStream obs)
          throws IOException
Description copied from interface: Payload
Serialises the current value of this payload to the given output bit stream.

Parameters:
obs - the bit stream receiving the bits.
Returns:
the number of bits written.
Throws:
IOException

copy

public DatePayload copy()
Description copied from interface: Payload
Returns a copy of this payload.

Implementing classes are expected to override covariantly the return value to the actual payload type.

Returns:
a copy of this payload.

toString

public String toString()
Overrides:
toString in class Object

compatibleWith

public boolean compatibleWith(Payload payload)
Description copied from interface: Payload
Returns true if this payload instance is compatible with another instance.

Returns:
true if this payload instance is compatible with another instance.

compareTo

public int compareTo(Payload o)

equals

public boolean equals(Payload o)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

parse

public Date parse(String spec)
           throws ParseException
Throws:
ParseException