edu.umd.cloud9.io.pair
Class PairOfWritables<L extends Writable,R extends Writable>

java.lang.Object
  extended by edu.umd.cloud9.io.pair.PairOfWritables<L,R>
All Implemented Interfaces:
Writable

public class PairOfWritables<L extends Writable,R extends Writable>
extends Object
implements Writable

Class representing pair of Writables.


Constructor Summary
PairOfWritables()
          Creates a new PairOfWritables.
PairOfWritables(L left, R right)
          Creates a new PairOfWritables.
 
Method Summary
 L getKey()
          Returns the key (left element).
 L getLeftElement()
          Returns the left element.
 R getRightElement()
          Returns the right element.
 R getValue()
          Returns the value (right element).
 void readFields(DataInput in)
          Deserializes the pair.
 void set(L left, R right)
          Sets the right and left elements of this pair.
 String toString()
          Generates human-readable String representation of this pair.
 void write(DataOutput out)
          Serializes this pair.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PairOfWritables

public PairOfWritables()
Creates a new PairOfWritables.


PairOfWritables

public PairOfWritables(L left,
                       R right)
Creates a new PairOfWritables.

Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Deserializes the pair.

Specified by:
readFields in interface Writable
Parameters:
in - source for raw byte representation
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Serializes this pair.

Specified by:
write in interface Writable
Parameters:
out - where to write the raw byte representation
Throws:
IOException

getLeftElement

public L getLeftElement()
Returns the left element.

Returns:
the left element

getRightElement

public R getRightElement()
Returns the right element.

Returns:
the right element

getKey

public L getKey()
Returns the key (left element).

Returns:
the key

getValue

public R getValue()
Returns the value (right element).

Returns:
the value

set

public void set(L left,
                R right)
Sets the right and left elements of this pair.

Parameters:
left - the left element
right - the right element

toString

public String toString()
Generates human-readable String representation of this pair.

Overrides:
toString in class Object
Returns:
human-readable String representation of this pair