org.apache.hadoop.examples
Class SecondarySort.IntPair

java.lang.Object
  extended by org.apache.hadoop.examples.SecondarySort.IntPair
All Implemented Interfaces:
Comparable<SecondarySort.IntPair>, Writable, WritableComparable<SecondarySort.IntPair>
Enclosing class:
SecondarySort

public static class SecondarySort.IntPair
extends Object
implements WritableComparable<SecondarySort.IntPair>

Define a pair of integers that are writable. They are serialized in a byte comparable format.


Nested Class Summary
static class SecondarySort.IntPair.Comparator
          A Comparator that compares serialized IntPair.
 
Constructor Summary
SecondarySort.IntPair()
           
 
Method Summary
 int compareTo(SecondarySort.IntPair o)
           
 boolean equals(Object right)
           
 int getFirst()
           
 int getSecond()
           
 int hashCode()
           
 void readFields(DataInput in)
          Read the two integers.
 void set(int left, int right)
          Set the left and right values.
 void write(DataOutput out)
          Serialize the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecondarySort.IntPair

public SecondarySort.IntPair()
Method Detail

set

public void set(int left,
                int right)
Set the left and right values.


getFirst

public int getFirst()

getSecond

public int getSecond()

readFields

public void readFields(DataInput in)
                throws IOException
Read the two integers. Encoded as: MIN_VALUE -> 0, 0 -> -MIN_VALUE, MAX_VALUE-> -1

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Description copied from interface: Writable
Serialize the fields of this object to out.

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object right)
Overrides:
equals in class Object

compareTo

public int compareTo(SecondarySort.IntPair o)
Specified by:
compareTo in interface Comparable<SecondarySort.IntPair>


Copyright © 2009 The Apache Software Foundation