Package com.nt.udc.util.state
Class RuntimeState
java.lang.Object
com.nt.udc.util.state.RuntimeState
This class maintains the state of a given Object from a
set of pre-defined states.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs the RuntimeState in UNKNOWN state.RuntimeState
(State initState) Constructs the RuntimeState in the given state. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Used to compare this RuntimeState Object with a State Object.getState()
Returns the state of the Object.void
Sets the state of the Object.toString()
Returns the String representation of the current state.void
Causes the current Thread to wait until the current state equals the "waitState".void
Causes the current Thread to wait while the current state equals the "waitState".
-
Constructor Details
-
RuntimeState
public RuntimeState()Constructs the RuntimeState in UNKNOWN state. -
RuntimeState
Constructs the RuntimeState in the given state.- Parameters:
initState
- Initial state of the Object.
-
-
Method Details
-
setState
Sets the state of the Object.- Parameters:
newState
- New Object State
-
getState
Returns the state of the Object.- Returns:
- State of the Object
-
equals
Used to compare this RuntimeState Object with a State Object.- Parameters:
compareState
- State to check for equality.- Returns:
- true, if states are equal
-
waitUntil
Causes the current Thread to wait until the current state equals the "waitState".- Parameters:
waitState
- State to wait until.- Throws:
InterruptedException
-
waitWhile
Causes the current Thread to wait while the current state equals the "waitState".- Parameters:
waitState
- State to wait during.- Throws:
InterruptedException
-
toString
Returns the String representation of the current state.
-