com.taco.swinger
Class SwingDelayedResult

java.lang.Object
  extended by com.taco.swinger.SwingDelayedResult
All Implemented Interfaces:
IDelayedResult

public abstract class SwingDelayedResult
extends java.lang.Object
implements IDelayedResult

A delayed result that is computed in the event dispatch thread.


Field Summary
protected  java.lang.Object _cachedResult
          The cached result.
protected  boolean _shouldCacheResult
          True if the computed result should be cached.
 
Constructor Summary
SwingDelayedResult()
          Construct a new instance that doesn't cache its result.
SwingDelayedResult(boolean shouldCacheResult)
          Construct a new instance that caches its result if the argument is true.
 
Method Summary
protected abstract  java.lang.Object _computeResult()
          Compute the result.
 java.lang.Object force()
          Force the result to be computed and return it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_shouldCacheResult

protected final boolean _shouldCacheResult
True if the computed result should be cached.


_cachedResult

protected java.lang.Object _cachedResult
The cached result.

Constructor Detail

SwingDelayedResult

public SwingDelayedResult()
Construct a new instance that doesn't cache its result. This kind of result is most useful for putting in instances of DelayedResultMap, which also caches computed values.


SwingDelayedResult

public SwingDelayedResult(boolean shouldCacheResult)
Construct a new instance that caches its result if the argument is true.

Method Detail

force

public final java.lang.Object force()
Description copied from interface: IDelayedResult
Force the result to be computed and return it.

Specified by:
force in interface IDelayedResult

_computeResult

protected abstract java.lang.Object _computeResult()
                                            throws java.lang.Exception
Compute the result. This will be invoked in the event-dispatch thread. If the result is null, return MapUtilities.NULL_MAP.VALUE.

Throws:
java.lang.Exception