T
- The coordinate type used to describe the motion.TDerivative
- The derivative type used to describe the motion.public final class Motion2<T,TDerivative> extends Object implements IMotion<T,TDerivative>, IEquatable<Motion2<T,TDerivative>>, ImmutableValueType
Constructor and Description |
---|
Motion2()
Initializes a new instance.
|
Motion2(T value,
TDerivative... derivatives)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
static <T,TDerivative> |
equals(Motion2<T,TDerivative> left,
Motion2<T,TDerivative> 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(Motion2<T,TDerivative> other)
Indicates whether another instance of this type is exactly equal to this instance.
|
TDerivative |
get(int index)
Gets the indicated derivative of the motion.
|
TDerivative |
getFirstDerivative()
Gets the first derivative, if it is available.
|
int |
getOrder()
Gets the number of derivatives described by this instance.
|
TDerivative |
getSecondDerivative()
Gets the second derivative, if it is available.
|
T |
getValue()
Gets the coordinate value.
|
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,TDerivative> |
notEquals(Motion2<T,TDerivative> left,
Motion2<T,TDerivative> right)
Returns
true if the two instances are not exactly equal. |
public Motion2()
public Motion2(T value, TDerivative... derivatives)
The first array element describes the first derivative, the second describes the second derivative, and so on.
value
- The value of the coordinate.derivatives
- The derivatives describing the motion.public final boolean equalsType(@Nonnull Motion2<T,TDerivative> other)
For two Motion instances to be considered equal, the value and derivatives of each must compare as equal.
equalsType
in interface IEquatable<Motion2<T,TDerivative>>
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,TDerivative> boolean equals(@Nonnull Motion2<T,TDerivative> left, @Nonnull Motion2<T,TDerivative> 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,TDerivative> boolean notEquals(@Nonnull Motion2<T,TDerivative> left, @Nonnull Motion2<T,TDerivative> 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()
getValue
in interface IMotion<T,TDerivative>
public final TDerivative getFirstDerivative()
getFirstDerivative
in interface IMotion<T,TDerivative>
ArgumentOutOfRangeException
- This motion instance does not contain a first derivative.public final TDerivative getSecondDerivative()
getSecondDerivative
in interface IMotion<T,TDerivative>
ArgumentOutOfRangeException
- This motion instance does not contain a second derivative.public final TDerivative get(int index)
Order
(get
) property.
Requesting index 0 will result in an ArgumentOutOfRangeException
.
get
in interface IMotion<T,TDerivative>
index
- The index of the derivative to retrieve.ArgumentOutOfRangeException
- Thrown when the index
is less than one or greater than the Order
(get
).
This exception can also be thrown if this object does not contain any derivatives.public final int getOrder()
getOrder
in interface IMotion<T,TDerivative>