pzapplet
Class Coord

java.lang.Object
  extended bypzapplet.Coord

public class Coord
extends java.lang.Object

This class represents a coordinate in a cartesian plane. The coordinate has an x value and y value, which is normally written as (x, y). This class provides a method for finding if Coord's are within a specified range of each other and finding the reflected point over the X axis.

Author:
Brian Williams

Constructor Summary
Coord(int x, int y)
           
 
Method Summary
 boolean equals(Coord arg)
           
 Coord getOpp(int height)
           
 int getX()
           
 int getY()
           
 java.lang.String toString()
           
 boolean withinRangeOf(Coord arg, int range)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Coord

public Coord(int x,
             int y)
Parameters:
x - - x value of the new Coord
y - - y value of the new Coord Creates a Coord object that represents a coordinate in a cartesian plane (x, y).
Method Detail

getX

public int getX()
Returns:
int x - The x value of this

getY

public int getY()
Returns:
int y - The y value of this

withinRangeOf

public boolean withinRangeOf(Coord arg,
                             int range)
Parameters:
arg - - The coord to compare to this
range - - The distance allowed between the two Coords
Returns:
true if the x and y values of each Coord are independently within the value of range

equals

public boolean equals(Coord arg)
Parameters:
arg - - the Coord to compare to this
Returns:
true if the two Coord's refer to the same point

getOpp

public Coord getOpp(int height)
Parameters:
height - - the offset from the measurement of the x-axis to the 0 of the drawing plane.
Returns:
a new Coord that has the same x value, but a y-value that is the opposite of this

toString

public java.lang.String toString()