public class Point
extends java.lang.Object
Point is a coordinate on the character Grid.
All points must be non-negative.
This class is immutable, and therefore thread-safe.| Constructor and Description |
|---|
Point(int row,
int col)
Constructs a point.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
isAdjacent(Point p)
Determines whether the given point is adjacent to
this point.
|
java.lang.String |
toString() |
public Point(int row,
int col)
throws java.lang.IllegalArgumentException
row - - must be non-negativecol - - must be non-negativejava.lang.IllegalArgumentException - on negative inputspublic boolean isAdjacent(Point p)
p - - the point to check adjacency againstpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object