cmsc433.p3
Class Point

java.lang.Object
  extended by 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.


Field Summary
 int col
           
 int row
           
 
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
 

Field Detail

row

public final int row

col

public final int col
Constructor Detail

Point

public Point(int row,
             int col)
      throws java.lang.IllegalArgumentException
Constructs a point.

Parameters:
row - - must be non-negative
col - - must be non-negative
Throws:
java.lang.IllegalArgumentException - on negative inputs
Method Detail

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