cmsc433.p3
Class Point
java.lang.Object
cmsc433.p3.Point
public class Point
- extends java.lang.Object
A Point is a coordinate on the character Grid.
All points must be non-negative.
This class is immutable, and therefore thread-safe.
|
Constructor Summary |
Point(int row,
int col)
Constructs a point. |
|
Method Summary |
boolean |
isAdjacent(Point p)
Determines whether the given point is adjacent to
this point. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
row
public final int row
col
public final int col
Point
public Point(int row,
int col)
throws java.lang.IllegalArgumentException
- Constructs a point.
- Parameters:
row - - must be non-negativecol - - must be non-negative
- Throws:
java.lang.IllegalArgumentException - on negative inputs
isAdjacent
public boolean isAdjacent(Point p)
- Determines whether the given point is adjacent to
this point.
- Parameters:
p - - the point to check adjacency against
- Returns:
- whether this point is adjacent to p
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object