public class Directions
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static interface |
Directions.DirectionWordTranslator |
An interface to a translator for the direction words in this class
|
static class |
Directions.DirType |
The type of direction words supported
|
Modifier and Type | Field | Description |
---|---|---|
static int |
DOWN |
|
static int |
EAST |
|
static int |
GATE |
|
static int |
NORTH |
|
static int |
NORTHEAST |
|
static int |
NORTHWEST |
|
static int |
SOUTH |
|
static int |
SOUTHEAST |
|
static int |
SOUTHWEST |
|
static int |
UP |
|
static int |
WEST |
Constructor | Description |
---|---|
Directions() |
Constructs a new Directions object for the current thread group.
|
Modifier and Type | Method | Description |
---|---|---|
static int[] |
adjustXYByDirections(int x,
int y,
int direction) |
Given an x and y coordinate, and a direction code, this method will return
an int array with 2 entries x, and y, representing the changes to the given
x and y after moving in that direction.
|
static int[] |
adjustXYZByDirections(int x,
int y,
int z,
int direction) |
Given an x and y and z coordinate, and a direction code, this method will return
an int array with 2 entries x, y, and z representing the changes to the given
x, y, and z after moving in that direction.
|
static java.lang.String |
CARA_NAMES_LIST() |
Returns a string list of all of the permitted direction names, in ship-talk.
|
static int[] |
CODES() |
The BASE direction code numbers, in numeric order.
|
static Directions |
d(char c) |
Returns the Directions instance tied to the given thread group, or null if not yet created.
|
static int[] |
DISPLAY_CODES() |
The direction code numbers in preferred display order.
|
int |
getCaraDirectionCode(java.lang.String theDir) |
Given a string which is technically supposed to be a caravan-talk direction name,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
java.lang.String |
getCaraDirectionName(int code) |
Given the direction code, returns the ship-talk name of that direction, capitalized.
|
java.lang.String |
getCaraInDirectionName(int code) |
Returns the proper english caravan-talk direction name to follow the preposition
"happens" when talking about something happening in the given direction
code on a ship.
|
int |
getCompassDirectionCode(java.lang.String theDir) |
Given a string which is supposed to be a compass direction name,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
java.lang.String |
getDirectionChar(int code) |
Given the numeric direction code, this method returns the 1 or 2 char
"code" that represents that direction, such as N, S, E, W, NW, SW, etc..
|
int |
getDirectionCode(java.lang.String theDir) |
Given a string which is supposed to be a direction name of any type,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
java.lang.String |
getDirectionName(int code) |
Given the direction code, returns the formal name of that direction, capitalized.
|
java.lang.String |
getDirectionName(int code,
Directions.DirType typ) |
Given the direction code, and the type/flavor of direction, this
will return the normal direction name.
|
java.lang.String |
getDirectionName(java.lang.String theDir) |
Returns the formal direction name of the partial direction given.
|
java.lang.String |
getFromCaraDirectionName(int code) |
Returns the proper english caravan direction name to follow the preposition
"from" when talking about something or someone coming FROM the given direction
code on a ship.
|
java.lang.String |
getFromCompassDirectionName(int code) |
Returns the proper english compass direction name to follow the preposition
"from" when talking about something or someone coming FROM the given direction
code.
|
java.lang.String |
getFromDirectionName(int code,
Directions.DirType typ) |
Returns the proper english compass direction name to follow the preposition
"from" when talking about something or someone coming FROM the given direction
code.
|
java.lang.String |
getFromShipDirectionName(int code) |
Returns the proper english ship direction name to follow the preposition
"from" when talking about something or someone coming FROM the given direction
code on a ship.
|
int |
getGoodCaraDirectionCode(java.lang.String theDir) |
Given a string which is technically supposed to be a caravan-talk direction name,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
int |
getGoodCompassDirectionCode(java.lang.String theDir) |
Given a string which is supposed to be a compass direction name,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
int |
getGoodDirectionCode(java.lang.String theDir) |
Given a string which is supposed to be a direction name of any type,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
int |
getGoodDirectionCode(java.lang.String theDir,
Directions.DirType typ) |
Given a string which is technically supposed to be a talk direction name,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
int |
getGoodShipDirectionCode(java.lang.String theDir) |
Given a string which is technically supposed to be a ship-talk direction name,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
static int[] |
getGradualCourse(int[] curXY,
int[] tgtXY) |
Given two coordinates in x,y, this will return the set of directional moves
required to get from the first to the second.
|
static int |
getGradualDirectionCode(int curentCode,
int targetCode) |
Returns the direction code next to the given curentCode that
moves towards the target direction code
|
java.lang.String |
getInDirectionName(int code) |
Returns the proper english compass direction name to follow the preposition
"happens" when talking about something happening in the given direction
code.
|
java.lang.String |
getInDirectionName(int code,
Directions.DirType typ) |
Given the direction code, and the type/flavor of direction, this
returns the proper english compass direction name to follow the preposition
"happens" when talking about something happening in the given direction
code.
|
static int |
getOpDirectionCode(int code) |
Returns the direction code opposite to the given code.
|
int |
getOpDirectionCode(java.lang.String theDir) |
Given a string which is supposed to be a direction name of any type,
this method will make a case-insensitive check against the given
string and return the direction opposite to what it probably represents.
|
int |
getProbableDirectionCode(java.lang.String theDir) |
Given a string which is supposed to be a direction name of any type,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
static int |
getRelative11Directions(int[] xyFrom,
int[] xyTo) |
Returns the cardinal direction from the FROM point on a graph to the
TO point, where the points are X, then Y, with the northwest corner
being 0,0.
|
java.lang.String |
getRelativeCompassDirectionName(int code) |
Returns the proper english compass direction name to relative to somewhere else.
|
static int |
getRelativeDirection(int[] xyFrom,
int[] xyTo) |
Returns the cardinal direction from the FROM point on a graph to the
TO point, where the points are X, then Y, with the northwest corner
being 0,0.
|
static int |
getRelativeDirection(int[] xyFrom,
int[] xyTo,
boolean useBase4) |
Returns the cardinal direction from the FROM point on a graph to the
TO point, where the points are X, then Y, with the northwest corner
being 0,0.
|
int |
getShipDirectionCode(java.lang.String theDir) |
Given a string which is technically supposed to be a ship-talk direction name,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
java.lang.String |
getShipDirectionName(int code) |
Given the direction code, returns the ship-talk name of that direction, capitalized.
|
java.lang.String |
getShipInDirectionName(int code) |
Returns the proper english ship-talk direction name to follow the preposition
"happens" when talking about something happening in the given direction
code on a ship.
|
int |
getStrictCaraDirectionCode(java.lang.String theDir) |
Given a string which is technically supposed to be a caravan-talk direction name,
this method will make a case-insensitive check against the given
string and return the direction it represents.
|
int |
getStrictCompassDirectionCode(java.lang.String theDir) |
Given a string which is supposed to be a compass direction name,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
int |
getStrictDirectionCode(java.lang.String theDir) |
Given a string which is supposed to be a direction name of any type,
this method will make a case-insensitive check against the given
string and return the direction it probably represents.
|
int |
getStrictShipDirectionCode(java.lang.String theDir) |
Given a string which is technically supposed to be a ship-talk direction name,
this method will make a case-insensitive check against the given
string and return the direction it represents.
|
java.lang.String |
getUpperDirectionName(int code,
Directions.DirType typ) |
Given the direction code, returns the formal name of that direction, capitalized.
|
static Directions |
instance() |
Returns the Directions object that applies to the callers thread group.
|
static java.lang.String |
LETTERS() |
Returns a string list of all of the permitted direction letters.
|
static java.lang.String |
NAMES_LIST() |
Returns a string list of all of the permitted direction names.
|
static java.lang.String |
NAMES_LIST(Directions.DirType dirType) |
Returns a string list of all of the permitted direction names.
|
static int |
NUM_DIRECTIONS() |
Returns the total number of permitted exit directions, either 7 or 11
|
void |
reInitialize(int dirs,
Directions.DirectionWordTranslator translator) |
Reinitializes this direction object with a new number-of-directions.
|
static java.lang.String |
SHIP_NAMES_LIST() |
Returns a string list of all of the permitted direction names, in ship-talk.
|
public static final int NORTH
public static final int SOUTH
public static final int EAST
public static final int WEST
public static final int UP
public static final int DOWN
public static final int GATE
public static final int NORTHEAST
public static final int NORTHWEST
public static final int SOUTHEAST
public static final int SOUTHWEST
public Directions()
public static Directions d(char c)
c
- the code for the thread group to return (0-255)public static Directions instance()
public static final int NUM_DIRECTIONS()
public static final int[] CODES()
public static final int[] DISPLAY_CODES()
public static final java.lang.String LETTERS()
public static final java.lang.String NAMES_LIST()
public static final java.lang.String SHIP_NAMES_LIST()
public static final java.lang.String CARA_NAMES_LIST()
public static final java.lang.String NAMES_LIST(Directions.DirType dirType)
dirType
- the type/flavor of direction names to usepublic java.lang.String getDirectionName(java.lang.String theDir)
theDir
- the partial direction name, case insensitivepublic final void reInitialize(int dirs, Directions.DirectionWordTranslator translator)
dirs
- the number of directions, either 7 or 11translator
- optional language translator for all the stringspublic java.lang.String getDirectionName(int code)
code
- the direction codepublic java.lang.String getDirectionName(int code, Directions.DirType typ)
code
- the direction codetyp
- true the direction type/flavor to usepublic java.lang.String getUpperDirectionName(int code, Directions.DirType typ)
code
- the direction codetyp
- true the direction type/flavor to usepublic java.lang.String getShipDirectionName(int code)
code
- the direction codepublic java.lang.String getCaraDirectionName(int code)
code
- the direction codepublic java.lang.String getDirectionChar(int code)
code
- the direction codepublic int getDirectionCode(java.lang.String theDir)
theDir
- the direction search stringpublic int getShipDirectionCode(java.lang.String theDir)
theDir
- the ship-talk direction search stringpublic int getCaraDirectionCode(java.lang.String theDir)
theDir
- the caravan-talk direction search stringpublic int getCompassDirectionCode(java.lang.String theDir)
theDir
- the direction search stringpublic int getGoodDirectionCode(java.lang.String theDir)
theDir
- the direction search stringpublic int getStrictDirectionCode(java.lang.String theDir)
theDir
- the direction search stringpublic int getProbableDirectionCode(java.lang.String theDir)
theDir
- the direction search stringpublic int getGoodCompassDirectionCode(java.lang.String theDir)
theDir
- the direction search stringpublic int getStrictCompassDirectionCode(java.lang.String theDir)
theDir
- the direction search stringpublic int getGoodShipDirectionCode(java.lang.String theDir)
theDir
- the ship-talk direction search stringpublic int getGoodCaraDirectionCode(java.lang.String theDir)
theDir
- the caravan-talk direction search stringpublic int getGoodDirectionCode(java.lang.String theDir, Directions.DirType typ)
theDir
- the ship-talk direction search stringtyp
- the direction type/flavor codepublic int getStrictShipDirectionCode(java.lang.String theDir)
theDir
- the ship-talk direction search stringpublic int getStrictCaraDirectionCode(java.lang.String theDir)
theDir
- the caravan-talk direction search stringpublic static final int[] adjustXYByDirections(int x, int y, int direction)
x
- the x coordinatey
- the y coordinatedirection
- the direction code being travelledpublic static final int[] adjustXYZByDirections(int x, int y, int z, int direction)
x
- the x coordinatey
- the y coordinatez
- the z coordinatedirection
- the direction code being travelledpublic java.lang.String getFromCompassDirectionName(int code)
code
- the direction codepublic java.lang.String getFromDirectionName(int code, Directions.DirType typ)
code
- the direction codetyp
- the type/flavor of directionpublic java.lang.String getRelativeCompassDirectionName(int code)
code
- the direction codepublic java.lang.String getFromShipDirectionName(int code)
code
- the direction codepublic java.lang.String getFromCaraDirectionName(int code)
code
- the direction codepublic java.lang.String getInDirectionName(int code, Directions.DirType typ)
code
- the direction codetyp
- true the direction type/flavor to usepublic java.lang.String getInDirectionName(int code)
code
- the direction code the direction the thing is happening inpublic java.lang.String getShipInDirectionName(int code)
code
- the direction code the direction the thing is happening inpublic java.lang.String getCaraInDirectionName(int code)
code
- the direction code the direction the thing is happening inpublic static final int getOpDirectionCode(int code)
code
- the direction codepublic static final int[] getGradualCourse(int[] curXY, int[] tgtXY)
curXY
- the current coordinatestgtXY
- the target coordinatespublic static final int getGradualDirectionCode(int curentCode, int targetCode)
curentCode
- the current direction codetargetCode
- the target direction codepublic int getOpDirectionCode(java.lang.String theDir)
theDir
- the direction search stringpublic static final int getRelativeDirection(int[] xyFrom, int[] xyTo)
xyFrom
- the starting pointxyTo
- the target pointpublic static final int getRelative11Directions(int[] xyFrom, int[] xyTo)
xyFrom
- the starting pointxyTo
- the target pointpublic static final int getRelativeDirection(int[] xyFrom, int[] xyTo, boolean useBase4)
xyFrom
- the starting pointxyTo
- the target pointuseBase4
- true to use NSEW, false to use NORTHEAST, etc.