org.millscript.millscript.datatypes
Class DeferredSoftReference<T>
java.lang.Object
org.millscript.millscript.datatypes.Deferred<T>
org.millscript.millscript.datatypes.DeferredSoftReference<T>
public abstract class DeferredSoftReference<T>
- extends Deferred<T>
This is a specific type of deferred object, whose value is held in a soft
reference. This allows the garbage collector to reclaim the memory used by
this object, providing there are no hard references left.
Using this type of object allows MillScript to autoload large objects
without having to literally load them into memory. These objects will be
loaded on demand and their memory freed when they are no longer in use. e.g.
you can autoload a large number of images without having to hold them all in
memory.
|
Method Summary |
abstract T |
calculate()
Calculates the value that should be held in this deferred soft
reference. |
T |
get()
Returns the value associated with this deferred object. |
| Methods inherited from class org.millscript.millscript.datatypes.Deferred |
toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DeferredSoftReference
public DeferredSoftReference()
calculate
public abstract T calculate()
- Calculates the value that should be held in this deferred soft
reference.
- Returns:
- the calculated value of this deferred object.
get
public final T get()
- Description copied from class:
Deferred
- Returns the value associated with this deferred object. If the deferred
value hasn't already been calculated, the
calculate method
should be called to do that.
- Specified by:
get in class Deferred<T>
- Returns:
- the value of this deferred object.
- See Also:
Deferred.get()
Copyright © 2001-2007 Open World Ltd. All Rights Reserved.