Class OPair<A extends java.lang.Comparable<A>,B extends java.lang.Comparable<B>>
java.lang.Object
Pair<A,B>
OPair<A,B>
- Type Parameters:
A
- The type of the first value.B
- The type of the second value.
- All Implemented Interfaces:
- java.lang.Comparable<OPair<A,B>>
public class OPair<A extends java.lang.Comparable<A>,B extends java.lang.Comparable<B>>
- extends Pair<A,B>
- implements java.lang.Comparable<OPair<A,B>>
An ordered pair is a pair which is ordered lexicographically.
- Author:
- Rossmanith
Constructor Summary |
OPair(A a,
B b)
Create a new pair with first value a and second value b |
Method Summary |
int |
compareTo(OPair<A,B> p)
Compares this pair with another pair p. |
boolean |
equals(java.lang.Object o)
Equality is defined pairwise, i.e. |
int |
hashCode()
|
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
OPair
public OPair(A a,
B b)
- Create a new pair with first value a and second value b
- Parameters:
a
- The first valueb
- The second value
equals
public boolean equals(java.lang.Object o)
- Equality is defined pairwise, i.e. [a1,b1] = [a2,b2] iff
a1 = a2 and b1 = b2. Note that o must be an ordered pair.
- Overrides:
equals
in class java.lang.Object
- Parameters:
o
- The object to compare with this.
compareTo
public int compareTo(OPair<A,B> p)
- Compares this pair with another pair p. Here
[a1,b1] is smaller/greater than [a2,b2] iff
a1 is smaller/greater than a2 or, if a1 = a2 then
b1 is smaller/greater than b2
- Specified by:
compareTo
in interface java.lang.Comparable<OPair<A extends java.lang.Comparable<A>,B extends java.lang.Comparable<B>>>
- Parameters:
p
- t
- Returns:
- a negative number, if this < p,
0, if this = p,
and a positive number, if this > p (confere the contract of
Comparable
) - See Also:
Comparable
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object