com.trolltech.qt.core
Class QtConcurrent

java.lang.Object
  extended by com.trolltech.qt.core.QtConcurrent

public class QtConcurrent
extends java.lang.Object


Nested Class Summary
static interface QtConcurrent.FilteredFunctor
          An implementation of this interface is given to one of QtConcurrent's filtered() methods.
static interface QtConcurrent.MapFunctor
          An implemetation of this interface is given one to QtConcurrent's map() methods.
static interface QtConcurrent.MappedFunctor
          Implement this interface to perform a mapped operation.
static interface QtConcurrent.ReducedFunctor
          Implement this interface in order to perform a reduce operation.
static class QtConcurrent.ReduceOption
           
static class QtConcurrent.ReduceOptions
           
static class QtConcurrent.ThreadFunctionResult
           
 
Constructor Summary
QtConcurrent()
           
 
Method Summary
static java.util.List blockingFiltered(java.util.Collection sequence, QtConcurrent.FilteredFunctor filteredFunctor)
          Calls filterFunctor's filtered() method once for each item in sequence and returns a new Sequence of kept items.
static java.lang.Object blockingFilteredReduced(java.util.Collection sequence, QtConcurrent.FilteredFunctor filteredFunctor, QtConcurrent.ReducedFunctor reducedFunctor)
          This is an overloaded method provided for convenience.
static java.lang.Object blockingFilteredReduced(java.util.Collection sequence, QtConcurrent.FilteredFunctor filteredFunctor, QtConcurrent.ReducedFunctor reducedFunctor, QtConcurrent.ReduceOption[] options)
          Calls filterFunction once for each item in sequence.
static java.lang.Object blockingFilteredReduced(java.util.Collection sequence, QtConcurrent.FilteredFunctor filteredFunctor, QtConcurrent.ReducedFunctor reducedFunctor, QtConcurrent.ReduceOptions options)
          Calls filterFunction once for each item in sequence.
static void blockingMap(java.util.Collection sequence, QtConcurrent.MapFunctor functor)
          Calls function once for each item in sequence.
static java.util.List blockingMapped(java.util.Collection sequence, QtConcurrent.MappedFunctor functor)
          Calls function once for each item in sequence and returns a future with each mapped item as a result.
static java.lang.Object blockingMappedReduced(java.util.Collection sequence, QtConcurrent.MappedFunctor functor, QtConcurrent.ReducedFunctor reducedFunctor)
          This is an overloaded method provided for convenience.
static java.lang.Object blockingMappedReduced(java.util.Collection sequence, QtConcurrent.MappedFunctor functor, QtConcurrent.ReducedFunctor reducedFunctor, QtConcurrent.ReduceOption[] options)
          Calls mapFunction once for each item in sequence.
static java.lang.Object blockingMappedReduced(java.util.Collection sequence, QtConcurrent.MappedFunctor functor, QtConcurrent.ReducedFunctor reducedFunctor, QtConcurrent.ReduceOptions options)
          Calls mapFunction once for each item in sequence.
static QFuture filtered(java.util.Collection sequence, QtConcurrent.FilteredFunctor filteredFunctor)
          Calls filterFunctor's filtered() method once for each item in sequence and returns a new Sequence of kept items.
static QFuture filteredReduced(java.util.Collection sequence, QtConcurrent.FilteredFunctor filteredFunctor, QtConcurrent.ReducedFunctor reducedFunctor)
          This is an overloaded method provided for convenience.
static QFuture filteredReduced(java.util.Collection sequence, QtConcurrent.FilteredFunctor filteredFunctor, QtConcurrent.ReducedFunctor reducedFunctor, QtConcurrent.ReduceOption[] options)
          Calls filterFunction once for each item in sequence.
static QFuture filteredReduced(java.util.Collection sequence, QtConcurrent.FilteredFunctor filteredFunctor, QtConcurrent.ReducedFunctor reducedFunctor, QtConcurrent.ReduceOptions options)
          Calls filterFunction once for each item in sequence.
static QFutureVoid map(java.util.Collection sequence, QtConcurrent.MapFunctor functor)
          Calls function once for each item in sequence.
static QFuture mapped(java.util.Collection sequence, QtConcurrent.MappedFunctor functor)
          Calls function once for each item in sequence and returns a future with each mapped item as a result.
static QFuture mappedReduced(java.util.Collection sequence, QtConcurrent.MappedFunctor functor, QtConcurrent.ReducedFunctor reducedFunctor)
          This is an overloaded method provided for convenience.
