T
- The type of Motion1
that this collection contains. For example, if T
is
Cartesian
, then this collection holds Motion<Cartesian>.public class DateMotionCollection1<T> extends Object implements IDateMotionCollection1<T>
Motion1
, 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
Motion1
instance is required to have the same Order
(get
).Constructor and Description |
---|
DateMotionCollection1()
Initializes a new instance.
|
DateMotionCollection1(int size,
int order)
Initializes a new instance with a particular size and order.
|
Modifier and Type | Method and Description |
---|---|
void |
add(JulianDate date,
Motion1<T> motion)
Adds an item to the collection.
|
void |
add(JulianDate date,
T... values)
Adds an item to the collection.
|
void |
add(JulianDate date,
T value)
Adds an item to the collection.
|
void |
add(JulianDate date,
T value,
T firstDerivative)
Adds an item to the collection.
|
void |
add(JulianDate date,
T value,
T firstDerivative,
T secondDerivative)
Adds an item to the collection.
|
void |
addRange(DateMotionCollection1<T> collection)
Adds the elements of the specified collection to the end of this collection.
|
ImmutableDateMotionCollection1<T> |
createImmutableView()
Creates a view of this instance that is guaranteed not to change.
|
List<T> |
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<T> |
getFirstDerivatives()
Gets the list of first derivatives in the collection.
|
List<Motion1<T>> |
getMotions()
Gets the list of motion instances in this collection.
|
int |
getOrder()
Gets the number of derivatives in this collection.
|
List<T> |
getSecondDerivatives()
Gets the list of second derivatives in the collection.
|
List<T> |
getValues()
Gets the list of values in the collection.
|
void |
insertItem(int index,
JulianDate date,
Motion1<T> motion)
Inserts an item at a particular index.
|
void |
insertItem(int index,
JulianDate date,
T... values)
Inserts an item at a particular index.
|
void |
insertItem(int index,
JulianDate date,
T value)
Inserts an item at a particular index.
|
void |
insertItem(int index,
JulianDate date,
T value,
T firstDerivative)
Inserts an item at a particular index.
|
void |
insertItem(int index,
JulianDate date,
T value,
T firstDerivative,
T secondDerivative)
Inserts an item at a particular index.
|
void |
setItem(int index,
JulianDate date,
Motion1<T> motion)
Sets an item at a particular index.
|
void |
setItem(int index,
JulianDate date,
T... values)
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,
T firstDerivative)
Sets an item at a particular index.
|
void |
setItem(int index,
JulianDate date,
T value,
T firstDerivative,
T secondDerivative)
Sets an item at a particular index.
|
public DateMotionCollection1()
public DateMotionCollection1(int size, int order)
After constructing a new instance with this constructor, the Count
(get
) property
will return size
and DateMotionCollection1.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 IDateMotionCollection1<T>
public final int getOrder()
getOrder
in interface IDateMotionCollection1<T>
public final List<JulianDate> getDates()
getDates
in interface IDateMotionCollection1<T>
public final List<Motion1<T>> 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 IDateMotionCollection1<T>
public final List<T> 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 IDateMotionCollection1<T>
index
- The derivative list to retrieve.public final List<T> getValues()
getValues
in interface IDateMotionCollection1<T>
public final List<T> getFirstDerivatives()
getFirstDerivatives
in interface IDateMotionCollection1<T>
public final List<T> getSecondDerivatives()
getSecondDerivatives
in interface IDateMotionCollection1<T>
public final void add(@Nonnull JulianDate date, T value)
add
in interface IDateMotionCollection1<T>
date
- The date associated with the item.value
- The value to add.public final void add(@Nonnull JulianDate date, T value, T firstDerivative)
add
in interface IDateMotionCollection1<T>
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, T firstDerivative, T secondDerivative)
add
in interface IDateMotionCollection1<T>
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... values)
add
in interface IDateMotionCollection1<T>
date
- The date associated with the item.values
- The values to add. The first item in the array is the value, the second item is the first derivative, and so on.public final void add(@Nonnull JulianDate date, @Nonnull Motion1<T> motion)
add
in interface IDateMotionCollection1<T>
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 IDateMotionCollection1<T>
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, T firstDerivative)
setItem
in interface IDateMotionCollection1<T>
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, T firstDerivative, T secondDerivative)
setItem
in interface IDateMotionCollection1<T>
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... values)
setItem
in interface IDateMotionCollection1<T>
index
- The index of the item to set.date
- The new date for the item.values
- The new values for the item.public final void setItem(int index, @Nonnull JulianDate date, @Nonnull Motion1<T> motion)
setItem
in interface IDateMotionCollection1<T>
index
- The index of the item to set.date
- The new date for the item.motion
- The new item.public final void insertItem(int index, @Nonnull JulianDate date, T value)
index
- The index of the item to insert.date
- The date for the item.value
- The value for the item.public final void insertItem(int index, @Nonnull JulianDate date, T value, T firstDerivative)
index
- The index of the item to insert.date
- The date for the item.value
- The value for the item.firstDerivative
- The first derivative for the item.public final void insertItem(int index, @Nonnull JulianDate date, T value, T firstDerivative, T secondDerivative)
index
- The index of the item to insert.date
- The date for the item.value
- The value for the item.firstDerivative
- The first derivative for the item.secondDerivative
- The second derivative for the item.public final void insertItem(int index, @Nonnull JulianDate date, T... values)
index
- The index of the item to insert.date
- The date for the item.values
- The values for the item.public final void insertItem(int index, @Nonnull JulianDate date, @Nonnull Motion1<T> motion)
index
- The index of the item to insert.date
- The date for the item.motion
- The item.public final void addRange(@Nonnull DateMotionCollection1<T> 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 ImmutableDateMotionCollection1<T> createImmutableView()
After calling this method to create an immutable view of this collection: