## org.apache.commons.math.ode.events
Class CombinedEventsManager

    java.lang.Object
      org.apache.commons.math.ode.events.CombinedEventsManager

    public class CombinedEventsManager

extends java.lang.Object

This class manages several `event handlers` during integration.

Since:
  1.2
Version:
  $Revision: 786881 $ $Date: 2009-06-20 14:53:08 -0400 (Sat, 20 Jun 2009) $
See Also:
  `EventHandler`, `EventState`

Field Summary
`private EventState` `first` First active event.
`private boolean` `initialized` Initialization indicator.
`private java.util.List<EventState>` `states` Events states.

Constructor Summary
`CombinedEventsManager()` Simple constructor.

Method Summary
`void` `addEventHandler(EventHandler handler, double maxCheckInterval, double convergence, int maxIterationCount)` Add an events handler.
`void` `clearEventsHandlers()` Remove all the events handlers that have been added to the manager.
`boolean` `evaluateStep(StepInterpolator interpolator)` Evaluate the impact of the proposed step on all managed event handlers.
`java.util.Collection<EventHandler>` `getEventsHandlers()` Get all the events handlers that have been added to the manager.
`java.util.Collection<EventState>` `getEventsStates()` Get all the events state wrapping the handlers that have been added to the manager.
`double` `getEventTime()` Get the occurrence time of the first event triggered in the last evaluated step.
`boolean` `isEmpty()` Check if the manager does not manage any event handlers.
`boolean` `reset(double t, double[] y)` Let the event handlers reset the state if they want.
`void` `stepAccepted(double t, double[] y)` Inform the event handlers that the step has been accepted by the integrator.
`boolean` `stop()` Check if the integration should be stopped at the end of the current step.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### states

    private final java.util.List<EventState> states

  Events states.

### first

    private EventState first

  First active event.

### initialized

    private boolean initialized

  Initialization indicator.

Constructor Detail

### CombinedEventsManager

    public CombinedEventsManager()

  Simple constructor. Create an empty manager

Method Detail

### addEventHandler

    public void addEventHandler(EventHandler handler,
                                double maxCheckInterval,
                                double convergence,
                                int maxIterationCount)

  Add an events handler.

  Parameters:
    `handler` - event handler
    `maxCheckInterval` - maximal time interval between events checks (this interval prevents missing sign changes in case the integration steps becomes very large)
    `convergence` - convergence threshold in the event time search
    `maxIterationCount` - upper limit of the iteration count in the event time search
  See Also:
    `getEventsHandlers()`, `clearEventsHandlers()`

### getEventsHandlers

    public java.util.Collection<EventHandler> getEventsHandlers()

  Get all the events handlers that have been added to the manager.

  Returns:
    an unmodifiable collection of the added event handlers
  See Also:
    `addEventHandler(EventHandler, double, double, int)`, `clearEventsHandlers()`, `getEventsStates()`

### clearEventsHandlers

    public void clearEventsHandlers()

  Remove all the events handlers that have been added to the manager.

  See Also:
    `addEventHandler(EventHandler, double, double, int)`, `getEventsHandlers()`

### getEventsStates

    public java.util.Collection<EventState> getEventsStates()

  Get all the events state wrapping the handlers that have been added to the manager.

  Returns:
    a collection of the events states
  See Also:
    `getEventsHandlers()`

### isEmpty

    public boolean isEmpty()

  Check if the manager does not manage any event handlers.

  Returns:
    true if manager is empty

### evaluateStep

    public boolean evaluateStep(StepInterpolator interpolator)
                         throws DerivativeException,
                                IntegratorException

  Evaluate the impact of the proposed step on all managed event handlers.

  Parameters:
    `interpolator` - step interpolator for the proposed step
  Returns:
    true if at least one event handler triggers an event before the end of the proposed step (this implies the step should be rejected)
  Throws:
    `DerivativeException` - if the interpolator fails to compute the function somewhere within the step
    `IntegratorException` - if an event cannot be located

### getEventTime

    public double getEventTime()

  Get the occurrence time of the first event triggered in the last evaluated step.

  Returns:
    occurrence time of the first event triggered in the last evaluated step, or Double.NaN if no event is triggered

### stepAccepted

    public void stepAccepted(double t,
                             double[] y)
                      throws IntegratorException

  Inform the event handlers that the step has been accepted by the integrator.

  Parameters:
    `t` - value of the independent time variable at the end of the step
    `y` - array containing the current value of the state vector at the end of the step
  Throws:
    `IntegratorException` - if the value of one of the events states cannot be evaluated

### stop

    public boolean stop()

  Check if the integration should be stopped at the end of the current step.

  Returns:
    true if the integration should be stopped

### reset

    public boolean reset(double t,
                         double[] y)
                  throws IntegratorException

  Let the event handlers reset the state if they want.

  Parameters:
    `t` - value of the independent time variable at the beginning of the next step
    `y` - array were to put the desired state vector at the beginning of the next step
  Returns:
    true if the integrator should reset the derivatives too
  Throws:
    `IntegratorException` - if one of the events states that should reset the state fails to do it

Copyright (c) 2003-2010 Apache Software Foundation