static QFuture mappedReduced(java.util.Collection sequence, QtConcurrent.MappedFunctor functor, QtConcurrent.ReducedFunctor reducedFunctor, QtConcurrent.ReduceOption[] options)
          This is an overloaded method provided for convenience.
static QFuture mappedReduced(java.util.Collection sequence, QtConcurrent.MappedFunctor functor, QtConcurrent.ReducedFunctor reducedFunctor, QtConcurrent.ReduceOptions options)
          Calls mapFunction once for each item in sequence.
static QFuture run(java.lang.Object _this, java.lang.reflect.Method m, java.lang.Object[] args)
          Executes the method m through the QtConcurrent framework with the given arguments.
static QFutureVoid runVoidMethod(java.lang.Object _this, java.lang.reflect.Method m, java.lang.Object[] args)
          Executes the method m with the given arguments using the QtConcurrent framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QtConcurrent

public QtConcurrent()
Method Detail

map

public static QFutureVoid map(java.util.Collection sequence,
                              QtConcurrent.MapFunctor functor)
Calls function once for each item in sequence. The function is passed a reference to the item, so that any modifications done to the item will appear in sequence.


blockingMap

public static void blockingMap(java.util.Collection sequence,
                               QtConcurrent.MapFunctor functor)
Calls function once for each item in sequence. The function is passed a reference to the item, so that any modifications done to the item will appear in sequence.


mapped

public static QFuture mapped(java.util.Collection sequence,
                             QtConcurrent.MappedFunctor functor)
Calls function once for each item in sequence and returns a future with each mapped item as a result. You can QFutureIterator to iterate through the results.


blockingMapped

public static java.util.List blockingMapped(java.util.Collection sequence,
                                            QtConcurrent.MappedFunctor functor)
Calls function once for each item in sequence and returns a future with each mapped item as a result. You can QFutureIterator to iterate through the results.


mappedReduced

public static QFuture mappedReduced(java.util.Collection sequence,
                                    QtConcurrent.MappedFunctor functor,
                                    QtConcurrent.ReducedFunctor reducedFunctor)
This is an overloaded method provided for convenience.

It is equivalent of mappedReduced(sequence, functor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce)


mappedReduced

public static QFuture mappedReduced(java.util.Collection sequence,
                                    QtConcurrent.MappedFunctor functor,
                                    QtConcurrent.ReducedFunctor reducedFunctor,
                                    QtConcurrent.ReduceOption[] options)
This is an overloaded method provided for convenience.

Note that while mapFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is determined by reduceOptions.


mappedReduced

public static QFuture mappedReduced(java.util.Collection sequence,
                                    QtConcurrent.MappedFunctor functor,
                                    QtConcurrent.ReducedFunctor reducedFunctor,
                                    QtConcurrent.ReduceOptions options)
Calls mapFunction once for each item in sequence. The return value of each mapFunction is passed to reduceFunction.

Note that while mapFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is determined by reduceOptions.


blockingMappedReduced

public static java.lang.Object blockingMappedReduced(java.util.Collection sequence,
                                                     QtConcurrent.MappedFunctor functor,
                                                     QtConcurrent.ReducedFunctor reducedFunctor)
This is an overloaded method provided for convenience.

It is equivalent of calling blockingMappedReduced(sequence, functor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce)


blockingMappedReduced

public static java.lang.Object blockingMappedReduced(java.util.Collection sequence,
                                                     QtConcurrent.MappedFunctor functor,
                                                     QtConcurrent.ReducedFunctor reducedFunctor,
                                                     QtConcurrent.ReduceOption[] options)
Calls mapFunction once for each item in sequence. The return value of each mapFunction is passed to reduceFunction.

Note that while mapFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is determined by reduceOptions.

Note: This function will block until all items in the sequence have been processed.


blockingMappedReduced

public static java.lang.Object blockingMappedReduced(java.util.Collection sequence,
                                                     QtConcurrent.MappedFunctor functor,
                                                     QtConcurrent.ReducedFunctor reducedFunctor,
                                                     QtConcurrent.ReduceOptions options)
Calls mapFunction once for each item in sequence. The return value of each mapFunction is passed to reduceFunction.

Note that while mapFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is determined by reduceOptions.

Note: This function will block until all items in the sequence have been processed.


filtered

public static QFuture filtered(java.util.Collection sequence,
                               QtConcurrent.FilteredFunctor filteredFunctor)
Calls filterFunctor's filtered() method once for each item in sequence and returns a new Sequence of kept items. If filterFunction returns true, a copy of the item is put in the new Sequence. Otherwise, the item will not appear in the new Sequence.


blockingFiltered

