de.aitools.aq.invertedindex.value.pair
Class IntString

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

public class IntString
extends java.lang.Object
implements Value

Version:
$Id: IntString.java,v 1.3 2010/10/15 15:30:13 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
IntString()
           
IntString(IntString pair)
           
IntString(int e1, java.lang.String e2)
           
 
Method Summary
 int byteSize()
          Returns the serialized size of this value.
 boolean equals(java.lang.Object obj)
           
 int getE1()
           
 java.lang.String getE2()
           
 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(int e1, java.lang.String e2)
           
 void setE1(int e1)
           
 void setE2(java.lang.String e2)
           
 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

IntString

public IntString()

IntString

public IntString(int e1,
                 java.lang.String e2)
          throws Value.InvalidArgumentException
Parameters:
e1 -
e2 -
Throws:
InvalidArgumentException - if e2 is empty or contains any whitespace character.
Value.InvalidArgumentException

IntString

public IntString(IntString pair)
Method Detail

getE1

public int getE1()

getE2

public java.lang.String getE2()

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.

setE1

public void setE1(int e1)

setE2

public void setE2(java.lang.String e2)
           throws Value.InvalidArgumentException
Parameters:
e2 -
Throws:
InvalidArgumentException - if e2 is empty or contains any whitespace character.
Value.InvalidArgumentException

set

public void set(int e1,
                java.lang.String e2)
         throws Value.InvalidArgumentException
Parameters:
e1 -
e2 -
Throws:
InvalidArgumentException - if e2 is empty or contains any whitespace character.
Value.InvalidArgumentException

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