Enum CompassPoint

    • 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.