de.lmu.ifi.dbs.elki.utilities.pairs
Class Pair<FIRST,SECOND>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.pairs.Pair<FIRST,SECOND>
Type Parameters:
FIRST - first type
SECOND - second type
All Implemented Interfaces:
PairInterface<FIRST,SECOND>
Direct Known Subclasses:
CPair, FCPair, GenericDistanceResultPair, MinMax, SCPair, SpatialPair

public class Pair<FIRST,SECOND>
extends Object
implements PairInterface<FIRST,SECOND>

Generic SimplePair class. Does not implement any "special" interfaces such as Comparable, use CPair if you want comparable pairs.


Field Summary
 FIRST first
          First value in pair
 SECOND second
          Second value in pair
 
Constructor Summary
Pair(FIRST first, SECOND second)
          Initialize pair
 
Method Summary
 boolean equals(Object obj)
          Simple equals statement.
 FIRST getFirst()
          Getter for first
 SECOND getSecond()
          Getter for second element in pair
 int hashCode()
          Canonical hash function, mixing the two hash values.
static
<F,S> Pair<F,S>[]
newPairArray(int size)
          Create a new array of the given size (for generics)
 void setFirst(FIRST first)
          Setter for first
 void setSecond(SECOND second)
          Setter for second
 String toString()
          Canonical toString operator
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public FIRST first
First value in pair


second

public SECOND second
Second value in pair

Constructor Detail

Pair

public Pair(FIRST first,
            SECOND second)
Initialize pair

Parameters:
first - first parameter
second - second parameter
Method Detail

toString

public String toString()
Canonical toString operator

Overrides:
toString in class Object

getFirst

public final FIRST getFirst()
Getter for first

Specified by:
getFirst in interface PairInterface<FIRST,SECOND>
Returns:
first element in pair

setFirst

public final void setFirst(FIRST first)
Setter for first

Parameters:
first - new value for first element

getSecond

public final SECOND getSecond()
Getter for second element in pair

Specified by:
getSecond in interface PairInterface<FIRST,SECOND>
Returns:
second element in pair

setSecond

public final void setSecond(SECOND second)
Setter for second

Parameters:
second - new value for second element

newPairArray

public static final <F,S> Pair<F,S>[] newPairArray(int size)
Create a new array of the given size (for generics)

Type Parameters:
F - First class
S - Second class
Parameters:
size - array size
Returns:
empty array of the new type.

equals

public boolean equals(Object obj)
Simple equals statement. This Pair equals another Object if they are identical or if the other Object is also a Pair and the first and second element of this Pair equal the first and second element, respectively, of the other Pair.

Overrides:
equals in class Object
Parameters:
obj - Object to compare to

hashCode

public final int hashCode()
Canonical hash function, mixing the two hash values.

Overrides:
hashCode in class Object

Release 0.4.0 (2011-09-20_1324)