edu.colorado.cs.ns2.graphics
Class CoordinatePair

java.lang.Object
  extended by edu.colorado.cs.ns2.graphics.CoordinatePair
All Implemented Interfaces:
java.io.Serializable

public class CoordinatePair
extends java.lang.Object
implements java.io.Serializable

This class stores a pair of coordinate pairs as two Points. @see Point

Author:
Kevin Bauer, Pushkar Sambhoos.
See Also:
Serialized Form

Field Summary
private  java.awt.Point c1
          Point (x1, y1).
private  java.awt.Point c2
          Point (x2, y2).
private static long serialVersionUID
          Generated serial version UID.
 
Constructor Summary
CoordinatePair()
          Default constructor.
CoordinatePair(java.awt.Point p)
          One-argument constructor sets Point 1 (x1, y1).
CoordinatePair(java.awt.Point p1, java.awt.Point p2)
          Two-argument constructor sets both Points 1 and 2 ((x1, y2), (x2, y2)).
 
Method Summary
 int getX1()
          Get x-coordinate of first Point.
 int getX2()
          Get x-coordinate of second Point.
 int getY1()
          Get y-coordinate of first Point.
 int getY2()
          Get y-coordinate of second Point.
 void setCoordinates(java.awt.Point p, int point)
          Sets the Coordinates of any of the Points in the Coordinate Pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Generated serial version UID.

See Also:
Constant Field Values

c1

private java.awt.Point c1
Point (x1, y1).


c2

private java.awt.Point c2
Point (x2, y2).

Constructor Detail

CoordinatePair

public CoordinatePair()
Default constructor.


CoordinatePair

public CoordinatePair(java.awt.Point p)
One-argument constructor sets Point 1 (x1, y1).

Parameters:
p - A new Point.

CoordinatePair

public CoordinatePair(java.awt.Point p1,
                      java.awt.Point p2)
Two-argument constructor sets both Points 1 and 2 ((x1, y2), (x2, y2)).

Parameters:
p1 - A new Point 1.
p2 - A new Point 2.
Method Detail

getX1

public int getX1()
Get x-coordinate of first Point.

Returns:
First Point's x coordinate.

getX2

public int getX2()
Get x-coordinate of second Point.

Returns:
Second Point's x coordinate.

getY1

public int getY1()
Get y-coordinate of first Point.

Returns:
First Point's y coordinate.

getY2

public int getY2()
Get y-coordinate of second Point.

Returns:
Second Point's y-coordinate.

setCoordinates

public void setCoordinates(java.awt.Point p,
                           int point)
Sets the Coordinates of any of the Points in the Coordinate Pair.

Parameters:
p - - Point Object
point - - Select the point (1 or 2)