All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class rebelsky.util.Point

java.lang.Object
   |
   +----rebelsky.util.Point

public class Point
extends Object
implements Cloneable
A point on the discrete cartesian plane. Or, simply, a pair of integers. These points are intentionally made non-modifiable.

Copyright (c) 1998 Samuel A. Rebelsky. All rights reserved.

Version:
1.0 of February 1998
Author:
Samuel A. Rebelsky

Constructor Index

o Point(int, int)
Create the point (x,y).

Method Index

o clone()
Make a copy of the current point.
o distance()
Get the distance of the point from the origin.
o equals(Object)
Determine if another object is equal to this point.
o equals(Point)
Determine if another point is equal to this point.
o hashVal()
Compute a hash value for this point.
o horiz()
Get the horizontal distance of the point from the origin.
o toString()
Convert this point to a string.
o vert()
Get the vertical distance of the point from the origin.

Constructors

o Point
 public Point(int x,
              int y)
Create the point (x,y).

Methods

o distance
 public double distance()
Get the distance of the point from the origin.
pre: (none)
post: (none)

Returns:
the distance of the point from the origin
o horiz
 public int horiz()
Get the horizontal distance of the point from the origin.
pre: (none)
post: (none)

Returns:
the x value of the point
o vert
 public int vert()
Get the vertical distance of the point from the origin.
pre: (none)
post: (none)

Returns:
the y value of the point
o clone
 public Object clone()
Make a copy of the current point.
pre: (none)
post: (none)

Overrides:
clone in class Object
o equals
 public boolean equals(Object other)
Determine if another object is equal to this point.
pre: (none)
post: (none)

Returns:
true if the other object is a point and that point is equal to this point; false otherwise
Overrides:
equals in class Object
o equals
 public boolean equals(Point other)
Determine if another point is equal to this point.
pre: (none)
post: (none)

Returns:
true if the two points are the same and false otherwise
o hashVal
 public int hashVal()
Compute a hash value for this point.
pre: (none)
post: (none)

Returns:
an appropriate value
o toString
 public String toString()
Convert this point to a string.
pre: (none)
post: (none)

Returns:
a string of the form (x,y)
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index