cz.cuni.amis.pogamut.base.communication.worldview.event
Class WorldEventFuture<T extends IWorldEvent>

Package class diagram package WorldEventFuture
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.communication.worldview.event.WorldEventFuture<T>
All Implemented Interfaces:
Future<T>

public class WorldEventFuture<T extends IWorldEvent>
extends Object
implements Future<T>

Use this if you want to wait for first appearance of some IWorldObject with known string ID.

Author:
ik

Nested Class Summary
static class WorldEventFuture.WorldEventFutureException
           
 
Constructor Summary
WorldEventFuture(IWorldView worldView, Class<T> eventClass)
          Creates new instance of future that waits for the event of given class.
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
protected  void customEventEncounteredHook(T obj)
          Utility method for custom handling of the first-encounter event.
 T get()
           
 T get(long timeout, TimeUnit unit)
           
 boolean isCancelled()
           
 boolean isDone()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorldEventFuture

public WorldEventFuture(IWorldView worldView,
                        Class<T> eventClass)
Creates new instance of future that waits for the event of given class.

Parameters:
worldView - WorldView where the object will appear
eventClass - class of the event we're waiting for
Method Detail

customEventEncounteredHook

protected void customEventEncounteredHook(T obj)
Utility method for custom handling of the first-encounter event.

Parameters:
obj -

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface Future<T extends IWorldEvent>

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<T extends IWorldEvent>

isDone

public boolean isDone()
Specified by:
isDone in interface Future<T extends IWorldEvent>

get

public T get()
Specified by:
get in interface Future<T extends IWorldEvent>
Returns:
the object that was awaited
Throws:
InterruptedException
ExecutionException

get

public T get(long timeout,
             TimeUnit unit)
Specified by:
get in interface Future<T extends IWorldEvent>


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.