T
- The coordinate type used to describe the motion.public final class Motion1<T> extends Object implements IMotion<T,T>, IEquatable<Motion1<T>>, ImmutableValueType
Constructor and Description |
---|
Motion1()
Initializes a new instance.
|
Motion1(T... motion)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
static <T> boolean |
equals(Motion1<T> left,
Motion1<T> 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 |
equalsType(Motion1<T> other)
Indicates whether another instance of this type is exactly equal to this instance.
|
T |
get(int index)
Gets the indicated component of the motion.
|
T |
getFirstDerivative()
Gets the first derivative, if it is available.
|
int |
getOrder()
Gets the number of derivatives described by this instance.
|
T |
getSecondDerivative()
Gets the second derivative, if it is available.
|
T |
getValue()
Gets the value of the coordinate.
|
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 <T> boolean |
notEquals(Motion1<T> left,
Motion1<T> right)
Returns
true if the two instances are not exactly equal. |
public Motion1()
public Motion1(@Nonnull T... motion)
The first array element describes the value of the coordinate. The second describes the first derivative, the third describes the second derivative, and so on. The array must have at least one element.
motion
- The description of the motion.ArgumentNullException
- Thrown when the parameter motion
is null
.IllegalStateException
- Thrown when the motion
does not contain any values.public final boolean equalsType(@Nonnull Motion1<T> other)
For two Motion instances to be considered equal, the value and derivatives of each must compare as equal.
equalsType
in interface IEquatable<Motion1<T>>
other
- The instance to compare to this instance.true
if other
represents the same value as this instance; otherwise false
.public boolean equals(Object obj)
For two Motion instances to be considered equal, the value and derivatives of each must compare as equal.
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 int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public static <T> boolean equals(@Nonnull Motion1<T> left, @Nonnull Motion1<T> right)
true
if the two instances are exactly equal.
For two Motion instances to be considered equal, the value and derivatives of each must compare as 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 <T> boolean notEquals(@Nonnull Motion1<T> left, @Nonnull Motion1<T> right)
true
if the two instances are not exactly equal.
For two Motion instances to be considered equal, the value and derivatives of each must compare as 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 final T getValue()
public final T getFirstDerivative()
getFirstDerivative
in interface IMotion<T,T>
ArgumentOutOfRangeException
- This motion instance does not contain a first derivative.public final T getSecondDerivative()
getSecondDerivative
in interface IMotion<T,T>
ArgumentOutOfRangeException
- This motion instance does not contain a second derivative.public final T get(int index)
Order
(get
) property.