Aquarium Lab Series

Class AquaPoint

java.lang.Object
  |
  +--java.awt.geom.Point2D
        |
        +--java.awt.Point
              |
              +--AquaPoint
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class AquaPoint
extends java.awt.Point

Aquarium Lab Series: An AquaPoint object represents the x and y coordinates of a location in an aquarium.

Version:
10 July 2002
See Also:
Serialized Form

Inner classes inherited from class java.awt.geom.Point2D
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float
 
Fields inherited from class java.awt.Point
x, y
 
Constructor Summary
AquaPoint(int xCoord, int yCoord)
          Constructs an AquaPoint object.
 
Method Summary
 void moveLeft(int distance)
          Moves this point distance units to the left.
 void moveRight(int distance)
          Moves this point distance units to the right.
 void rise(int distance)
          Moves this point distance units up.
 void sink(int distance)
          Moves this point distance units down.
 java.lang.String toString()
          Represents this point as a string.
 int xCoord()
          Returns the x coordinate of this point.
 int yCoord()
          Returns the y coordinate of this point.
 
Methods inherited from class java.awt.Point
equals, getLocation, getX, getY, move, setLocation, setLocation, setLocation, translate
 
Methods inherited from class java.awt.geom.Point2D
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AquaPoint

public AquaPoint(int xCoord,
                 int yCoord)
Constructs an AquaPoint object.
Parameters:
xCoord - point's x coordinate
yCoord - point's y coordinate
Method Detail

xCoord

public int xCoord()
Returns the x coordinate of this point.
Returns:
x coordinate of this point

yCoord

public int yCoord()
Returns the y coordinate of this point.
Returns:
y coordinate of this point

moveRight

public void moveRight(int distance)
Moves this point distance units to the right.
Parameters:
distance - distance to move right

moveLeft

public void moveLeft(int distance)
Moves this point distance units to the left.
Parameters:
distance - distance to move left

rise

public void rise(int distance)
Moves this point distance units up.
Parameters:
distance - distance to move up

sink

public void sink(int distance)
Moves this point distance units down.
Parameters:
distance - distance to move down

toString

public java.lang.String toString()
Represents this point as a string.
Overrides:
toString in class java.awt.Point
Returns:
a string indicating the x and y coordinates of the point in (x, y) format

Aquarium Lab Series

Copyright© 2002 Alyce Brady