public class SegmentResults extends Object implements IThreadAware
SegmentPropagator
. Most
Segment Propagators
return a results type derived from this class,
see the documentation for more information. When a SegmentPropagator
propagates, it must fill in all of the relevant values in this type before it returns its results.Modifier | Constructor and Description |
---|---|
|
SegmentResults(SegmentPropagator propagator)
Initializes a new instance.
|
|
SegmentResults(SegmentPropagator propagator,
ITimeBasedState initialState)
Initializes a new instance.
|
|
SegmentResults(SegmentPropagator propagator,
SegmentResults results)
Initializes a new instance.
|
protected |
SegmentResults(SegmentResults existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addEphemerisPoint(ITimeBasedState state)
|
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
void |
cropEphemerisForOverallTrajectory(IntegrationSense overallDirection,
TimeInterval interval)
|
StateElementAdapter |
getAdapter(String elementIdentification)
Gets the adapter for the specified element.
|
List<StateElementAdapter> |
getAdapters()
Gets the list of
adapters needed to transform the states of
this results to the next. |
List<SegmentResults> |
getAdditionalSegmentResults()
Gets a list of
SegmentResults that this segment may have
propagated. |
boolean |
getCanceled()
Gets a value indicating whether the propagation run was canceled.
|
SegmentConfiguration |
getConfiguration()
Gets the segment configuration that was used to
propagate the segment that made these results. |
static <T> DateMotionCollection1<T> |
getDateMotionCollection(String element,
List<ITimeBasedState> ephemeris)
Gets a
DateMotionCollection1 of the element . |
<T> DateMotionCollection1<T> |
getDateMotionCollectionOfOverallTrajectory(String element)
|
DateMotionCollection1<Cartesian> |
getDateMotionCollectionOfOverallTrajectory(String element,
ReferenceFrame frame)
Gets a
DateMotionCollection1 of the element in the specified
ReferenceFrame from the EphemerisForOverallTrajectory (get ). |
Object |
getElementDefinedIn(String element)
Gets the
Object that the element was defined in. |
List<ITimeBasedState> |
getEntireComputedEphemeris()
Gets the entire ephemeris computed by the
SegmentPropagator . |
List<ITimeBasedState> |
getEphemerisForOverallTrajectory()
Gets the ephemeris that should be used to represent the objects trajectory.
|
ITimeBasedState |
getFinalPropagatedState()
Gets the final state that was propagated by the
SegmentPropagator in time
from the EphemerisForOverallTrajectory (get ). |
ITimeBasedState |
getFirstPropagatedState()
Gets the first state that was propagated by this segment.
|
List<String> |
getIdentifiers()
Gets the identifiers of all of the elements propagated by the segment.
|
ITimeBasedState |
getInitialState()
Gets the initial
state that the
SegmentPropagator was propagated from. |
boolean |
getIsThreadSafe()
Gets a value indicating whether the methods on this instance are safe to call from
multiple threads simultaneously.
|
<T> ArrayList<Motion1<T>> |
getMotionCollection(String element)
|
static <T> ArrayList<Motion1<T>> |
getMotionCollection(String element,
List<ITimeBasedState> states)
Gets a
List of the element . |
boolean |
getOverrideSegmentListEphemeris()
Gets a value indicating whether the
SegmentPropagator that created these results requires
the parent SegmentListResults to update its EphemerisForOverallTrajectory (get ). |
SegmentListResults |
getParentResults()
Gets the results of the
SegmentListResults that contains the SegmentPropagator
that created these results. |
IntegrationSense |
getPropagationDirection()
Gets what direction propagation initially occurred.
|
SegmentPropagator |
getPropagator()
Gets the
SegmentPropagator that was used to make this set of results. |
SegmentResults |
getResultsOfSegment(SegmentDefinition segment)
|
boolean |
getSegmentCompletelyOverriddenByOverlappingSegment()
Gets a value indicating whether a
SegmentPropagator after the one that made these results stepped back so
far that the EphemerisForOverallTrajectory (get ) is empty. |
SegmentDefinition |
getSegmentIdentifier()
|
SegmentDefinition |
getSegmentOverrideStartsIn()
Gets the
segment that the
SegmentPropagator that created this set of results starts
in if this segment needs to start before the end of the previous segment. |
ITimeBasedState |
getStateForNextSegment()
Gets a copy of the state to be passed to the next
SegmentPropagator . |
StateForNextSegmentBehavior |
getStateForNextSegmentBehavior()
Gets which state the
SegmentPropagator will pass
to the next segment. |
boolean |
getStopAllPropagation()
Gets a value indicating whether all propagation must stop and whatever results
have been computed should be returned.
|
boolean |
getStopPropagationForCurrentSegmentList()
Gets a value indicating whether the current
SegmentListPropagator was told to
stop propagating its SegmentPropagators
but that propagation of anything after this propagator should continue. |
TimeInterval |
getTimeIntervalOfEntireComputedEphemeris()
|
TimeInterval |
getTimeIntervalOfEphemerisForOverallTrajectory()
|
List<Integer> |
indexOfStateWithDateFromEntireComputedEphemeris(JulianDate date)
Gets the indexes of states within
EntireComputedEphemeris (get ) at the specified date. |
void |
setCanceled(boolean value)
Sets a value indicating whether the propagation run was canceled.
|
void |
setConfiguration(SegmentConfiguration value)
Sets the segment configuration that was used to
propagate the segment that made these results. |
void |
setElementDefinedIn(String element,
Object definedIn)
Sets the defined-in object (
ReferenceFrame , Axes ...),
for the specified element. |
void |
setInitialState(ITimeBasedState value)
Sets the initial
state that the
SegmentPropagator was propagated from. |
void |
setOverrideSegmentListEphemeris(boolean value)
Sets a value indicating whether the
SegmentPropagator that created these results requires
the parent SegmentListResults to update its EphemerisForOverallTrajectory (get ). |
void |
setParentResults(SegmentListResults value)
Sets the results of the
SegmentListResults that contains the SegmentPropagator
that created these results. |
void |
setSegmentCompletelyOverriddenByOverlappingSegment(boolean value)
Sets a value indicating whether a
SegmentPropagator after the one that made these results stepped back so
far that the EphemerisForOverallTrajectory (get ) is empty. |
void |
setSegmentOverrideStartsIn(SegmentDefinition value)
Sets the
segment that the
SegmentPropagator that created this set of results starts
in if this segment needs to start before the end of the previous segment. |
void |
setStopAllPropagation(boolean value)
Sets a value indicating whether all propagation must stop and whatever results
have been computed should be returned.
|
void |
setStopPropagationForCurrentSegmentList(boolean value)
Sets a value indicating whether the current
SegmentListPropagator was told to
stop propagating its SegmentPropagators
but that propagation of anything after this propagator should continue. |
public SegmentResults(@Nonnull SegmentPropagator propagator, @Nonnull SegmentResults results)
state element adapters
included with the propagator
.propagator
- The SegmentPropagator
that is generating the results.results
- The results where the initial state, configuration, OverrideSegmentListEphemeris, parent results, SegmentCompletelyOverriddenByOverlappingSegment,
SegmentOverrideStartsIn, StopAllPropagation, StopPropagationForCurrentSegmentList, EntireComputedEphemeris, and EphemerisForOverallTrajectory will be extracted from.public SegmentResults(@Nonnull SegmentPropagator propagator, ITimeBasedState initialState)
state element adapters
included with the propagator
.propagator
- The SegmentPropagator
that is generating the results.initialState
- The initial state
that the
SegmentPropagator
was propagated from.public SegmentResults(@Nonnull SegmentPropagator propagator)
state element adapters
included with the propagator
.propagator
- The SegmentPropagator
that is generating the results.protected SegmentResults(@Nonnull SegmentResults existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public Object clone(CopyContext context)
This method should be implemented to call a copy constructor on the class of the
object being cloned. The copy constructor should take the CopyContext
as a parameter
in addition to the existing instance to copy. The copy constructor should first call
CopyContext.addObjectMapping(T, T)
to identify the newly constructed instance
as a copy of the existing instance. It should then copy all fields, using
CopyContext.updateReference(T)
to copy any reference fields.
A typical implementation of ICloneWithContext
:
public static class MyClass implements ICloneWithContext {
public MyClass(MyClass existingInstance, CopyContext context) {
context.addObjectMapping(existingInstance, this);
someReference = context.updateReference(existingInstance.someReference);
}
@Override
public final Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
}
In general, all fields that are reference types should be copied with a call to
CopyContext.updateReference(T)
. There are a couple of exceptions:
If one of these exceptions applies, the CopyContext
should be given an opportunity
to update the reference before the reference is copied explicitly. Use
CopyContext.updateReference(T)
to update the reference. If CopyContext.updateReference(T)
returns
the original object, indicating that the context does not have a replacement registered,
then copy the object manually by invoking a Clone method, a copy constructor, or by manually
constructing a new instance and copying the values.
alwaysCopy = context.updateReference(existingInstance.alwaysCopy);
if (existingInstance.alwaysCopy != null && alwaysCopy == existingInstance.alwaysCopy) {
alwaysCopy = (AlwaysCopy) existingInstance.alwaysCopy.clone(context);
}
If you are implementing an evaluator (a class that implements IEvaluator
), the
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
method shares some responsibilities with the
copy context constructor. Code duplication can be avoided by doing the following:
CopyContext.updateReference(T)
. You should still call CopyContext.updateReference(T)
on any references to
non-evaluators.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as the last line in the constructor and pass it the
same CopyContext
passed to the constructor.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as normal. See the reference documentation for
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
for more information on implementing that method.
public MyClass(MyClass existingInstance, CopyContext context) {
super(existingInstance, context);
someReference = context.updateReference(existingInstance.someReference);
evaluatorReference = existingInstance.evaluatorReference;
updateEvaluatorReferences(context);
}
@Override
public void updateEvaluatorReferences(CopyContext context) {
evaluatorReference = context.updateReference(evaluatorReference);
}
@Override
public Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
private IEvaluator evaluatorReference;
clone
in interface ICloneWithContext
context
- The context to use to perform the copy.public final boolean getIsThreadSafe()
If this property is true
, all methods and properties are guaranteed to be thread safe.
Conceptually, an object that returns true
for this method acts as if there is a lock
protecting each method and property such that only one thread at a time can be inside any method or
property in the class. In reality, such locks are generally not used and are in fact discouraged. However,
the user must not experience any exceptions or inconsistent behavior that would not be experienced if such
locks were used.
If this property is false
, the behavior when using this class from multiple threads
simultaneously is undefined and may include inconsistent results and exceptions. Clients wishing to use
multiple threads should call CopyForAnotherThread.copy(T)
to get a separate instance of the
object for each thread.
getIsThreadSafe
in interface IThreadAware
@Nonnull public <T> DateMotionCollection1<T> getDateMotionCollectionOfOverallTrajectory(String element)
DateMotionCollection1
of the element
from the
EphemerisForOverallTrajectory
(get
). The state type stored must be
ITimeBasedState
. Use the SegmentResults.getMotionCollection(String)
method if the
states stored are not time based.
Note that this method will not make any attempt to transform the returned DateMotionCollection1
into
its defined-in ReferenceFrame
or Axes
.T
- The type (double
, Cartesian
...) that the
element
is.element
- The element whose data you want.DateMotionCollection1
of the element
.@Nonnull public DateMotionCollection1<Cartesian> getDateMotionCollectionOfOverallTrajectory(String element, ReferenceFrame frame)
DateMotionCollection1
of the element
in the specified
ReferenceFrame
from the EphemerisForOverallTrajectory
(get
).
This method assumes that you are asking for an entry that is of type Cartesian
and that the element
in the state is of that type. The state type stored must be
ITimeBasedState
.element
- The element whose data you want.frame
- The ReferenceFrame
that you want the returned collection in.DateMotionCollection1
of the element
.@Nonnull public <T> ArrayList<Motion1<T>> getMotionCollection(String element)
Motion1
of the element
from the EphemerisForOverallTrajectory
(get
). This will not make any attempt to transform the
returned ephemeris into a consistent ReferenceFrame
or Axes
.public final SegmentConfiguration getConfiguration()
propagate the segment
that made these results.public final void setConfiguration(SegmentConfiguration value)
propagate the segment
that made these results.public final SegmentDefinition getSegmentIdentifier()
public final void addEphemerisPoint(@Nonnull ITimeBasedState state)
state
to the EntireComputedEphemeris
(get
) and
EphemerisForOverallTrajectory
(get
) and checks that all of the elements in the
state
are included in the Identifiers
(get
). This will add
the state
such that all of the states are in time ascending order.state
- The ITimeBasedState
to add to this set of results.@Nonnull public final List<ITimeBasedState> getEntireComputedEphemeris()
Gets the entire ephemeris computed by the SegmentPropagator
.
This may include ephemeris points that should be ignored when looking at the objects overall trajectory. Examples of why this may not
match the EphemerisForOverallTrajectory
(get
) may be because a later segment had to start at some
point before the end of this segment, or because the segment computed additional ephemeris to aid with
interpolation. In order to work with the rest of the library, the elements in this list
should be in time ascending order even if the segment was propagated backwards.
Even for segments that do not actually propagate elements, the StateForNextSegment
(get
) should be added
to this list.
@Nonnull public final List<ITimeBasedState> getEphemerisForOverallTrajectory()
EntireComputedEphemeris
(get
).
The method SegmentListResults.propagateToAssumingTimeBasedStates(agi.foundation.time.JulianDate, agi.foundation.segmentpropagation.SegmentResults, agi.foundation.segmentpropagation.SegmentListResults)
will automatically update this
list for all SegmentResults
that need to have this list edited (if, for example, a later segment
needs to start at a time before the start time that was passed into it). However if you do not call
the appropriate method on SegmentListResults
then it is the responsibility of the SegmentPropagator
that steps on a previous segment to update this collection properly.
In order to work with the rest of the library, the elements in this list should be in time ascending order even if the segment was propagated backwards.
@Nonnull public final List<String> getIdentifiers()
public final ITimeBasedState getInitialState()
state
that the
SegmentPropagator
was propagated from. If any processing was done to
the initial state
passed into the
SegmentPropagator.PropagateSegment#PropagateSegment(SegmentListResults,SegmentConfiguration,ITrackCalculationProgress)
method (such as applying
adapters
or initializing a different
state
with the passed in initial
state
) that modified state
should be set here instead of the passed in state
.public final void setInitialState(ITimeBasedState value)
state
that the
SegmentPropagator
was propagated from. If any processing was done to
the initial state
passed into the
SegmentPropagator.PropagateSegment#PropagateSegment(SegmentListResults,SegmentConfiguration,ITrackCalculationProgress)
method (such as applying
adapters
or initializing a different
state
with the passed in initial
state
) that modified state
should be set here instead of the passed in state
.public final ITimeBasedState getFirstPropagatedState()
public final ITimeBasedState getFinalPropagatedState()
SegmentPropagator
in time
from the EphemerisForOverallTrajectory
(get
).@Nullable public final ITimeBasedState getStateForNextSegment()
SegmentPropagator
.
This is determined automatically by the StateForNextSegmentBehavior
(get
) and the
EphemerisForOverallTrajectory
(get
).public Object getElementDefinedIn(@Nonnull String element)
Object
that the element
was defined in. Generally this is an Axes
or
ReferenceFrame
. If this returns null
then either the element
has no defined-in object, or the element
was not propagated by the segment that made the results.element
- The element whose defined-in object is requested.Axes
, ReferenceFrame
, or Object
that the element
is represented in.public final void setElementDefinedIn(@Nonnull String element, Object definedIn)
ReferenceFrame
, Axes
...),
for the specified element.element
- The element.definedIn
- The defined-in object of the element
.public final SegmentDefinition getSegmentOverrideStartsIn()
segment
that the
SegmentPropagator
that created this set of results starts
in if this segment needs to start before the end of the previous segment.
This is only needed if another segment overlaps with this one.public final void setSegmentOverrideStartsIn(SegmentDefinition value)
segment
that the
SegmentPropagator
that created this set of results starts
in if this segment needs to start before the end of the previous segment.
This is only needed if another segment overlaps with this one.public final boolean getOverrideSegmentListEphemeris()
SegmentPropagator
that created these results requires
the parent SegmentListResults
to update its EphemerisForOverallTrajectory
(get
).
This must be true
if this segment needed to start at some point other than
at the end of the previous SegmentPropagator
. Otherwise leave this as false
.public final void setOverrideSegmentListEphemeris(boolean value)
SegmentPropagator
that created these results requires
the parent SegmentListResults
to update its EphemerisForOverallTrajectory
(get
).
This must be true
if this segment needed to start at some point other than
at the end of the previous SegmentPropagator
. Otherwise leave this as false
.public final SegmentListResults getParentResults()
SegmentListResults
that contains the SegmentPropagator
that created these results. This gets set automatically by the SegmentListPropagator
that
propagated the SegmentPropagator
that made these results. It will be null
if the SegmentPropagator
that created this was not propagated in a SegmentListPropagator
.public final void setParentResults(SegmentListResults value)
SegmentListResults
that contains the SegmentPropagator
that created these results. This gets set automatically by the SegmentListPropagator
that
propagated the SegmentPropagator
that made these results. It will be null
if the SegmentPropagator
that created this was not propagated in a SegmentListPropagator
.@Nonnull public final IntegrationSense getPropagationDirection()
SegmentList
, this should
be the direction of the first SegmentPropagator
it is propagating.public boolean getSegmentCompletelyOverriddenByOverlappingSegment()
SegmentPropagator
after the one that made these results stepped back so
far that the EphemerisForOverallTrajectory
(get
) is empty. So if you have four
propagators
, and the fourth propagator
needs to back up all
the way to the first propagator
, this property should be set to
true
for the second and third set of results.public void setSegmentCompletelyOverriddenByOverlappingSegment(boolean value)
SegmentPropagator
after the one that made these results stepped back so
far that the EphemerisForOverallTrajectory
(get
) is empty. So if you have four
propagators
, and the fourth propagator
needs to back up all
the way to the first propagator
, this property should be set to
true
for the second and third set of results.public final boolean getStopAllPropagation()
public final void setStopAllPropagation(boolean value)
public final boolean getStopPropagationForCurrentSegmentList()
SegmentListPropagator
was told to
stop propagating its SegmentPropagators
but that propagation of anything after this propagator should continue.public final void setStopPropagationForCurrentSegmentList(boolean value)
SegmentListPropagator
was told to
stop propagating its SegmentPropagators
but that propagation of anything after this propagator should continue.public final boolean getCanceled()
public final void setCanceled(boolean value)
@Nonnull public final List<StateElementAdapter> getAdapters()
adapters
needed to transform the states of
this results to the next.@Nullable public final StateElementAdapter getAdapter(String elementIdentification)
elementIdentification
- The name of the element of the desired adapter.@Nonnull public final SegmentPropagator getPropagator()
SegmentPropagator
that was used to make this set of results.@Nonnull public static <T> DateMotionCollection1<T> getDateMotionCollection(String element, @Nonnull List<ITimeBasedState> ephemeris)
DateMotionCollection1
of the element
. The state type in the
ephemeris
must be ITimeBasedState
.
Note that this method will not make any attempt to transform the returned DateMotionCollection1
into
its defined-in ReferenceFrame
or Axes
. If the ephemeris
has
elements in different frames or axes, the returned collection will too.T
- The type (double
, Cartesian
...) that the element
is.element
- The element whose data you want.ephemeris
- The list of states
to extract the ephemeris
of element
from.DateMotionCollection1
of the element
.@Nonnull public static <T> ArrayList<Motion1<T>> getMotionCollection(String element, @Nonnull List<ITimeBasedState> states)
List
of the element
.T
- The type (double
, Cartesian
...) that the element
is.element
- The element whose data you want.states
- The list of states
to extract the states
of element
from.Motions{T}
of the element
from the states
.@Nonnull public final TimeInterval getTimeIntervalOfEntireComputedEphemeris()
@Nonnull public final TimeInterval getTimeIntervalOfEphemerisForOverallTrajectory()
public void cropEphemerisForOverallTrajectory(@Nonnull IntegrationSense overallDirection, @Nonnull TimeInterval interval)
EphemerisForOverallTrajectory
(get
) and fill it in with
the ephemeris from the EntireComputedEphemeris
(get
) that is in the interval
.
SegmentPropagators
that propagate multiple segments may
need to override this to properly crop its child segments (and it is likely that some segments will have
an empty EphemerisForOverallTrajectory
(get
)). This should not need to perform any
adaptation of the states involved; simply adjust the states in the EphemerisForOverallTrajectory
(get
).
For SegmentResults
that are made up of multiple segments, this must be called on each individual
segment before being called on the overall results.overallDirection
- The time direction of propagation.interval
- The interval that this segment should have data in its EphemerisForOverallTrajectory
(get
).@Nonnull public final List<Integer> indexOfStateWithDateFromEntireComputedEphemeris(@Nonnull JulianDate date)
EntireComputedEphemeris
(get
) at the specified date.date
- The date of interest.EntireComputedEphemeris
(get
).@Nonnull public final StateForNextSegmentBehavior getStateForNextSegmentBehavior()
SegmentPropagator
will pass
to the next segment.public final List<SegmentResults> getAdditionalSegmentResults()
SegmentResults
that this segment may have
propagated. For a SegmentList
this will be the child segments
it propagated. For segments that ran optional segments, they will be included
here. This list will not have this instance of the results in it.@Nullable public final SegmentResults getResultsOfSegment(SegmentDefinition segment)
SegmentResults
(get
) and return the
first results
that correspond with the segment
, or
null
if the requested segment's results are not found.
If you plan to use this method, it is recommended that you do not use the same SegmentDefinition
multiple times. This method will only ever give you the results of the first time that
segment
was propagated in SegmentList
that made this results.
segment
- The Identifier
(get
) of segment whose
results
will be returned.SegmentResults
, or null
if there are no
results
of the segment
.