agentland.games.boggle
Class Coordinate
java.lang.Object
|
+--agentland.games.boggle.Coordinate
- All Implemented Interfaces:
- Serializable
- public class Coordinate
- extends Object
- implements Serializable
Represents an abstract position, as in on a playing board.
- See Also:
Serializable, Serialized Form
|
Constructor Summary |
Coordinate(int x,
int y)
Creates a new Coordinate with the provided location. |
|
Method Summary |
boolean |
equals(Object o)
Determines if the Object o represents the same abstract
position as this. |
int |
hashCode()
Good enough hash function for this kind of object. |
boolean |
nextTo(Coordinate otherCoord)
|
int |
x()
Gets the x-component of the abstract position. |
int |
y()
Gets the y-component of the abstract position. |
Coordinate
public Coordinate(int x,
int y)
- Creates a new
Coordinate with the provided location.
- Parameters:
x - x-component of thisy - y-component of this
x
public int x()
- Gets the x-component of the abstract position.
- Returns:
- x-component of this
y
public int y()
- Gets the y-component of the abstract position.
- Returns:
- y-component of this
nextTo
public boolean nextTo(Coordinate otherCoord)
equals
public boolean equals(Object o)
- Determines if the
Object o represents the same abstract
position as this. Of course, o must be a Coordinate if
in order to return true.
- Overrides:
equals in class Object
- Parameters:
o - any Object which might be compared to this- Returns:
true if o represents the same abstract position
hashCode
public int hashCode()
- Good enough hash function for this kind of object.
- Overrides:
hashCode in class Object
- Returns:
- a respectable hash value.