gshute.util
Class Pair

java.lang.Object
  |
  +--gshute.util.Pair

public class Pair
extends java.lang.Object

A gshute.util.Pair is an object with two member objects.


Field Summary
protected  java.lang.Object first
          first is the first member of this pair.
protected  java.lang.Object second
          second is the second member of this pair.
 
Constructor Summary
Pair(java.lang.Object m1, java.lang.Object m2)
          Pair(m1, m2) returns a Pair whose first member is m1 and whose second member is m2.
 
Method Summary
 boolean equals(java.lang.Object q)
          p.equals(Object q) returns true if q is a Pair and the first members of p and q are equal and the second members of p and q are equal.
 java.lang.Object getFirst()
          p.getFirst() returns the first member of p.
static java.util.Comparator getFirstComparator(java.util.Comparator cmp)
          Pair.getFirstComparator(cmp) returns an comparator that compares pairs by applying cmp to the first members.
static java.util.Comparator getLexComparator(java.util.Comparator cmp1, java.util.Comparator cmp2)
          Pair.getLexComparator(cmp1, cmp2) returns an comparator that compares pairs by applying cmp1 to the first members and using cmp2 on the second members if the first members are equal.
 java.lang.Object getSecond()
          p.getSecond() returns the second member of p.
static java.util.Comparator getSecondComparator(java.util.Comparator cmp)
          Pair.getSecondComparator(cmp) returns an comparator that compares pairs by applying cmp to the second members.
 void setFirst(java.lang.Object dat)
          p.setFirst(dat) sets the first member of p to dat.
 void setSecond(java.lang.Object dat)
          p.setSecond(dat) sets the second member of p to dat.
 java.lang.String toString()
          p.toString() returns a String describing p.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

first

protected java.lang.Object first
first is the first member of this pair.

second

protected java.lang.Object second
second is the second member of this pair.
Constructor Detail

Pair

public Pair(java.lang.Object m1,
            java.lang.Object m2)
Pair(m1, m2) returns a Pair whose first member is m1 and whose second member is m2.
Method Detail

getFirst

public java.lang.Object getFirst()
p.getFirst() returns the first member of p.

getSecond

public java.lang.Object getSecond()
p.getSecond() returns the second member of p.

setFirst

public void setFirst(java.lang.Object dat)
p.setFirst(dat) sets the first member of p to dat.

setSecond

public void setSecond(java.lang.Object dat)
p.setSecond(dat) sets the second member of p to dat.

toString

public java.lang.String toString()
p.toString() returns a String describing p. This String is formed as p.getFirst().toString() + "\t" + p.getSecond().toString().
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object q)
p.equals(Object q) returns true if q is a Pair and the first members of p and q are equal and the second members of p and q are equal.
Overrides:
equals in class java.lang.Object

getFirstComparator

public static java.util.Comparator getFirstComparator(java.util.Comparator cmp)
Pair.getFirstComparator(cmp) returns an comparator that compares pairs by applying cmp to the first members.

getSecondComparator

public static java.util.Comparator getSecondComparator(java.util.Comparator cmp)
Pair.getSecondComparator(cmp) returns an comparator that compares pairs by applying cmp to the second members.

getLexComparator

public static java.util.Comparator getLexComparator(java.util.Comparator cmp1,
                                                    java.util.Comparator cmp2)
Pair.getLexComparator(cmp1, cmp2) returns an comparator that compares pairs by applying cmp1 to the first members and using cmp2 on the second members if the first members are equal.