public class SegmentListResults extends SegmentResults
SegmentResults
(get
) returned by a propagated SegmentList
.
Note that if your custom segment
can propagate multiple
segments
sequentially, it should return a
SegmentListResults
even if it ends up propagating a single segment.
Modifier | Constructor and Description |
---|---|
protected |
SegmentListResults(SegmentListResults existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
|
SegmentListResults(SegmentPropagator propagator)
Initializes a new instance.
|
|
SegmentListResults(SegmentPropagator propagator,
ITimeBasedState initialState)
Initializes a new instance.
|
|
SegmentListResults(SegmentPropagator propagator,
SegmentListResults results)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
void |
cropEphemerisForOverallTrajectory(IntegrationSense overallDirection,
TimeInterval interval)
|
static void |
generateOverallTrajectory(SegmentListResults segmentResults,
List<List<ITimeBasedState>> ephemerisOfChildSegments,
boolean actuallyAdapt)
|
<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. |
SegmentResults |
getFinalNestedSegmentResult()
Gets the results of final segment that was propagated that is not itself a
SegmentListResults . |
SegmentResults |
getFinalSegmentResult()
|
TimeIntervalCollection1<SegmentDefinition> |
getSegmentBoundaryTimes()
Returns the intervals of propagation of each
segment . |
List<SegmentResults> |
getSegmentResults()
|
boolean |
isSegmentContainedInThisList(SegmentDefinition segment)
Returns
true if the segment was propagated by the
SegmentPropagator that produced this list of SegmentResults (get ). |
ITimeBasedState |
propagateToAssumingTimeBasedStates(JulianDate dateToGetExactStateAt,
SegmentResults currentSegmentResult,
SegmentListResults currentOverallResults)
When a
SegmentPropagator needs to go back and start at a point before the end of the
previous segment, this method can be used to get that exact state to start at. |
void |
regenerateEphemerisForOverallTrajectory()
Regenerates the ephemeris for this.
|
addEphemerisPoint, getAdapter, getAdapters, getAdditionalSegmentResults, getCanceled, getConfiguration, getDateMotionCollection, getEntireComputedEphemeris, getEphemerisForOverallTrajectory, getFinalPropagatedState, getFirstPropagatedState, getIdentifiers, getInitialState, getIsThreadSafe, getMotionCollection, getMotionCollection, getOverrideSegmentListEphemeris, getParentResults, getPropagationDirection, getPropagator, getResultsOfSegment, getSegmentCompletelyOverriddenByOverlappingSegment, getSegmentIdentifier, getSegmentOverrideStartsIn, getStateForNextSegment, getStateForNextSegmentBehavior, getStopAllPropagation, getStopPropagationForCurrentSegmentList, getTimeIntervalOfEntireComputedEphemeris, getTimeIntervalOfEphemerisForOverallTrajectory, indexOfStateWithDateFromEntireComputedEphemeris, setCanceled, setConfiguration, setElementDefinedIn, setInitialState, setOverrideSegmentListEphemeris, setParentResults, setSegmentCompletelyOverriddenByOverlappingSegment, setSegmentOverrideStartsIn, setStopAllPropagation, setStopPropagationForCurrentSegmentList
public SegmentListResults(@Nonnull SegmentPropagator propagator, @Nonnull SegmentListResults results)
propagator
- The SegmentPropagator
that is generating these results.results
- The results where the segment results and base results will be extracted from.public SegmentListResults(@Nonnull SegmentPropagator propagator)
propagator
- The SegmentPropagator
that is generating these results.public SegmentListResults(@Nonnull SegmentPropagator propagator, ITimeBasedState initialState)
propagator
- The SegmentPropagator
that is generating these results.initialState
- The initial state that the overall SegmentList
will be propagated from.protected SegmentListResults(@Nonnull SegmentListResults 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
clone
in class SegmentResults
context
- The context to use to perform the copy.public final TimeIntervalCollection1<SegmentDefinition> getSegmentBoundaryTimes()
segment
.
Segments
that are instantaneous will have their start
and stop times be equal to each other.segment
.public ITimeBasedState propagateToAssumingTimeBasedStates(@Nonnull JulianDate dateToGetExactStateAt, SegmentResults currentSegmentResult, SegmentListResults currentOverallResults)
SegmentPropagator
needs to go back and start at a point before the end of the
previous segment, this method can be used to get that exact state to start at. This will adapt
the state
such that it is in the defined-ins of the segment right before the current segment. This method will take
care of setting all of the nested segments EphemerisForOverallTrajectory
(get
) properly.dateToGetExactStateAt
- The JulianDate
that you need to start propagating from.currentSegmentResult
- The SegmentResults
(get
) of the current segment that needs to start somewhere in the
SegmentResults
(get
) of a previous SegmentPropagator
. This must include the fully configured
adapters
.currentOverallResults
- The SegmentListResults
to search through. This should
be the cumulative results passed into the current segments propagate method.state
at the dateToGetExactStateAt
.public void regenerateEphemerisForOverallTrajectory()
EphemerisForOverallTrajectory
(get
) will
get rebuilt for this and all child segments. The states in this SegmentList
will be adapted to the final stored segment in this.public Object getElementDefinedIn(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.getElementDefinedIn
in class SegmentResults
element
- The element whose defined-in object is requested.Axes
, ReferenceFrame
, or Object
that the element
is represented in.public static void generateOverallTrajectory(SegmentListResults segmentResults, List<List<ITimeBasedState>> ephemerisOfChildSegments, boolean actuallyAdapt)
EphemerisForOverallTrajectory
(get
) of all of this
SegmentResults
(get
). This should be called right before this is returned to the parent segment
or user, or when a segment had to change the results of previous segment's
EphemerisForOverallTrajectory
(get
). This method will properly
adapt
all of the child SegmentResults
(get
) to the proper defined in objects of the
SegmentListPropagator
that made these results.segmentResults
- The results that the ephemerisOfChildSegments
belongs to.ephemerisOfChildSegments
- The set of ephemeris made from the child segments of the segmentResults
actuallyAdapt
- Should the ephemerisOfChildSegments
get adapted to the final defined-in objects of the segmentResults
.public void cropEphemerisForOverallTrajectory(@Nonnull IntegrationSense overallDirection, 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.cropEphemerisForOverallTrajectory
in class SegmentResults
overallDirection
- The time direction of propagation.interval
- The interval that this segment should have data in its EphemerisForOverallTrajectory
(get
).public SegmentResults getFinalSegmentResult()
public final SegmentResults getFinalNestedSegmentResult()
SegmentListResults
.public final List<SegmentResults> getSegmentResults()
public <T> DateMotionCollection1<T> getDateMotionCollectionOfOverallTrajectory(String element)
DateMotionCollection1
of the element
from the
EphemerisForOverallTrajectory
(get
).
Note that this will return the ephemeris from the
EphemerisForOverallTrajectory
(get
) of every stored
SegmentResults
(get
) making no attempt at transforming them into the same ReferenceFrame
or Axes
. If the element
happened to be propagated in different defined in objects, you
must either call SegmentListResults.getDateMotionCollectionOfOverallTrajectory(java.lang.String)
if a Point
was propagated,
or handle the transformations yourself.getDateMotionCollectionOfOverallTrajectory
in class SegmentResults
T
- The type (double
, Cartesian
...) that the
element
is.element
- The state element of interest.DateMotionCollection1
of the element
.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
.getDateMotionCollectionOfOverallTrajectory
in class SegmentResults
element
- The element whose data you want.frame
- The ReferenceFrame
that you want the returned collection in.DateMotionCollection1
of the element
.public final boolean isSegmentContainedInThisList(SegmentDefinition segment)
true
if the segment
was propagated by the
SegmentPropagator
that produced this list of SegmentResults
(get
). Be aware
that it will return true
once it finds the first SegmentPropagator
made with the matching segment
.segment
- The SegmentDefinition
to check this SegmentListResults
for.true
if the segment
was propagated by
the propagator
that produced this results; otherwise false
.