|
AlgART Home | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.algart.arrays.AbstractArrayProcessorWithContextSwitching
public abstract class AbstractArrayProcessorWithContextSwitching extends java.lang.Object implements ArrayProcessorWithContextSwitching, java.lang.Cloneable
A skeletal implementation of the ArrayProcessorWithContextSwitching interface.
Usually, you need to extend this class to implement that interface.
This class stores the context, passed to the constructor and returned by context() method,
in an internal field. The context(ArrayContext newContext) method, switching the context,
creates new instance of this class by standard clone() method of this object and then
changes the internal field (containing a reference to the current context) to the newContext value.
Please override context(ArrayContext newContext) or the standard clone() method
if this algorithm is not suitable.
AlgART Laboratory 2007-2013
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractArrayProcessorWithContextSwitching(ArrayContext context)
Creates an instance of this class with the given context. |
| Modifier and Type | Method and Description |
|---|---|
ArrayContext |
context()
This implementation of the method just returns a reference to newContext argument, passed to the constructor. |
ArrayProcessorWithContextSwitching |
context(ArrayContext newContext)
This method is implemented here via cloning this object (by standard clone() call) and replacing the value of the field, where a reference to the current context is stored, with newContext value. |
ArrayContext |
contextPart(double fromPart,
double toPart)
This method returns context() == null ? null :
context().part(fromPart, toPart)) |
MemoryModel |
memoryModel()
Returns the memory model used by this instance for all operations. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractArrayProcessorWithContextSwitching(ArrayContext context)
context() method.
context - the context used by this instance for all operations (may be null).| Method Detail |
|---|
public ArrayProcessorWithContextSwitching context(ArrayContext newContext)
This method is implemented here via cloning this object (by standard clone() call) and replacing the value of the field, where a reference to the current context is stored, with newContext value. This technique is suitable for most implementation. However, if you need, you can override this method; maybe, it is enough to override clone() instead.
context in interface ArrayProcessorWithContextSwitchingnewContext - another context, used by the returned instance; may be null.public final ArrayContext context()
This method works very quickly (it just returns a value of some private field).
context in interface ArrayProcessorpublic final MemoryModel memoryModel()
context().getMemoryModel() if
context()!=null, in other case equal to
SimpleMemoryModel.getInstance().
This method works very quickly (it just returns a value of some private field).
public final ArrayContext contextPart(double fromPart,
double toPart)
This method returns context() == null ? null :
context().part(fromPart, toPart))
fromPart - the estimated ready part, from 0.0 to 1.0,
of the total algorithm at the start of the subtask:
see ArrayContext.updateProgress(net.algart.arrays.ArrayContext.Event) methodtoPart - the estimated ready part, from 0.0 to 1.0,
of the total algorithm at the finish of the subtask:
see ArrayContext.updateProgress(net.algart.arrays.ArrayContext.Event) method;
must be not less than fromPart range.java.lang.IllegalArgumentException - if fromPart or toPart is not in
0.0..1.0 range or if fromPart>toPart.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||