Class AbstractOpImpl<V>
java.lang.Object
VASSAL.tools.opcache.AbstractOpImpl<V>
- All Implemented Interfaces:
Op<V>
- Direct Known Subclasses:
AbstractOpImpl
An abstract representation of an operation.
AbstractOpImpl
is the base class for all such operations. The results of all operations
are memoized (using a memory-sensitive cache), so retrieving results is
both fast and memory-efficient.
Warning: For efficiency reasons, the methods get()
and
get(OpObserver)
do not return defensively, nor do the
Future
s returned by getFuture(OpObserver)
. That is, the
object returned is possibly the one retained internally by the
AbstractOpImpl
. Therefore, objects obtained from an
AbstractOpImpl
must not be altered, as this might
interfere with caching. If an object obtained this way needs to be
modified, copy the object first and alter the copy.
- Since:
- 3.1.0
- Author:
- Joel Uckelman
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
cache
The cache which contains calculated results.
-
-
Constructor Details
-
AbstractOpImpl
- Parameters:
cache
- the cache for storing our result
-
-
Method Details
-
getSources
Returns a list ofOp
s on which thisOp
depends.- Specified by:
getSources
in interfaceOp<V>
- Returns:
- the
Op
s on which thisOp
depends
-
eval
-
get
-
get
public V get(OpObserver<V> obs) throws CancellationException, InterruptedException, ExecutionException - Throws:
CancellationException
- if the operation was cancelledInterruptedException
- if the operation was interruptedExecutionException
- if the operation failed
-
getFuture
- Throws:
CancellationException
- if the operation was cancelledInterruptedException
- if the operation was interruptedExecutionException
- if the operation failed
-
newKey
-
update
-