Package adams.data.gps
Class Coordinate
- java.lang.Object
-
- adams.data.gps.Coordinate
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Coordinate>
public class Coordinate extends Object implements Serializable, Comparable<Coordinate>, Cloneable
GPS coordinate container.- Author:
- dale (dale at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_Degree
degrees.protected int
m_Minute
minutes.protected boolean
m_Negative
whether the coordinate is negative.protected double
m_Second
seconds.static int
NUM_DECIMALS
the number of decimals to be used by the seconds.
-
Constructor Summary
Constructors Constructor Description Coordinate()
Default constructor.Coordinate(boolean negative, int deg, int min, double sec)
Initialise coordinate with degrees, minutes, secondsCoordinate(double deg)
Generate Coordinate from decimal notation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Coordinate
clone()
Returns a copy of itself.int
compareTo(Coordinate o)
Compares this object with the specified object for order.boolean
equals(Object o)
Returns whether the two objects are the same.int
getDegree()
Returns the degrees.int
getMinute()
Returns the minutes.double
getSecond()
Returns the seconds.boolean
isNegative()
Returns whether the coordinate is negative.double
toDecimal()
Return the coordinate in decimal notation.String
toString()
String representation.
-
-
-
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 negativedeg
- degreesmin
- minutessec
- 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.
-
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 interfaceComparable<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.
-
-