cz.cuni.amis.utils.future
Class CombinedBooleanFuture

Package class diagram package CombinedBooleanFuture
java.lang.Object
  extended by cz.cuni.amis.utils.future.CombinedBooleanFuture
All Implemented Interfaces:
IFuture<Boolean>, Future<Boolean>

public class CombinedBooleanFuture
extends Object
implements IFuture<Boolean>

Used to combine multiple Future<Boolean> together into one Future<Boolean>.

During construction of the instance of this class you have to specify an array of booleans you want to combine - then all methods will wait for all futures to end (e.g. get(), etc.).

Note that you will probably want to use getAll() method to get respective Future results.

Author:
Jimmy

Constructor Summary
CombinedBooleanFuture(IFuture<Boolean>[] futures)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
 Boolean get()
          Waits if necessary for the computation to complete, and then retrieves its result.
 Boolean get(long timeout, TimeUnit unit)
          Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
 Boolean[] getAll(long timeout, TimeUnit unit)
           
 Future<Boolean>[] getFutures()
           
 boolean isCancelled()
           
 boolean isDone()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinedBooleanFuture

public CombinedBooleanFuture(IFuture<Boolean>[] futures)
Method Detail

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface Future<Boolean>

get

public Boolean get()
Description copied from interface: IFuture
Waits if necessary for the computation to complete, and then retrieves its result.

Specified by:
get in interface IFuture<Boolean>
Specified by:
get in interface Future<Boolean>
Returns:
the computed result

get

public Boolean get(long timeout,
                   TimeUnit unit)
Description copied from interface: IFuture
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.

Specified by:
get in interface IFuture<Boolean>
Specified by:
get in interface Future<Boolean>
Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Returns:
the computed result

getAll

public Boolean[] getAll(long timeout,
                        TimeUnit unit)

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<Boolean>

isDone

public boolean isDone()
Specified by:
isDone in interface Future<Boolean>

getFutures

public Future<Boolean>[] getFutures()


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