Package io.guise.framework.geometry
Enum CompassPoint
- java.lang.Object
-
- java.lang.Enum<CompassPoint>
-
- io.guise.framework.geometry.CompassPoint
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<CompassPoint>
public enum CompassPoint extends java.lang.Enum<CompassPoint>
Navigational directions.- Author:
- Garret Wilson
- See Also:
- Wikipedia: Compass, Wikipedia: Boxing the Compass
-
-
Enum Constant Summary
-
Field Summary
Fields Modifier and Type Field Description static java.math.BigDecimal
MAX_BEARING
The maximum bearing available; synonymous withNORTH
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.math.BigDecimal
checkBearing(java.math.BigDecimal bearing)
Checks to ensure that the given bearing is valid.java.lang.String
getAbbreviation()
java.math.BigDecimal
getBearing()
static CompassPoint
getCompassPoint(java.math.BigDecimal bearing)
Determines the closes compass point to the given bearing.static CompassPoint
getOrdinalCompassPoint(CompassPoint latitudeCompassPoint, CompassPoint longitudeCompassPoint)
Returns the ordinal or inter-cardinal compass point corresonding to 45 degrees between the given cardinal latitude and longitude compass points.boolean
isCardinal()
boolean
isOrdinal()
static CompassPoint
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static CompassPoint[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NORTH
public static final CompassPoint NORTH
-
NORTH_BY_EAST
public static final CompassPoint NORTH_BY_EAST
-
NORTH_NORTHEAST
public static final CompassPoint NORTH_NORTHEAST
-
NORTHEAST_BY_NORTH
public static final CompassPoint NORTHEAST_BY_NORTH
-
NORTHEAST
public static final CompassPoint NORTHEAST
-
NORTHEAST_BY_EAST
public static final CompassPoint NORTHEAST_BY_EAST
-
EAST_NORTHEAST
public static final CompassPoint EAST_NORTHEAST
-
EAST_BY_NORTH
public static final CompassPoint EAST_BY_NORTH
-
EAST
public static final CompassPoint EAST
-
EAST_BY_SOUTH
public static final CompassPoint EAST_BY_SOUTH
-
EAST_SOUTHEAST
public static final CompassPoint EAST_SOUTHEAST
-
SOUTHEAST_BY_EAST
public static final CompassPoint SOUTHEAST_BY_EAST
-
SOUTHEAST
public static final CompassPoint SOUTHEAST
-
SOUTHEAST_BY_SOUTH
public static final CompassPoint SOUTHEAST_BY_SOUTH
-
SOUTH_SOUTHEAST
public static final CompassPoint SOUTH_SOUTHEAST
-
SOUTH_BY_EAST
public static final CompassPoint SOUTH_BY_EAST
-
SOUTH
public static final CompassPoint SOUTH
-
SOUTH_BY_WEST
public static final CompassPoint SOUTH_BY_WEST
-
SOUTH_SOUTHWEST
public static final CompassPoint SOUTH_SOUTHWEST
-
SOUTHWEST_BY_SOUTH
public static final CompassPoint SOUTHWEST_BY_SOUTH
-
SOUTHWEST
public static final CompassPoint SOUTHWEST
-
SOUTHWEST_BY_WEST
public static final CompassPoint SOUTHWEST_BY_WEST
-
WEST_SOUTHWEST
public static final CompassPoint WEST_SOUTHWEST
-
WEST_BY_SOUTH
public static final CompassPoint WEST_BY_SOUTH
-
WEST
public static final CompassPoint WEST
-
WEST_BY_NORTH
public static final CompassPoint WEST_BY_NORTH
-
WEST_NORTHWEST
public static final CompassPoint WEST_NORTHWEST
-
NORTHWEST_BY_WEST
public static final CompassPoint NORTHWEST_BY_WEST
-
NORTHWEST
public static final CompassPoint NORTHWEST
-
NORTHWEST_BY_NORTH
public static final CompassPoint NORTHWEST_BY_NORTH
-
NORTH_NORTHWEST
public static final CompassPoint NORTH_NORTHWEST
-
NORTHBY_WEST
public static final CompassPoint NORTHBY_WEST
-
-
Field Detail
-
MAX_BEARING
public static final java.math.BigDecimal MAX_BEARING
The maximum bearing available; synonymous withNORTH
.
-
-
Method Detail
-
values
public static CompassPoint[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CompassPoint c : CompassPoint.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CompassPoint valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getAbbreviation
public java.lang.String getAbbreviation()
- Returns:
- The abbreviation of this compass point.
-
getBearing
public java.math.BigDecimal getBearing()
- Returns:
- The compass direction.
-
isCardinal
public boolean isCardinal()
- Returns:
- Whether this compass point represents one of the four cardinal directions.
-
isOrdinal
public boolean isOrdinal()
- Returns:
- Whether this compass point represents one of the four ordinal or intercardinal directions.
-
getCompassPoint
public static CompassPoint getCompassPoint(java.math.BigDecimal bearing)
Determines the closes compass point to the given bearing.- Parameters:
bearing
- The bearing for which a compass point should be returned.- Returns:
- The compass point closest to the given bearing.
- Throws:
java.lang.IllegalArgumentException
- if the given bearing is greater than 360.
-
getOrdinalCompassPoint
public static CompassPoint getOrdinalCompassPoint(CompassPoint latitudeCompassPoint, CompassPoint longitudeCompassPoint)
Returns the ordinal or inter-cardinal compass point corresonding to 45 degrees between the given cardinal latitude and longitude compass points.- Parameters:
latitudeCompassPoint
- The cardinal compass point of the latitude; eitherWEST
orEAST
.longitudeCompassPoint
- The cardinal compass point of the longitude; eitherNORTH
orSOUTH
.- Returns:
- The ordinal compass position corresponding to 45 degrees between the given cardinal longitude and latitude compass points.
- Throws:
java.lang.NullPointerException
- if the given latitude and/or longitude compass point isnull
.java.lang.IllegalArgumentException
- if the given latitude compass point is notWEST
orEAST
; and/or if the given longitude compass point is notNORTH
orSOUTH
.
-
checkBearing
public static java.math.BigDecimal checkBearing(java.math.BigDecimal bearing)
Checks to ensure that the given bearing is valid.- Parameters:
bearing
- The bearing to check.- Returns:
- The valid bearing.
- Throws:
java.lang.IllegalArgumentException
- if the given bearing is greater than 360.
-
-