public abstract class StoppablePropagatorDefinition extends DefinitionalObject
StoppingCondition
. This type is intended to work by wrapping
some other propagator and generate states until a StoppingCondition
is tripped.Modifier | Constructor and Description |
---|---|
protected |
StoppablePropagatorDefinition()
Initializes a new instance.
|
protected |
StoppablePropagatorDefinition(StoppablePropagatorDefinition existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnyConditionSatisfied(EventHandler<StoppingConditionEventFoundEventArgs> value)
Adds a handler for an event that is raised when any of the
StoppingConditions are satisfied. |
protected boolean |
checkForSameDefinition(DefinitionalObject other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected boolean |
checkForSameDefinition(StoppablePropagatorDefinition other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected int |
computeCurrentDefinitionHashCode()
Computes a hash code based on the current properties of this object.
|
boolean |
containsAdapter(String elementIdentification)
Checks if there is a
StateElementAdapter stored in this definition for elementIdentification . |
void |
enumerateDependencies(DependencyEnumerator enumerator)
Enumerates the dependencies of this object by calling
DependencyEnumerator#enumerate(T) for each object that this object directly depends upon. |
protected void |
freezeAggregatedObjects()
Called by
DefinitionalObject.freeze() to also freeze any objects that are considered to be a part of this object. |
StateElementAdapterDefinition |
getAdapter(String elementIdentification)
Gets the
StateElementAdapter stored in this definition for elementIdentification . |
ArrayList<StateElementAdapterDefinition> |
getAllAdapters()
Gets all of the
StateElementAdapters that have
been registered with this propagator. |
ValueDefinition<IntegrationSense> |
getDirection()
Gets a value that will, at run time, report the current direction of propagation of the
StoppablePropagator . |
StoppablePropagator |
getStoppablePropagator()
Creates and initialize the actual
StoppablePropagator . |
StoppablePropagator |
getStoppablePropagator(EvaluatorGroup group)
Creates and initialize the actual
StoppablePropagator . |
abstract StoppablePropagator |
getStoppablePropagator(EvaluatorGroup group,
List<StateElementAdapterDefinition> previousAdapters)
Creates and initialize the actual
StoppablePropagator . |
List<StoppingCondition> |
getStoppingConditions()
Gets the list of
StoppingConditions that will
find events and dictate when propagation should end. |
Duration |
getTimeTolerance()
Gets the tolerance in seconds that the
StoppablePropagator will use to
say that a StoppingCondition converged on time. |
void |
onAnyConditionSatisfied(StoppingConditionEventFoundEventArgs eventArgs)
Called when any of the
StoppingConditions are satisfied. |
boolean |
removeAdapter(String elementIdentification)
Removes the
StateElementAdapter stored in this definition for elementIdentification . |
void |
removeAnyConditionSatisfied(EventHandler<StoppingConditionEventFoundEventArgs> value)
Removes a handler for an event that is raised when any of the
StoppingConditions are satisfied. |
void |
setAdapter(StateElementAdapterDefinition adapter)
Adds a
StateElementAdapter to this propagator. |
void |
setTimeTolerance(Duration value)
Sets the tolerance in seconds that the
StoppablePropagator will use to
say that a StoppingCondition converged on time. |
areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, clone, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, dictionaryItemsAreSameDefinition, freeze, getCollectionHashCode, getCollectionHashCode, getCollectionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDictionaryHashCode, getIsFrozen, isSameDefinition, throwIfFrozen
protected StoppablePropagatorDefinition()
protected StoppablePropagatorDefinition(@Nonnull StoppablePropagatorDefinition 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
.protected final boolean checkForSameDefinition(DefinitionalObject other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.checkForSameDefinition
in class DefinitionalObject
other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected boolean checkForSameDefinition(StoppablePropagatorDefinition other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected int computeCurrentDefinitionHashCode()
StoppablePropagatorDefinition.checkForSameDefinition(agi.foundation.infrastructure.DefinitionalObject)
method.computeCurrentDefinitionHashCode
in class DefinitionalObject
public void enumerateDependencies(DependencyEnumerator enumerator)
DependencyEnumerator#enumerate(T)
for each object that this object directly depends upon.
Derived classes which contain additional dependencies MUST override this method, call the base
implementation, and enumerate dependencies introduced by the derived class.enumerateDependencies
in interface IEnumerateDependencies
enumerateDependencies
in class DefinitionalObject
enumerator
- The enumerator that is informed of the dependencies of this object.protected void freezeAggregatedObjects()
DefinitionalObject.freeze()
to also freeze any objects that are considered to be a part of this object.
Derived classes which contain additional aggregated objects MUST override this method, call the base
implementation, and freeze aggregated objects introduced by the derived class. The objects that need to be
frozen in this method are frequently created in this object's constructor and are not settable via
properties.freezeAggregatedObjects
in class DefinitionalObject
@Nonnull public final List<StoppingCondition> getStoppingConditions()
StoppingConditions
that will
find events and dictate when propagation should end.@Nonnull public final StoppablePropagator getStoppablePropagator(@Nonnull EvaluatorGroup group)
StoppablePropagator
.
It is assume that the Adapters
(get
)
are either not needed or are fully configured with any current and previous
objects set.group
- The group
to use to initialize any
evaluators
that will be used.propagator
for this
StoppablePropagatorDefinition
.@Nonnull public abstract StoppablePropagator getStoppablePropagator(@Nonnull EvaluatorGroup group, @Nonnull List<StateElementAdapterDefinition> previousAdapters)
StoppablePropagator
.group
- The group
to use to initialize any
evaluators
that will be used.previousAdapters
- The previous adapters to use to configure this propagators adapters.propagator
for this
StoppablePropagatorDefinition
.@Nonnull public final StoppablePropagator getStoppablePropagator()
StoppablePropagator
.
It is assume that the Adapters
(get
)
are either not needed or are fully configured with any current and previous
objects set.propagator
for this
StoppablePropagatorDefinition
.public void setAdapter(@Nonnull StateElementAdapterDefinition adapter)
StateElementAdapter
to this propagator.adapter
- The actual StateElementAdapter
.public boolean containsAdapter(@Nonnull String elementIdentification)
StateElementAdapter
stored in this definition for elementIdentification
.elementIdentification
- The identification of the element whose adapter will be checked.true
if there is an adapter for the specified element stored in this definition; otherwise false
.ArgumentNullException
- Thrown when elementIdentification
is null
.@Nullable public StateElementAdapterDefinition getAdapter(@Nonnull String elementIdentification)
StateElementAdapter
stored in this definition for elementIdentification
.elementIdentification
- The identification of the element whose adapter will be retrieved.elementIdentification
, or null
.ArgumentNullException
- Thrown when elementIdentification
is null
.public boolean removeAdapter(@Nonnull String elementIdentification)
StateElementAdapter
stored in this definition for elementIdentification
.elementIdentification
- The identification of the element whose adapter will be removed.true
if the adapter was removed successfully; otherwise false
.ArgumentNullException
- Thrown when elementIdentification
is null
.@Nonnull public ArrayList<StateElementAdapterDefinition> getAllAdapters()
StateElementAdapters
that have
been registered with this propagator.StateElementAdapters
that have
been registered with this propagator.@Nonnull public final Duration getTimeTolerance()
StoppablePropagator
will use to
say that a StoppingCondition
converged on time. When the propagator
is trying to find the exact event, if the time between dates is equal to or less than this span,
it will say that the StoppingCondition
has converged even if the
FunctionTolerance
(get
/ set
) has not been satisfied. This value is optional,
with a default of Zero
(get
). The value must be positive. If the value is
specified, then stopping conditions
can converge to events if
either the function tolerance or this time tolerance is satisfied.public final void setTimeTolerance(@Nonnull Duration value)
StoppablePropagator
will use to
say that a StoppingCondition
converged on time. When the propagator
is trying to find the exact event, if the time between dates is equal to or less than this span,
it will say that the StoppingCondition
has converged even if the
FunctionTolerance
(get
/ set
) has not been satisfied. This value is optional,
with a default of Zero
(get
). The value must be positive. If the value is
specified, then stopping conditions
can converge to events if
either the function tolerance or this time tolerance is satisfied.public final void addAnyConditionSatisfied(EventHandler<StoppingConditionEventFoundEventArgs> value)
StoppingConditions
are satisfied.value
- The handler.public final void removeAnyConditionSatisfied(EventHandler<StoppingConditionEventFoundEventArgs> value)
StoppingConditions
are satisfied.value
- The handler.@Nonnull public final ValueDefinition<IntegrationSense> getDirection()
StoppablePropagator
.public final void onAnyConditionSatisfied(StoppingConditionEventFoundEventArgs eventArgs)
StoppingConditions
are satisfied.eventArgs
- The object containing information about the stopping condition that was satisfied.