/**
 * An ordered pair of objects.
 *
 * @author Jim Glenn
 * @version 0.1 8/8/2003
 */

public class Pair
{
    /**
     * The two objects in this pair.
     */

    Object x, y;

    /**
     * Constructs the given ordered pair.
     *
     * @param first the first component of the new pair     
     * @param second the second component of the new pair
     */

    public Pair(Object first, Object second)
    {
	x = first;
	y = second;
    }

    /**
     * Returns the first component of this pair.
     *
     * @return the first component of this pair
     */

    public Object getFirst()
    {
	return x;
    }

    /**
     * Returns the second component of this pair.
     *
     * @return the second component of this pair
     */

    public Object getSecond()
    {
	return y;
    }

    /**
     * Sets the first component of this pair to the given value.
     *
     * @param obj the new first component
     */

    public void setFirst(Object obj)
    {
	x = obj;
    }

    /**
     * Sets the second component of this pair to the given value.
     *
     * @param obj the new second component
     */

    public void setSecond(Object obj)
    {
	y = obj;
    }

    /**
     * Returns a printable representation of this pair.
     *
     * @return a printable representation of this pair
     */

    public String toString()
    {
	return "(" + x + ", " + y + ")";
    }
}


