CSE115
Class Position

java.lang.Object
  extended by CSE115.Position
All Implemented Interfaces:
BoardConstants

public class Position
extends Object
implements BoardConstants

Position.java Created: Fri Nov 22 12:23:16 2002

Version:
Author:
Phil Ventura

Field Summary
 
Fields inherited from interface CSE115.BoardConstants
SQUARE_SIZE
 
Constructor Summary
Position(int row, int col)
          Creates a Position object
Position(Point pt)
          Creates a Position object based on a given Point
 
Method Summary
 boolean equals(Object obj)
           
 int getCol()
          Returns the column of this position
 int getRow()
          Returns the row of this position
 int hashCode()
           
 Point toPoint()
          Coverts Position to a Point
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Position

public Position(int row,
                int col)
Creates a Position object

Parameters:
row - the index of the row, assumes counting starting at 0
col - the index of the column, assumes counting starting at 0

Position

public Position(Point pt)
Creates a Position object based on a given Point

Parameters:
pt - a Point to be translated to a row/column position
Method Detail

getRow

public int getRow()
Returns the row of this position

Returns:
the row index for this position

getCol

public int getCol()
Returns the column of this position

Returns:
the column index for this position

toString

public String toString()
Overrides:
toString in class Object

toPoint

public Point toPoint()
Coverts Position to a Point

Returns:
the Point that corresponds to this position (upper-left hand corner of bounding box)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object