/** * Updates all internal monitors to detect changes in transitions and call all registered event * handlers. */ public void update() { removeTransitionMonitorProcessors.clear(); for (int i = 0; i < transitionMonitorProcessors.size(); i++) { TransitionMonitorProcessor transitionMonitorProcessor = transitionMonitorProcessors.get(i); transitionMonitorProcessor.update(); if (transitionMonitorProcessor.isFinished()) { monitorProcessorPool.free(transitionMonitorProcessor); removeTransitionMonitorProcessors.add(transitionMonitorProcessor); } } for (int i = 0; i < removeTransitionMonitorProcessors.size(); i++) transitionMonitorProcessors.remove(removeTransitionMonitorProcessors.get(i)); }
/** * Monitors the Transition and calls the TransitionEventHandler whenever the Transition changes * its state. * * @param transition The Transition to be monitored. * @param transitionEventHandler The TransitionEventHandler to be called when changes were * detected. */ @SuppressWarnings("rawtypes") public void handle(Transition transition, TransitionEventHandler transitionEventHandler) { TransitionMonitorProcessor transitionMonitorProcessor = monitorProcessorPool.newObject(); transitionMonitorProcessor.process(transition, transitionEventHandler); transitionMonitorProcessors.add(transitionMonitorProcessor); }