com.empireclassic.Remote
Class IslandCoord
java.lang.Object
java.awt.geom.Point2D
java.awt.Point
com.empireclassic.Remote.IslandCoord
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
public class IslandCoord
- extends java.awt.Point
- implements java.lang.Comparable
This class is an abstraction of the standard Empire x,y coordinate.
- Author:
- chas
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class java.awt.geom.Point2D |
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float |
Fields inherited from class java.awt.Point |
x, y |
Method Summary |
int |
compareTo(java.lang.Object obj)
This is provided so that IslandCoord can be used
as the key for a map or list and it will sort correctly. |
static IslandCoord |
parseCoord(java.lang.String toParse)
Parse a string for an island coordinate |
java.lang.String |
toString()
Provide pretty print output in the form "x,y" |
Methods inherited from class java.awt.Point |
equals, getLocation, getX, getY, move, setLocation, setLocation, setLocation, translate |
Methods inherited from class java.awt.geom.Point2D |
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
IslandCoord
public IslandCoord(int x,
int y)
- Construct an
IslandCoord
from an x and a y.
- Parameters:
x
- The x coordinatey
- The y coordinate
IslandCoord
public IslandCoord(IslandCoord coord)
- Construct new coord from existing one
- Parameters:
coord
- coord to copy
toString
public java.lang.String toString()
- Provide pretty print output in the form "x,y"
- Overrides:
toString
in class java.awt.Point
parseCoord
public static IslandCoord parseCoord(java.lang.String toParse)
- Parse a string for an island coordinate
- Parameters:
toParse
- The string to parse
- Returns:
- an
IslandCoord
or null
if it won't
parse correctly
compareTo
public int compareTo(java.lang.Object obj)
- This is provided so that
IslandCoord
can be used
as the key for a map or list and it will sort correctly.
- Specified by:
compareTo
in interface java.lang.Comparable
- Parameters:
obj
- Another IslandCoord
to which to compare
- Returns:
- negative, 0, or positive based on the comparison