public static java.util.List blockingFiltered(java.util.Collection sequence,
                                              QtConcurrent.FilteredFunctor filteredFunctor)
Calls filterFunctor's filtered() method once for each item in sequence and returns a new Sequence of kept items. If filterFunction returns true, a copy of the item is put in the new Sequence. Otherwise, the item will not appear in the new Sequence.


filteredReduced

public static QFuture filteredReduced(java.util.Collection sequence,
                                      QtConcurrent.FilteredFunctor filteredFunctor,
                                      QtConcurrent.ReducedFunctor reducedFunctor)
This is an overloaded method provided for convenience. It is equivalent of calling filteredReduced(sequence, filteredFunctor, ReduceOption.UnorderedReduce, ReduceOption.Seq This is an overloaded method provided for convenience. It is equivalent of calling filteredReduced)


filteredReduced

public static QFuture filteredReduced(java.util.Collection sequence,
                                      QtConcurrent.FilteredFunctor filteredFunctor,
                                      QtConcurrent.ReducedFunctor reducedFunctor,
                                      QtConcurrent.ReduceOption[] options)
Calls filterFunction once for each item in sequence. If filterFunction returns true for an item, that item is then passed to reduceFunction. In other words, the return value is the result of reduceFunction for each item where filterFunction returns true.

Note that while filterFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is undefined if reduceOptions is QtConcurrent::UnorderedReduce. If reduceOptions is QtConcurrent::OrderedReduce, reduceFunction is called in the order of the original sequence.


filteredReduced

public static QFuture filteredReduced(java.util.Collection sequence,
                                      QtConcurrent.FilteredFunctor filteredFunctor,
                                      QtConcurrent.ReducedFunctor reducedFunctor,
                                      QtConcurrent.ReduceOptions options)
Calls filterFunction once for each item in sequence. If filterFunction returns true for an item, that item is then passed to reduceFunction. In other words, the return value is the result of reduceFunction for each item where filterFunction returns true.

Note that while filterFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is undefined if reduceOptions is QtConcurrent::UnorderedReduce. If reduceOptions is QtConcurrent::OrderedReduce, reduceFunction is called in the order of the original sequence.


blockingFilteredReduced

public static java.lang.Object blockingFilteredReduced(java.util.Collection sequence,
                                                       QtConcurrent.FilteredFunctor filteredFunctor,
                                                       QtConcurrent.ReducedFunctor reducedFunctor)
This is an overloaded method provided for convenience. It is the equivalent of calling blockingFilteredReduced(sequence, filteredFunctor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce)


blockingFilteredReduced

public static java.lang.Object blockingFilteredReduced(java.util.Collection sequence,
                                                       QtConcurrent.FilteredFunctor filteredFunctor,
                                                       QtConcurrent.ReducedFunctor reducedFunctor,
                                                       QtConcurrent.ReduceOption[] options)
Calls filterFunction once for each item in sequence. If filterFunction returns true for an item, that item is then passed to reduceFunction. In other words, the return value is the result of reduceFunction for each item where filterFunction returns true.

Note that while filterFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is undefined if reduceOptions is QtConcurrent::UnorderedReduce. If reduceOptions is QtConcurrent::OrderedReduce, reduceFunction is called in the order of the original sequence.


blockingFilteredReduced

public static java.lang.Object blockingFilteredReduced(java.util.Collection sequence,
                                                       QtConcurrent.FilteredFunctor filteredFunctor,
                                                       QtConcurrent.ReducedFunctor reducedFunctor,
                                                       QtConcurrent.ReduceOptions options)
Calls filterFunction once for each item in sequence. If filterFunction returns true for an item, that item is then passed to reduceFunction. In other words, the return value is the result of reduceFunction for each item where filterFunction returns true.

Note that while filterFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is undefined if reduceOptions is QtConcurrent::UnorderedReduce. If reduceOptions is QtConcurrent::OrderedReduce, reduceFunction is called in the order of the original sequence.


run

public static QFuture run(java.lang.Object _this,
                          java.lang.reflect.Method m,
                          java.lang.Object[] args)
Executes the method m through the QtConcurrent framework with the given arguments. The returned QFuture object's result wil be the return value of m. Note that this method does not accept function that return void. use runVoidMethod() for this.


runVoidMethod

public static QFutureVoid runVoidMethod(java.lang.Object _this,
                                        java.lang.reflect.Method m,
                                        java.lang.Object[] args)
Executes the method m with the given arguments using the QtConcurrent framework. Notice that runVoidMethod() does not accept methods that has a return value. Use the run() method for this purpose.