| 383 | } |
| 384 | |
| 385 | @SuppressWarnings("unchecked") |
| 386 | @Override |
| 387 | public final boolean isDefined() { |
| 388 | final Object curr = state; |
| 389 | if (curr instanceof SatisfiedFuture) // Done |
| 390 | return true; |
| 391 | else if (curr instanceof Promise && !(curr instanceof Continuation)) // Linked |
| 392 | return ((Promise<T>) curr).isDefined(); |
| 393 | else if (curr instanceof LinkedContinuation) |
| 394 | return ((LinkedContinuation<?, T>) curr).isDefined(); |
| 395 | else // Waiting |
| 396 | return false; |
| 397 | } |
| 398 | |
| 399 | @SuppressWarnings("unchecked") |
| 400 | @Override |