public final class DegreesMinutesSeconds extends Object implements Comparable<DegreesMinutesSeconds>, IEquatable<DegreesMinutesSeconds>, IEquatableEpsilon<DegreesMinutesSeconds>, ImmutableValueType
Constructor and Description |
---|
DegreesMinutesSeconds()
Initializes a new instance.
|
DegreesMinutesSeconds(int revolutions,
int degrees,
int minutes,
double seconds)
Create an instance of a
DegreesMinutesSeconds angle with parameters |
Modifier and Type | Method and Description |
---|---|
DegreesMinutesSeconds |
add(DegreesMinutesSeconds addend)
Adds the specified
DegreesMinutesSeconds to this instance. |
static DegreesMinutesSeconds |
add(DegreesMinutesSeconds left,
DegreesMinutesSeconds right)
Adds two specified
DegreesMinutesSeconds instances. |
int |
compareTo(DegreesMinutesSeconds other)
Compares this instance with another instance of the same type.
|
static boolean |
equals(DegreesMinutesSeconds left,
DegreesMinutesSeconds right)
Returns
true if the two instances are exactly equal. |
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
boolean |
equalsEpsilon(DegreesMinutesSeconds other,
double epsilon)
Indicates whether each
DegreesMinutesSeconds value of another instance of this type
is within the required tolerance of the corresponding DegreesMinutesSeconds value of this instance. |
boolean |
equalsType(DegreesMinutesSeconds other)
Indicates whether another instance of this type is exactly equal to this instance.
|
int |
getDegrees()
Gets the number of degrees.
|
int |
getMinutes()
Gets the number of arc minutes.
|
int |
getRevolutions()
Gets the number of full 360 degree (2 Pi radians) revolutions.
|
double |
getSeconds()
Gets the number of arc seconds.
|
static boolean |
greaterThan(DegreesMinutesSeconds left,
DegreesMinutesSeconds right)
Returns
true if left is greater than right . |
static boolean |
greaterThanOrEqual(DegreesMinutesSeconds left,
DegreesMinutesSeconds right)
Returns
true if left is greater than or equal to right . |
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
static boolean |
lessThan(DegreesMinutesSeconds left,
DegreesMinutesSeconds right)
Returns
true if left is less than right . |
static boolean |
lessThanOrEqual(DegreesMinutesSeconds left,
DegreesMinutesSeconds right)
Returns
true if left is less than or equal to right . |
static DegreesMinutesSeconds |
multiply(DegreesMinutesSeconds left,
double right)
Multiplies the
DegreesMinutesSeconds by a constant. |
DegreesMinutesSeconds |
multiply(double scalar)
Multiplies this instance by the scalar provided.
|
static boolean |
notEquals(DegreesMinutesSeconds left,
DegreesMinutesSeconds right)
Returns
true if the two instances are not exactly equal. |
DegreesMinutesSeconds |
subtract(DegreesMinutesSeconds minuend)
Subtracts the specified
DegreesMinutesSeconds from this instance. |
static DegreesMinutesSeconds |
subtract(DegreesMinutesSeconds left,
DegreesMinutesSeconds right)
Subtracts a specified
DegreesMinutesSeconds from another specified DegreesMinutesSeconds . |
public DegreesMinutesSeconds()
public DegreesMinutesSeconds(int revolutions, int degrees, int minutes, double seconds)
DegreesMinutesSeconds
angle with parameters
Note that the parameters must be of the same sign. That is, if the degrees is negative, then all non-zero parameters must be negative.
revolutions
- The number of full 360 degree revolutions.degrees
- The number of degrees.minutes
- The number of arc minutes.seconds
- The number of arc secondspublic final int getRevolutions()
public final int getDegrees()
public final int getMinutes()
public final double getSeconds()
@Nonnull public final DegreesMinutesSeconds add(@Nonnull DegreesMinutesSeconds addend)
DegreesMinutesSeconds
to this instance.addend
- The DegreesMinutesSeconds
to add to this instance.DegreesMinutesSeconds
that represents the value of this instance plus the value of addend
.@Nonnull public final DegreesMinutesSeconds subtract(@Nonnull DegreesMinutesSeconds minuend)
DegreesMinutesSeconds
from this instance.minuend
- The DegreesMinutesSeconds
to subtract from this instance.DegreesMinutesSeconds
that represents the value of this instance minus the value of minuend
.@Nonnull public final DegreesMinutesSeconds multiply(double scalar)
scalar
- The scalar to multiply this angle by.DegreesMinutesSeconds
that represents the value of this instance times the value of scalar
.@Nonnull public static DegreesMinutesSeconds add(@Nonnull DegreesMinutesSeconds left, @Nonnull DegreesMinutesSeconds right)
DegreesMinutesSeconds
instances.left
- The first DegreesMinutesSeconds
to add.right
- The second DegreesMinutesSeconds
to add.left
and right
.@Nonnull public static DegreesMinutesSeconds subtract(@Nonnull DegreesMinutesSeconds left, @Nonnull DegreesMinutesSeconds right)
DegreesMinutesSeconds
from another specified DegreesMinutesSeconds
.left
- The subtrahend.right
- The minuend.left
minus right
.@Nonnull public static DegreesMinutesSeconds multiply(@Nonnull DegreesMinutesSeconds left, double right)
DegreesMinutesSeconds
by a constant.left
- The DegreesMinutesSeconds
to multiply.right
- The constant by which to multiply the DegreesMinutesSeconds
.DegreesMinutesSeconds
that represents the value of this instance multiplied by the constant.public static boolean equals(@Nonnull DegreesMinutesSeconds left, @Nonnull DegreesMinutesSeconds right)
true
if the two instances are exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
represents the same value as right
; otherwise false
.public static boolean notEquals(@Nonnull DegreesMinutesSeconds left, @Nonnull DegreesMinutesSeconds right)
true
if the two instances are not exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
does not represent the same value as right
; otherwise false
.public static boolean lessThan(@Nonnull DegreesMinutesSeconds left, @Nonnull DegreesMinutesSeconds right)
true
if left
is less than right
.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
is less than right
; otherwise false
.public static boolean greaterThan(@Nonnull DegreesMinutesSeconds left, @Nonnull DegreesMinutesSeconds right)
true
if left
is greater than right
.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
is greater than right
; otherwise false
.public static boolean lessThanOrEqual(@Nonnull DegreesMinutesSeconds left, @Nonnull DegreesMinutesSeconds right)
true
if left
is less than or equal to right
.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
is less than or equal to right
; otherwise false
.public static boolean greaterThanOrEqual(@Nonnull DegreesMinutesSeconds left, @Nonnull DegreesMinutesSeconds right)
true
if left
is greater than or equal to right
.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
is greater than or equal to right
; otherwise false
.public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare to this instance.true
if obj
is an instance of this type and represents the same value as this instance; otherwise false
.Object.hashCode()
,
HashMap
public final boolean equalsType(@Nonnull DegreesMinutesSeconds other)
equalsType
in interface IEquatable<DegreesMinutesSeconds>
other
- The instance to compare to this instance.true
if other
represents the same value as this instance; otherwise false
.public final boolean equalsEpsilon(@Nonnull DegreesMinutesSeconds other, double epsilon)
DegreesMinutesSeconds
value of another instance of this type
is within the required tolerance of the corresponding DegreesMinutesSeconds
value of this instance.equalsEpsilon
in interface IEquatableEpsilon<DegreesMinutesSeconds>
other
- The set of DegreesMinutesSeconds
values to compare to this instance.epsilon
- The limit at which the absolute differences between the DegreesMinutesSeconds
values will not be considered equal.true
if the absolute differences are less than or equal to epsilon
; otherwise false
.public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public final int compareTo(@Nonnull DegreesMinutesSeconds other)
compareTo
in interface Comparable<DegreesMinutesSeconds>
other
- An object to compare with this instance.Value | Meaning |
---|---|
Less than zero |
This instance is less than other .
|
Zero |
This instance is equal to other .
|
Greater than zero |
This instance is greater than other .
|