/**
   A class of ordered pairs of objects having the same data type.
   
   @author Frank M. Carrano
   @version 4.0
*/
public class OrderedPair<T> implements Pairable<T>
{
  private T first, second;
  
  public OrderedPair()
  {
  } // end default constructor
  
   public OrderedPair(T firstItem, T secondItem)
   { 
      first = firstItem;
      second = secondItem;
   } // end constructor
   
   /** Returns the first object in this pair. */
   public T getFirst()
   {
      return first;
   } // end getFirst
   
   /** Returns the second object in this pair. */
   public T getSecond()
   {
      return second;
   } // end getSecond
   
   /** Returns a string representation of this pair. */
   public String toString()
   {
      return "(" + first + ", " + second + ")";
   } // end toString
   
   /** Interchanges the objects in this pair. */
   public void changeOrder()
   {
      T temp = first;
      first = second;
      second = temp;
   } // changeOrder
} // end OrderedPair