Enum Class FutureState
- All Implemented Interfaces:
Serializable
,Comparable<FutureState>
,Constable
Possible
FutureWork
states, which are:
- SUCCESS: the operation successfully ran to completion
- FAIL: the operation ran to completion but failed
- CANCEL: the operation was cancelled by the user
- ABORT: the operation was aborted by the software
- Since:
- 1.0
- Version:
- 2023-01-23
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionboolean
isAbort()
Return true if the end state isABORT
.boolean
isCancel()
Return true if the end state isCANCEL
.boolean
isDone()
Return true if the end state isSUCCESS
orFAIL
.boolean
isFail()
Return true if the end state isFAIL
.boolean
Return true if the end state isSUCCESS
.boolean
Return true if the end state isCANCEL
orABORT
.boolean
Return true if the end state isFAIL
orABORT
.toString()
static FutureState
Returns the enum constant of this class with the specified name.static FutureState[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
-
Enum Constant Details
-
SUCCESS
-
FAIL
-
CANCEL
-
ABORT
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
isSuccess
public boolean isSuccess()Return true if the end state isSUCCESS
. This indicates that the future ran to completion and was successful. -
isFail
public boolean isFail()Return true if the end state isFAIL
. This indicates that the future ran to completion but failed to achieve the overall goal. For example, consider a future that turns on a motor. For safety reasons, the motor can only be run if the cover is closed. Sensing that the cover is open, the future would returnFAIL
to indicate that it didn't turn on the motor due to an expected precondition.FAIL
andABORT
are conceptually similar but semanticallyFAIL
represents an expected inability to complete the future successfully whileABORT
is unexpected. This allows event handlers to process these conditions in different ways. -
isCancel
public boolean isCancel()Return true if the end state isCANCEL
. This indicates that an external system requested that the future end before running to completion. Cancel can be considered a top-down event, typically coming from a user or higher level logic requesting that a process be ended early. For example, consider a future that runs a motor. For safety reasons, the motor can only run if the cover is closed. While the motor is running, a user opens the cover and the higher level software cancels the motor future to force the motor to stop. -
isAbort
public boolean isAbort()Return true if the end state isABORT
. This indicates that the future did not run to completion due to an internal error. This can be considered a bottom-up event, typically coming from the internal implementation of the future experiencing an unrecoverable error. For example, consider a future that runs a motor. A future turns the motor on but while running the temperature exceeds a safety limit. The future is aborted to stop the motor and indicate that it stopped for an unexpected reason.FAIL
andABORT
are conceptually similar but semanticallyFAIL
represents an expected inability to complete the future successfully whileABORT
is unexpected. This allows event handlers to process these conditions in different ways. -
isDone
public boolean isDone()Return true if the end state isSUCCESS
orFAIL
. This indicates that the future ran to completion regardless of whether it was successful or failed. -
isTerminate
public boolean isTerminate()Return true if the end state isCANCEL
orABORT
. This indicates that the future did not run to completion and ended earlier than expected. -
isUnsuccess
public boolean isUnsuccess()Return true if the end state isFAIL
orABORT
. This indicates that the future was unsuccessful due to internal reasons. If a future is expected to be successful unless a user cancels it, then this indicates that the future was not successful. -
getFutureEvent
-
toString
- Overrides:
toString
in classEnum<FutureState>
-