net.sf.freecol.common.model
Class Map.Position

java.lang.Object
  extended by net.sf.freecol.common.model.Map.Position
Enclosing class:
Map

public static final class Map.Position
extends java.lang.Object

Represents a position on the Map.


Field Summary
 int x
           
 int y
           
 
Constructor Summary
Map.Position(int posX, int posY)
          Creates a new object with the given position.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares the other Position based on the coordinates.
 int getX()
          Returns the x-coordinate of this Position.
 int getY()
          Returns the y-coordinate of this Position.
 int hashCode()
          Returns a hash code value.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public final int x

y

public final int y
Constructor Detail

Map.Position

public Map.Position(int posX,
                    int posY)
Creates a new object with the given position.

Parameters:
posX - The x-coordinate for this position.
posY - The y-coordinate for this position.
Method Detail

getX

public int getX()
Returns the x-coordinate of this Position.

Returns:
The x-coordinate of this Position.

getY

public int getY()
Returns the y-coordinate of this Position.

Returns:
The y-coordinate of this Position.

equals

public boolean equals(java.lang.Object other)
Compares the other Position based on the coordinates.

Overrides:
equals in class java.lang.Object
Parameters:
other - the reference object with which to compare.
Returns:
true iff the coordinates match.

hashCode

public int hashCode()
Returns a hash code value. The current implementation (which may change at any time) works well as long as the maximum coordinates fit in 16 bits.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.