bcds.tools
Class SimplePair<T1,T2>

java.lang.Object
  extended by bcds.tools.SimplePair<T1,T2>

public class SimplePair<T1,T2>
extends java.lang.Object

SimplePair implements a two-component tuple. The components can be of arbitrary types.


Field Summary
 T1 first
          The first component.
 T2 second
          The second component.
 
Constructor Summary
SimplePair(T1 v1, T2 v2)
          Creates a new tuple with the given values.
 
Method Summary
 boolean equals(java.lang.Object b)
          Returns true if b a this tuple are instances of the same class and their respective components are also equal.
 T1 getFirst()
          Returns the tuple's first component.
 T2 getSecond()
          Returns the tuple's second component.
 int hashCode()
          Returns this tuple's hash code.
static
<T1,T2> SimplePair<T1,T2>
make(T1 v1, T2 v2)
          Convenience "factory" method.
 java.lang.String toString()
          Returns a string of the form "(v1, v2)", where v1 and v2 stand for what toString returns for the two tuple components.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public final T1 first
The first component.


second

public final T2 second
The second component.

Constructor Detail

SimplePair

public SimplePair(T1 v1,
                  T2 v2)
Creates a new tuple with the given values. The parameters are simply saved in this object.

Method Detail

make

public static <T1,T2> SimplePair<T1,T2> make(T1 v1,
                                             T2 v2)
Convenience "factory" method.


hashCode

public int hashCode()
Returns this tuple's hash code.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object b)
Returns true if b a this tuple are instances of the same class and their respective components are also equal.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns a string of the form "(v1, v2)", where v1 and v2 stand for what toString returns for the two tuple components.

Overrides:
toString in class java.lang.Object

getFirst

public T1 getFirst()
Returns the tuple's first component.


getSecond

public T2 getSecond()
Returns the tuple's second component.