public class DefaultArrayContext extends AbstractArrayContext implements ArrayContext
A simple implementation of ArrayContext
interface,
based on the memory
,
thread pool
,
interruption
and
progress
contexts defined in this package.
AlgART Laboratory 2007–2014
ArrayContext.Event
DEFAULT, DEFAULT_SINGLE_THREAD
Constructor and Description |
---|
DefaultArrayContext(Context context)
Creates new instance of this class, based on the passed context.
|
DefaultArrayContext(Context context,
ThreadPoolFactory threadPoolFactory)
Creates new instance of this class, based on the passed context,
which returns the specified threadPoolFactory by
getThreadPoolFactory() method. |
Modifier and Type | Method and Description |
---|---|
void |
checkInterruption()
Calls context.
as (InterruptionContext .class).checkInterruption() , where context is the argument of the construcor. |
MemoryModel |
getMemoryModel()
Returns the result of context.
as (ArrayMemoryContext .class).getMemoryModel() call, where context is the argument of the construcor. |
ThreadPoolFactory |
getThreadPoolFactory()
Returns the result of context.
as (ArrayThreadPoolContext .class).getThreadPoolFactory() call, where context is the argument of the construcor,
or threadPoolFactory constructor argument,
if this instance was created with
the corresponding variant of the constructor . |
java.lang.String |
toString() |
void |
updateProgress(ArrayContext.Event event)
Calls context.
as (ProgressUpdater .class).updateProgress (part, part==1.0), where context is the argument of the construcor
and part=event.readyPart() . |
checkInterruptionAndUpdateProgress, currentThreadIndex, customData, customDataVersion, multithreadedVersion, noProgressVersion, numberOfThreads, part, part, singleThreadVersion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
checkInterruptionAndUpdateProgress, currentThreadIndex, customData, customDataVersion, multithreadedVersion, noProgressVersion, numberOfThreads, part, part, singleThreadVersion
public DefaultArrayContext(Context context)
allow to get
the following specific contexts:
ArrayMemoryContext
,
ArrayThreadPoolContext
,
InterruptionContext
and
ProgressUpdater
.context
- the context that will be used by methods of this class.java.lang.NullPointerException
- if the argument is null.UnsupportedContextException
- if this context cannot serve at least one from
the requested 4 specified contexts.public DefaultArrayContext(Context context, ThreadPoolFactory threadPoolFactory)
getThreadPoolFactory()
method.
The passed context must allow to get
the following specific contexts:
ArrayMemoryContext
,
InterruptionContext
and
ProgressUpdater
.
This constructor can be used, for example, if you need to clarify
the desired number of parallel threads (usually set it to 1)
by DefaultThreadPoolFactory.getDefaultThreadPoolFactory(int)
method.context
- the context that will be used by methods of this class.threadPoolFactory
- the thread pool factory that will be used by this object.java.lang.NullPointerException
- if the context or threadPoolFactory argument
is null.UnsupportedContextException
- if this context cannot serve at least one from
the requested 3 specified contexts.public MemoryModel getMemoryModel()
as
(ArrayMemoryContext
.class).getMemoryModel()
call, where context is the argument of the construcor.getMemoryModel
in interface ArrayContext
getMemoryModel
in class AbstractArrayContext
public ThreadPoolFactory getThreadPoolFactory()
as
(ArrayThreadPoolContext
.class).getThreadPoolFactory()
call, where context is the argument of the construcor,
or threadPoolFactory constructor argument,
if this instance was created with
the corresponding variant of the constructor
.getThreadPoolFactory
in interface ArrayContext
getThreadPoolFactory
in class AbstractArrayContext
public void checkInterruption() throws java.lang.RuntimeException
as
(InterruptionContext
.class).checkInterruption()
, where context is the argument of the construcor.checkInterruption
in interface ArrayContext
checkInterruption
in class AbstractArrayContext
java.lang.RuntimeException
- if the application has requested to interrupt the currently executing module;
in this implementation, it will be always InterruptionException
instance.public void updateProgress(ArrayContext.Event event)
as
(ProgressUpdater
.class).updateProgress
(part, part==1.0), where context is the argument of the construcor
and part=event.readyPart()
.updateProgress
in interface ArrayContext
updateProgress
in class AbstractArrayContext
event
- information about the execution progress.public java.lang.String toString()
toString
in class java.lang.Object
Трусики merries на сайте Детальное описание трусики merries на сайте. www.babysmile.ru