|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.taco.swinger.SwingCompute
public abstract class SwingCompute
A class that computes a value in the event-dispatch thread, whether the caller is running in the event-dispatch thread or not.
Field Summary | |
---|---|
protected java.lang.Object |
_result
The result of compute() . |
protected java.lang.Throwable |
_savedException
The exception thrown by the last invocation of _compute() ,
if any. |
Constructor Summary | |
---|---|
SwingCompute()
|
Method Summary | |
---|---|
protected abstract java.lang.Object |
_compute()
Run in the event-dispatch thread, and return whatever result should be returned by get() . |
void |
clear()
Clear the previously computed result. |
java.lang.Object |
get()
Return the value in computed in the event-dispatch thread by _compute() . |
java.lang.Throwable |
getSavedException()
Return the exception thrown by _compute() the last time
this instance was run. |
boolean |
hasRun()
Return true if this instance has finished running already. |
void |
run()
Call _compute() , but do not throw any exceptions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object _result
compute()
.
protected java.lang.Throwable _savedException
_compute()
,
if any.
Constructor Detail |
---|
public SwingCompute()
Method Detail |
---|
public final java.lang.Object get()
_compute()
. The caller may or may not be running in the
event-dispatch thread itself.
public final void run()
_compute()
, but do not throw any exceptions. Instead,
save any exception in _savedException
. Also save the
result of _compute()
in _result
.
run
in interface java.lang.Runnable
public final java.lang.Throwable getSavedException()
_compute()
the last time
this instance was run. If the instance has never been run, or no
exception was thrown, return null.
public boolean hasRun()
true
if this instance has finished running already.
public void clear()
hasRun()
will return false.
protected abstract java.lang.Object _compute() throws java.lang.Exception
get()
. Throw any exception desired; it will be
caught by the caller.
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |