com.guiseframework.geometry
Enum CompassPoint

java.lang.Object
  extended by java.lang.Enum<CompassPoint>
      extended by com.guiseframework.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
EAST
           
EAST_BY_NORTH
           
EAST_BY_SOUTH
           
EAST_NORTHEAST
           
EAST_SOUTHEAST
           
NORTH
           
NORTH_BY_EAST
           
NORTH_NORTHEAST
           
NORTH_NORTHWEST
           
NORTHBY_WEST
           
NORTHEAST
           
NORTHEAST_BY_EAST
           
NORTHEAST_BY_NORTH
           
NORTHWEST
           
NORTHWEST_BY_NORTH
           
NORTHWEST_BY_WEST
           
SOUTH
           
SOUTH_BY_EAST
           
SOUTH_BY_WEST
           
SOUTH_SOUTHEAST
           
SOUTH_SOUTHWEST
           
SOUTHEAST
           
SOUTHEAST_BY_EAST
           
SOUTHEAST_BY_SOUTH
           
SOUTHWEST
           
SOUTHWEST_BY_SOUTH
           
SOUTHWEST_BY_WEST
           
WEST
           
WEST_BY_NORTH
           
WEST_BY_SOUTH
           
WEST_NORTHWEST
           
WEST_SOUTHWEST
           
 
Field Summary
static java.math.BigDecimal MAX_BEARING
          The maximum bearing available; synonymous with NORTH.
 
Method Summary
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.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

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 with NORTH.

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 name
java.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; either WEST or EAST.
longitudeCompassPoint - The cardinal compass point of the longitude; either NORTH or SOUTH.
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 is null.
java.lang.IllegalArgumentException - if the given latitude compass point is not WEST or EAST; and/or if the given longitude compass point is not NORTH or SOUTH.

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.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.