public abstract class AbstractParallelAlgorithm extends AbstractCloneableSerializable implements ParallelAlgorithm
Constructor and Description |
---|
AbstractParallelAlgorithm()
Creates a new instance of AbstractParallelAlgorithm
|
AbstractParallelAlgorithm(java.util.concurrent.ThreadPoolExecutor threadPool)
Creates a new instance of AbstractParallelAlgorithm
|
Modifier and Type | Method and Description |
---|---|
AbstractParallelAlgorithm |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
int |
getNumThreads()
Gets the number of threads in the thread pool.
|
java.util.concurrent.ThreadPoolExecutor |
getThreadPool()
Gets the thread pool for the algorithm to use.
|
void |
setThreadPool(java.util.concurrent.ThreadPoolExecutor threadPool)
Sets the thread pool for the algorithm to use.
|
public AbstractParallelAlgorithm()
public AbstractParallelAlgorithm(java.util.concurrent.ThreadPoolExecutor threadPool)
threadPool
- Thread pool used for parallelization.public AbstractParallelAlgorithm clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public int getNumThreads()
ParallelAlgorithm
getNumThreads
in interface ParallelAlgorithm
public java.util.concurrent.ThreadPoolExecutor getThreadPool()
ParallelAlgorithm
getThreadPool
in interface ParallelAlgorithm
public void setThreadPool(java.util.concurrent.ThreadPoolExecutor threadPool)
ParallelAlgorithm
setThreadPool
in interface ParallelAlgorithm
threadPool
- Thread pool used for parallelization.