Class MutablePoint

java.lang.Object
  extended by MutablePoint

public class MutablePoint
extends java.lang.Object


Constructor Summary
MutablePoint()
          Creates a point at the origin (x=y=0).
MutablePoint(double x, double y)
          Creates a point with the given x-y coordinates.
MutablePoint(MutablePoint p)
          Copy constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determines whether two points are equal.
 double getX()
          Returns the value of x.
 double getY()
          Returns the value of y.
 void set(double x, double y)
          Sets the value of the coordinates.
 java.lang.String toString()
          Converts the point to a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutablePoint

public MutablePoint(double x,
                    double y)
Creates a point with the given x-y coordinates.

Parameters:
x - x coordinate
y - y coordinate

MutablePoint

public MutablePoint()
Creates a point at the origin (x=y=0).


MutablePoint

public MutablePoint(MutablePoint p)
Copy constructor.

Parameters:
p - MutablePoint object to be copied.
Method Detail

getX

public double getX()
Returns the value of x.

Returns:
x coordinate

getY

public double getY()
Returns the value of y.

Returns:
y coordinate

set

public void set(double x,
                double y)
Sets the value of the coordinates.

Parameters:
x - New X coordinate.
y - New Y coordinate.

toString

public java.lang.String toString()
Converts the point to a string. For example, if x=y=0, returns "[MutablePoint:x=0.0,y=0.0]".

Overrides:
toString in class java.lang.Object
Returns:
String version of the point.

equals

public boolean equals(java.lang.Object o)
Determines whether two points are equal. The points are equal if they are at the same coordinates.

Overrides:
equals in class java.lang.Object
Returns:
True if equal, false otherwise.