Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.util
Class ControllerTracker

java.lang.Object
  extended by ch.randelshofer.util.ControllerTracker
All Implemented Interfaces:
javax.media.ControllerListener

public class ControllerTracker
extends java.lang.Object
implements javax.media.ControllerListener

Tracks state changes in a Java Media Framework Controller.

Version:
1.1 2004-12-26 Method waitForState returns immediately, if the Controller is in unrealized state. This is to prevent a livelock on the Controller.
1.0 1999-10-19
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland

Field Summary
static int STATE_NOT_REACHED
           
 
Constructor Summary
ControllerTracker(javax.media.Controller model)
          Creates a ControllerTracker for the indicated Controller.
 
Method Summary
 void controllerUpdate(javax.media.ControllerEvent event)
          XXX This method is public as an implementation side effect.
 java.lang.String getMessage()
           
 void setController(javax.media.Controller model)
          Sets the Controller.
 int waitForState(int state)
          Waits until the Controller reaches the indicated state.
 int waitForState(int[] states)
          Waits until the Controller reaches one of the indicated states.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_NOT_REACHED

public static final int STATE_NOT_REACHED
See Also:
Constant Field Values
Constructor Detail

ControllerTracker

public ControllerTracker(javax.media.Controller model)
Creates a ControllerTracker for the indicated Controller.

Parameters:
model - Controller to be tracked.
Method Detail

setController

public void setController(javax.media.Controller model)
Sets the Controller. Note: This method must not be called while one of the waitForState methods is working.

Parameters:
model - The Controller to be tracked.

getMessage

public java.lang.String getMessage()

waitForState

public int waitForState(int state)
Waits until the Controller reaches the indicated state. Note: waitForState methods may not be called from multiple threads simoultaneously.

Parameters:
state - to wait for.

waitForState

public int waitForState(int[] states)
Waits until the Controller reaches one of the indicated states. Note: waitForState methods may not be called from multiple threads simoultaneously.

Parameters:
states - choice of states to wait for.
Returns:
The state or STATE_NOT_REACHED if the controller is closed.

controllerUpdate

public void controllerUpdate(javax.media.ControllerEvent event)
XXX This method is public as an implementation side effect. " Do not call or override.

Specified by:
controllerUpdate in interface javax.media.ControllerListener

Copyright 2012-02-25 Werner Randelshofer