T - The coordinate type that this collection contains. Values (get) will be collection of this type.TDerivative - The derivative type that this collection contains. FirstDerivatives (get), SecondDerivatives (get),
and additional derivatives are lists of this type.public class DateMotionCollection2<T,TDerivative> extends Object implements IDateMotionCollection2<T,TDerivative>
Motion2, each of which is associated with a particular JulianDate.
This is a convenient and efficient way to store time-varying position and velocity, etc. Each
Motion2 instance is required to have the same Order (get).| Constructor and Description |
|---|
DateMotionCollection2()
Initializes a new instance.
|
DateMotionCollection2(int size,
int order)
Initializes a new instance with a particular size and order.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(JulianDate date,
Motion2<T,TDerivative> motion)
Adds an item to the collection.
|
void |
add(JulianDate date,
T value)
Adds an item to the collection.
|
void |
add(JulianDate date,
T value,
TDerivative... derivatives)
Adds an item to the collection.
|
void |
add(JulianDate date,
T value,
TDerivative firstDerivative)
Adds an item to the collection.
|
void |
add(JulianDate date,
T value,
TDerivative firstDerivative,
TDerivative secondDerivative)
Adds an item to the collection.
|
void |
addRange(DateMotionCollection2<T,TDerivative> collection)
Adds the elements of the specified collection to the end of this collection.
|
ImmutableDateMotionCollection2<T,TDerivative> |
createImmutableView()
Creates a view of this instance that is guaranteed not to change.
|
List<TDerivative> |
get(int index)
Gets the list of the specified derivative.
|
int |
getCount()
Gets the number of items in this collection.
|
List<JulianDate> |
getDates()
Gets the list of dates in this collection.
|
List<TDerivative> |
getFirstDerivatives()
Gets the list of first derivatives in the collection.
|
List<Motion2<T,TDerivative>> |
getMotions()
Gets the list of motion instances in this collection.
|
int |
getOrder()
Gets the number of derivatives in this collection.
|
List<TDerivative> |
getSecondDerivatives()
Gets the list of second derivatives in the collection.
|
List<T> |
getValues()
Gets the list of values in the collection.
|
void |
setItem(int index,
JulianDate date,
Motion2<T,TDerivative> motion)
Sets an item at a particular index.
|
void |
setItem(int index,
JulianDate date,
T value)
Sets an item at a particular index.
|
void |
setItem(int index,
JulianDate date,
T value,
TDerivative... derivatives)
Sets an item at a particular index.
|
void |
setItem(int index,
JulianDate date,
T value,
TDerivative firstDerivative)
Sets an item at a particular index.
|
void |
setItem(int index,
JulianDate date,
T value,
TDerivative firstDerivative,
TDerivative secondDerivative)
Sets an item at a particular index.
|
public DateMotionCollection2()
public DateMotionCollection2(int size,
int order)
After constructing a new instance with this constructor, the Count (get) property
will return size and DateMotionCollection2.setItem(int,JulianDate,Object) can be used to set the value
at a particular index. Also, the Order (get) property will return
order.
size - The number of items in the collection.order - The number of derivatives that the collection should store.public final int getCount()
getCount in interface IDateMotionCollection2<T,TDerivative>public final int getOrder()
getOrder in interface IDateMotionCollection2<T,TDerivative>public final List<JulianDate> getDates()
getDates in interface IDateMotionCollection2<T,TDerivative>public final List<Motion2<T,TDerivative>> getMotions()
Values (get), FirstDerivatives (get),
SecondDerivatives (get), etc. to get all of the corresponding
data as a single list. This is more
efficient than requesting a list of motion instances.getMotions in interface IDateMotionCollection2<T,TDerivative>public final List<TDerivative> get(int index)
Specifying an index of 0 retrieves a list of all
values in the collection. Specifying 1 retrieves a list of all first
derivatives. Specifying 2 retrieves a list of all second derivatives.
And so on.
get in interface IDateMotionCollection2<T,TDerivative>index - The derivative list to retrieve.public final List<T> getValues()
getValues in interface IDateMotionCollection2<T,TDerivative>public final List<TDerivative> getFirstDerivatives()
getFirstDerivatives in interface IDateMotionCollection2<T,TDerivative>public final List<TDerivative> getSecondDerivatives()
getSecondDerivatives in interface IDateMotionCollection2<T,TDerivative>public final void add(@Nonnull JulianDate date, T value)
add in interface IDateMotionCollection2<T,TDerivative>date - The date associated with the item.value - The value to add.public final void add(@Nonnull JulianDate date, T value, TDerivative firstDerivative)
add in interface IDateMotionCollection2<T,TDerivative>date - The date associated with the item.value - The value to add.firstDerivative - The first derivative to add.public final void add(@Nonnull JulianDate date, T value, TDerivative firstDerivative, TDerivative secondDerivative)
add in interface IDateMotionCollection2<T,TDerivative>date - The date associated with the item.value - The value to add.firstDerivative - The first derivative to add.secondDerivative - The second derivative to add.public final void add(@Nonnull JulianDate date, T value, TDerivative... derivatives)
add in interface IDateMotionCollection2<T,TDerivative>date - The date associated with the item.value - The value to add.derivatives - The derivatives to add. The first item in the array is the first derivative, the second item in the array is the second derivative, and so on.public final void add(@Nonnull JulianDate date, @Nonnull Motion2<T,TDerivative> motion)
add in interface IDateMotionCollection2<T,TDerivative>date - The date associated with the item.motion - The item to add.public final void setItem(int index,
@Nonnull
JulianDate date,
T value)
setItem in interface IDateMotionCollection2<T,TDerivative>index - The index of the item to set.date - The new date for the item.value - The new value for the item.public final void setItem(int index,
@Nonnull
JulianDate date,
T value,
TDerivative firstDerivative)
setItem in interface IDateMotionCollection2<T,TDerivative>index - The index of the item to set.date - The new date for the item.value - The new value for the item.firstDerivative - The new first derivative for the item.public final void setItem(int index,
@Nonnull
JulianDate date,
T value,
TDerivative firstDerivative,
TDerivative secondDerivative)
setItem in interface IDateMotionCollection2<T,TDerivative>index - The index of the item to set.date - The new date for the item.value - The new value for the item.firstDerivative - The new first derivative for the item.secondDerivative - The new second derivative for the item.public final void setItem(int index,
@Nonnull
JulianDate date,
T value,
TDerivative... derivatives)
setItem in interface IDateMotionCollection2<T,TDerivative>index - The index of the item to set.date - The new date for the item.value - The new value for the item.derivatives - The new derivatives for the item.public final void setItem(int index,
@Nonnull
JulianDate date,
@Nonnull
Motion2<T,TDerivative> motion)
setItem in interface IDateMotionCollection2<T,TDerivative>index - The index of the item to set.date - The new date for the item.motion - The new item.public final void addRange(@Nonnull DateMotionCollection2<T,TDerivative> collection)
collection - The collection whose elements should be added to the end of this collection.
The input collection must have an Order (get) equal to or greater than the
Order of this collection.ArgumentException - Thrown when the Order (get) of the parameter collection
is lower than the Order (get) of this object.ArgumentNullException - Thrown when collection is null.@Nonnull public final ImmutableDateMotionCollection2<T,TDerivative> createImmutableView()
After calling this method to create an immutable view of this collection: