org.rosuda.javaGD
Class LocatorSync

java.lang.Object
  extended by org.rosuda.javaGD.LocatorSync

public class LocatorSync
extends java.lang.Object

a simple synchronization class that can be used by a separate thread to wake JavaGD from waiting for a locator result. The waiting thread calls waitForAction() which returns only after another thread calls triggerAction(double[]).


Constructor Summary
LocatorSync()
           
 
Method Summary
 void triggerAction(double[] result)
          this methods awakens waitForAction().
 double[] waitForAction()
          this internal method waits until triggerAction(double[]) is called by another thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocatorSync

public LocatorSync()
Method Detail

waitForAction

public double[] waitForAction()
this internal method waits until triggerAction(double[]) is called by another thread. It is implemented by using Object.wait() and checking notificationArrived.

Returns:
result supplied when triggerAction(double[]) was called - essentially the retuls to be returned by locator

triggerAction

public void triggerAction(double[] result)
this methods awakens waitForAction(). It is implemented by setting notificationArrived to true, setting locResult to the passed result and finally calling Object.notifyAll().

Parameters:
result - result to pass to waitForAction()