org.opcfoundation.ua.utils
Class State<StateType>

java.lang.Object
  extended by org.opcfoundation.ua.utils.AbstractState<StateType,RuntimeException>
      extended by org.opcfoundation.ua.utils.State<StateType>
All Implemented Interfaces:
IStatefulObject<StateType,RuntimeException>

public class State<StateType>
extends AbstractState<StateType,RuntimeException>

State class.

Author:
Toni Kalajainen (toni.kalajainen@vtt.fi)

Constructor Summary
State(StateType initialState)
          Constructor for State.
 
Method Summary
 void assertNoError()
          assertNoError.
 StateType attemptSetState(Set<StateType> prerequisiteState, StateType newState)
          attemptSetState.
protected  void clearError()
          clearError.
 void setError(RuntimeException error)
          setError.
 boolean setState(StateType state)
          setState.
 StateType setState(StateType state, Executor listenerExecutor, Set<StateType> prerequisiteStates)
          Set state
 
Methods inherited from class org.opcfoundation.ua.utils.AbstractState
addStateListener, addStateNotifiable, getError, getState, hasError, isStateTransitionAllowed, onListenerException, onStateTransition, removeStateListener, removeStateNotifiable, waitForState, waitForState, waitForStateUninterruptibly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

State

public State(StateType initialState)

Constructor for State.

Parameters:
initialState - a StateType object.
Method Detail

setState

public boolean setState(StateType state)

setState.

Overrides:
setState in class AbstractState<StateType,RuntimeException>
Parameters:
state - a StateType object.
Returns:
a boolean.

setState

public StateType setState(StateType state,
                          Executor listenerExecutor,
                          Set<StateType> prerequisiteStates)
Set state

Overrides:
setState in class AbstractState<StateType,RuntimeException>
Parameters:
state - a StateType object.
listenerExecutor - executor for post listener handling or null for immediate
prerequisiteStates - old state prerequisite or null
Returns:
state after attempt

setError

public void setError(RuntimeException error)

setError.

Overrides:
setError in class AbstractState<StateType,RuntimeException>
Parameters:
error - a RuntimeException object.

attemptSetState

public StateType attemptSetState(Set<StateType> prerequisiteState,
                                 StateType newState)

attemptSetState.

Overrides:
attemptSetState in class AbstractState<StateType,RuntimeException>
Parameters:
prerequisiteState - a Set object.
newState - a StateType object.
Returns:
a StateType object.

assertNoError

public void assertNoError()
                   throws RuntimeException

assertNoError.

Overrides:
assertNoError in class AbstractState<StateType,RuntimeException>
Throws:
RuntimeException

clearError

protected void clearError()

clearError.

Overrides:
clearError in class AbstractState<StateType,RuntimeException>


Copyright © 2018. All rights reserved.