de.aitools.aq.invertedindex.value.single
Class SingleShort

java.lang.Object
  extended by de.aitools.aq.invertedindex.value.single.SingleShort
All Implemented Interfaces:
Value

public class SingleShort
extends java.lang.Object
implements Value

Version:
$Id: SingleShort.java,v 1.3 2010/10/15 15:30:11 trenkman Exp $
Author:
martin.trenkmann@uni-weimar.de

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.aitools.aq.invertedindex.value.Value
Value.Check, Value.InvalidArgumentException
 
Field Summary
 
Fields inherited from interface de.aitools.aq.invertedindex.value.Value
SEPARATOR
 
Constructor Summary
SingleShort()
           
SingleShort(short element)
           
SingleShort(SingleShort single)
           
 
Method Summary
 int byteSize()
          Returns the serialized size of this value.
 boolean equals(java.lang.Object obj)
           
 short get()
           
 int hashCode()
           
 TokenStream parseFrom(TokenStream in)
          Parses all elements from a TokenStream.
 java.io.PrintStream printTo(java.io.PrintStream out)
          Prints all elements to a .
 java.io.PrintWriter printTo(java.io.PrintWriter out)
          Prints all elements to a .
 void set(short element)
           
 void toBytes(java.nio.ByteBuffer buffer)
          Serializes all elements into a ByteBuffer.
 void wrap(java.nio.ByteBuffer buffer)
          Deserializes the value from a ByteBuffer.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleShort

public SingleShort()

SingleShort

public SingleShort(short element)

SingleShort

public SingleShort(SingleShort single)
Method Detail

get

public short get()

parseFrom

public TokenStream parseFrom(TokenStream in)
                      throws java.io.IOException
Description copied from interface: Value
Parses all elements from a TokenStream.

Specified by:
parseFrom in interface Value
Parameters:
in - the token stream to read the value from.
Returns:
the given token stream.
Throws:
java.io.IOException

printTo

public java.io.PrintWriter printTo(java.io.PrintWriter out)
Description copied from interface: Value
Prints all elements to a . The content printed to the writer is equivalent to the string returned by #toString(), but for serialization purposes this method is much faster since no temporal variables are needed.

Specified by:
printTo in interface Value
Parameters:
out - the print writer to write the value to.
Returns:
the given print writer.

printTo

public java.io.PrintStream printTo(java.io.PrintStream out)
Description copied from interface: Value
Prints all elements to a . The content printed to the stream is equivalent to the string returned by #toString(), but for serialization purposes this method is much faster since no temporal variables are needed.

Specified by:
printTo in interface Value
Parameters:
out - the print stream to write the value to.
Returns:
the given print stream.

set

public void set(short element)

byteSize

public int byteSize()
Description copied from interface: Value
Returns the serialized size of this value. The return value must be equivalent to the number of bytes written to the ByteBuffer when calling Value.toBytes(ByteBuffer).

Specified by:
byteSize in interface Value
Returns:
the serialized value size in byte.
See Also:
Value.wrap(ByteBuffer), Value.toBytes(ByteBuffer)

toBytes

public void toBytes(java.nio.ByteBuffer buffer)
Description copied from interface: Value
Serializes all elements into a ByteBuffer. Note that the given buffer has the correct ByteOrder, which is by default, but has to be ByteOrder.LITTLE_ENDIAN on Intel machines because of JNI. TODO check automatic buffer resizing if possible ... otherwise there has to be a precondition: buffer.capacity() >= size()

Specified by:
toBytes in interface Value
Parameters:
buffer - a byte buffer to serialize the value to.
See Also:
Value.wrap(ByteBuffer)

wrap

public void wrap(java.nio.ByteBuffer buffer)
Description copied from interface: Value
Deserializes the value from a ByteBuffer. All elements of this value are read from the current get position.

Specified by:
wrap in interface Value
Parameters:
buffer - a byte buffer that contains all elements of this value.
See Also:
Value.toBytes(ByteBuffer)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object