T - The enumeration representing the states.public class State<T extends Enum> extends Object
This class is thread-safe, its methods can be called on any thread. Listeners are
guaranteed to be notified sequentially. For every listener, the order of notifications
corresponds to the order of state changes. However, the internal state of this State
instance is not guaranteed to remain unchanged by the the time listeners are notified.
The internal state of this State instance is protected by its monitor lock.
The way to extract multiple state parameters (value and cause) is to call corresponding
getters while holding this lock.
| Modifier and Type | Class and Description |
|---|---|
static class |
State.InvalidStateException |
static interface |
State.StateChangeListener<T extends Enum> |
| Constructor and Description |
|---|
State(T initialState)
Create a new state
|
| Modifier and Type | Method and Description |
|---|---|
void |
addStateChangeListener(State.StateChangeListener<T> listener) |
void |
checkState(T... states)
Check the state and generate an exception if the current state does not
match.
|
String |
getCause() |
Class<T> |
getEnumClass() |
T |
getState() |
boolean |
isInState(T state) |
void |
removeStateChangeListener(State.StateChangeListener<T> listener) |
void |
setState(org.lsst.ccs.utilities.taitime.CCSTimeStamp when,
State<T> state) |
void |
setState(org.lsst.ccs.utilities.taitime.CCSTimeStamp when,
T state) |
void |
setState(org.lsst.ccs.utilities.taitime.CCSTimeStamp when,
T state,
String cause) |
void |
setState(T state)
Changes the current state.
|
String |
toString() |
public State(T initialState)
initialState - Initial statepublic void setState(T state)
state - The new statepublic void setState(org.lsst.ccs.utilities.taitime.CCSTimeStamp when,
T state)
public void setState(org.lsst.ccs.utilities.taitime.CCSTimeStamp when,
T state,
String cause)
public T getState()
public String getCause()
public boolean isInState(T state)
public void addStateChangeListener(State.StateChangeListener<T> listener)
public void removeStateChangeListener(State.StateChangeListener<T> listener)
public void checkState(T... states) throws State.InvalidStateException
states - The expected state, may be a list of possible statesState.InvalidStateException - If the state does not match.Copyright © 2024 LSST. All rights reserved.