anl.aida.util
Class Pair<X,Y>

java.lang.Object
  extended by anl.aida.util.Pair<X,Y>

public class Pair<X,Y>
extends java.lang.Object

A simple pair class that represents a tuple with two elements.

This class is not implemented to handle null pair values, however it will accept them.


Field Summary
private  X first
           
private  int hashCode
           
private  Y second
           
 
Constructor Summary
Pair(X first, Y second)
          Constructs this class with the specified first and second values
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this pair to another object.
 X getFirst()
          Retrieves the first element in the tuple (first, second).
 Y getSecond()
          Retrieves the second element in the tuple (first, second).
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

private X first

second

private Y second

hashCode

private int hashCode
Constructor Detail

Pair

public Pair(X first,
            Y second)
Constructs this class with the specified first and second values

Parameters:
first - the first value
second - the second value
Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares this pair to another object.

Overrides:
equals in class java.lang.Object
Returns:
if the other object is a pair with the equal first and second members

hashCode

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getFirst

public X getFirst()
Retrieves the first element in the tuple (first, second).

Returns:
the first element

getSecond

public Y getSecond()
Retrieves the second element in the tuple (first, second).

Returns:
the second element