Class Coordinate

    • Field Detail

      • NUM_DECIMALS

        public static final int NUM_DECIMALS
        the number of decimals to be used by the seconds.
        See Also:
        Constant Field Values
      • m_Negative

        protected boolean m_Negative
        whether the coordinate is negative.
      • m_Degree

        protected int m_Degree
        degrees.
      • m_Minute

        protected int m_Minute
        minutes.
      • m_Second

        protected double m_Second
        seconds.
    • Constructor Detail

      • Coordinate

        public Coordinate()
        Default constructor.
      • Coordinate

        public Coordinate​(boolean negative,
                          int deg,
                          int min,
                          double sec)
        Initialise coordinate with degrees, minutes, seconds
        Parameters:
        negative - whether the coordinate is negative
        deg - degrees
        min - minutes
        sec - seconds
      • Coordinate

        public Coordinate​(double deg)
        Generate Coordinate from decimal notation.
        Parameters:
        deg - decimal notation
    • Method Detail

      • isNegative

        public boolean isNegative()
        Returns whether the coordinate is negative.
        Returns:
        true if negative
      • getDegree

        public int getDegree()
        Returns the degrees.
        Returns:
        the degrees
      • getMinute

        public int getMinute()
        Returns the minutes.
        Returns:
        the minutes
      • getSecond

        public double getSecond()
        Returns the seconds.
        Returns:
        the seconds
      • toDecimal

        public double toDecimal()
        Return the coordinate in decimal notation.
        Returns:
        coordinate as decimal
      • clone

        protected Coordinate clone()
        Returns a copy of itself.
        Overrides:
        clone in class Object
        Returns:
        the copy
      • compareTo

        public int compareTo​(Coordinate o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Specified by:
        compareTo in interface Comparable<Coordinate>
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object o)
        Returns whether the two objects are the same.
        Overrides:
        equals in class Object
        Parameters:
        o - the object to be compared
        Returns:
        true if the object is the same as this one