|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.Location
Encapsulates a location: a map and an (x, y) position in the map. Also provides a number of static utility methods for manipulating locations.
Field Summary | |
protected boolean |
askMap_
|
protected java.lang.String |
map_
|
protected int |
x_
|
protected int |
y_
|
Constructor Summary | |
Location()
Constructs a new Location with no value. |
|
Location(int x,
int y,
java.lang.String map)
Constructs a new Location with the passed parameters. |
|
Location(Location loc)
Constructs a new Location that has the same values as the passed location. |
|
Location(Point p,
java.lang.String map)
Constructs a new Location with the passed parameters. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Overrides Object.equals. |
static java.lang.String |
formatPoint(int x,
int y)
Point-formatting utility. |
static java.lang.String |
formatPoint(int x,
int y,
int z)
Point-formatting utility. |
static java.lang.String |
formatPoint(Point p)
Point-formatting utility. |
static Rectangle |
getBounds(java.util.List locations)
Returns the bounding rectangle for an arbitrary location list. |
static Rectangle |
getBounds(Point[] locations)
Returns the bounding rectangle for an arbitrary location list. |
java.lang.String |
getMap()
|
Point |
getPoint()
|
int |
getX()
|
int |
getY()
|
boolean |
isAsking()
Returns true if this Location is flagged as not having a specific point in the map. |
static Location |
parseLocation(java.lang.String value)
Parses a location in the form "map x y". |
void |
setAskMap(boolean ask)
Tells the user of this Location that they should ask the destination map for the start point. |
void |
setCoords(Point p)
Sets coordinates to those of the passed Point. |
void |
setMap(java.lang.String map)
|
void |
setX(int x)
|
void |
setY(int y)
|
java.lang.String |
toCommand(java.lang.String verb)
Same as toPath(), but prepends the specific command verb before the path. |
java.lang.String |
toPath()
Returns this locations's path in the form "map x y", so you can append it to a command like "teleport". |
java.lang.String |
toString()
Returns a String representation of this Location. |
static java.util.ArrayList |
translate(java.util.List src,
Point offset)
Translates a location list by a specified (x, y) offset. |
static Point[] |
translate(Point[] src,
Point offset)
Translates a location list by a specified (x, y) offset. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int x_
protected int y_
protected java.lang.String map_
protected boolean askMap_
Constructor Detail |
public Location()
public Location(int x, int y, java.lang.String map)
map
- relative path to the mapx
- map xy
- map ypublic Location(Point p, java.lang.String map)
map
- relative path to the mapp
- map (x, y) coordinates (p doesn't change)public Location(Location loc)
loc
- another Location objectMethod Detail |
public int getX()
public int getY()
public java.lang.String getMap()
public void setX(int x)
public void setY(int y)
public void setCoords(Point p)
public void setMap(java.lang.String map)
public Point getPoint()
public boolean isAsking()
public void setAskMap(boolean ask)
ask
- true to ask, false to use Location's x and y coordinatespublic java.lang.String toString()
public java.lang.String toPath()
public java.lang.String toCommand(java.lang.String verb)
verb
- a command like "goto" or "teleport".
public boolean equals(java.lang.Object obj)
obj
- another Location; returns false if the passed object
is not a Location object.
public static Location parseLocation(java.lang.String value)
public static java.lang.String formatPoint(int x, int y)
x
- any inty
- any int
public static java.lang.String formatPoint(Point p)
p
- any Point
public static java.lang.String formatPoint(int x, int y, int z)
x
- any inty
- any intz
- any int
public static Rectangle getBounds(Point[] locations)
public static Rectangle getBounds(java.util.List locations)
public static Point[] translate(Point[] src, Point offset)
public static java.util.ArrayList translate(java.util.List src, Point offset)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |