added a way to retrieve the meta-data associated with event handlers

(max iteration count, convergence, check interval)

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_0@673752 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2008-07-03 18:29:32 +00:00
parent 84e30a013d
commit 3fdd549c50
2 changed files with 33 additions and 3 deletions

View File

@ -73,13 +73,14 @@ public class CombinedEventsManager implements Serializable {
public void addEventHandler(final EventHandler handler, final double maxCheckInterval,
final double convergence, final int maxIterationCount) {
states.add(new EventState(handler, maxCheckInterval,
convergence, maxIterationCount));
convergence, maxIterationCount));
}
/** Get all the events handlers that have been added to the manager.
* @return an unmodifiable collection of the added event handlers
* @see #addEventHandler(EventHandler, double, double, int)
* @see #clearEventsHandlers()
* @see #getEventStates()
*/
public Collection<EventHandler> getEventsHandlers() {
final List<EventHandler> list = new ArrayList<EventHandler>();
@ -97,6 +98,14 @@ public class CombinedEventsManager implements Serializable {
states.clear();
}
/** Get all the events state wrapping the handlers that have been added to the manager.
* @return a collection of the events states
* @see #getEventHandlers()
*/
public Collection<EventState> getEventsStates() {
return states;
}
/** Check if the manager does not manage any event handlers.
* @return true if manager is empty
*/

View File

@ -41,10 +41,10 @@ import org.apache.commons.math.ode.sampling.StepInterpolator;
* @version $Revision$ $Date$
* @since 1.2
*/
class EventState implements Serializable {
public class EventState implements Serializable {
/** Serializable version identifier. */
private static final long serialVersionUID = -7307007422156119622L;
private static final long serialVersionUID = -216176055159247559L;
/** Event handler. */
private final EventHandler handler;
@ -119,6 +119,27 @@ class EventState implements Serializable {
return handler;
}
/** Get the maximal time interval between events handler checks.
* @return maximal time interval between events handler checks
*/
public double getMaxCheckInterval() {
return maxCheckInterval;
}
/** Get the convergence threshold for event localization.
* @return convergence threshold for event localization
*/
public double getConvergence() {
return convergence;
}
/** Get the upper limit in the iteration count for event localization.
* @return upper limit in the iteration count for event localization
*/
public int getMaxIterationCount() {
return maxIterationCount;
}
/** Reinitialize the beginning of the step.
* @param t0 value of the independent <i>time</i> variable at the
* beginning of the step