com.cometway.util
Class Pair

java.lang.Object
  extended by com.cometway.util.Pair
Direct Known Subclasses:
IntegerPair

public class Pair
extends java.lang.Object

This class implements a tuple. Pairs keep related objects together. Pairs are essentially nodes of a b-tree. N-tuples can be implemented by an unbalanced b-tree.


Constructor Summary
Pair()
           
Pair(java.lang.Object theFirst, java.lang.Object theSecond)
          This constructor sets the first and second objects with the parameters.
 
Method Summary
 java.lang.Object first()
          Returns the first object in the pair
static java.lang.String makeString(Pair thePair)
          tries to construct the pair (first and second) from a string
 java.lang.Object second()
          Returns the second object in the pair
 void setFirst(java.lang.Object theObject)
          Sets the first object of the pair
 void setSecond(java.lang.Object theObject)
          Sets the second object of the pair
 java.lang.String toString()
          overrides Object.toString(), prints: (first,second)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair()

Pair

public Pair(java.lang.Object theFirst,
            java.lang.Object theSecond)
This constructor sets the first and second objects with the parameters.

Method Detail

first

public java.lang.Object first()
Returns the first object in the pair


second

public java.lang.Object second()
Returns the second object in the pair


setFirst

public void setFirst(java.lang.Object theObject)
Sets the first object of the pair


setSecond

public void setSecond(java.lang.Object theObject)
Sets the second object of the pair


toString

public java.lang.String toString()
overrides Object.toString(), prints: (first,second)

Overrides:
toString in class java.lang.Object

makeString

public static java.lang.String makeString(Pair thePair)
tries to construct the pair (first and second) from a string