org.rubato.util
Class Pair<A extends java.lang.Comparable<A>,B extends java.lang.Comparable<B>>

java.lang.Object
  extended by org.rubato.util.Pair<A,B>
All Implemented Interfaces:
java.lang.Comparable<Pair<A,B>>

public class Pair<A extends java.lang.Comparable<A>,B extends java.lang.Comparable<B>>
extends java.lang.Object
implements java.lang.Comparable<Pair<A,B>>

This is a generic pair class, where the first and second coordinate classes are specified using template arguments.

Author:
Gérard Milmeister

Field Summary
 A first
          First component
 B second
          Second component
 
Constructor Summary
Pair()
          Creates a pair with first and second coordinates set to null.
 
Method Summary
 int compareTo(Pair<A,B> pair)
          The comparison of triples is according to lexicographical order.
 Pair<A,B> copy()
           
 boolean equals(java.lang.Object obj)
          Two pairs are equal if their respective components are equal.
 int hashCode()
           
static
<A extends java.lang.Comparable<A>,B extends java.lang.Comparable<B>>
Pair<A,B>
makePair(A a, B b)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public A extends java.lang.Comparable<A> first
First component


second

public B extends java.lang.Comparable<B> second
Second component

Constructor Detail

Pair

public Pair()
Creates a pair with first and second coordinates set to null.

Method Detail

equals

public boolean equals(java.lang.Object obj)
Two pairs are equal if their respective components are equal.

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(Pair<A,B> pair)
The comparison of triples is according to lexicographical order.

Specified by:
compareTo in interface java.lang.Comparable<Pair<A extends java.lang.Comparable<A>,B extends java.lang.Comparable<B>>>

copy

public Pair<A,B> copy()

toString

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

hashCode

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

makePair

public static <A extends java.lang.Comparable<A>,B extends java.lang.Comparable<B>> Pair<A,B> makePair(A a,
                                                                                                       B b)