Search in sources :

Example 1 with AcsStateChangeListener

use of alma.acs.genfw.runtime.sm.AcsStateChangeListener in project ACS by ACS-Community.

the class AlmaSubsystemContext method setState.

void setState(AlmaSubsystemStateAbstract newState, String eventName) {
    AlmaSubsystemStateAbstract oldState = m_currentState;
    if (oldState != newState) {
        logTransition(m_currentState, newState, eventName);
        m_currentState = newState;
        m_currentState.entry();
    }
    AcsState[] currentHierarchy = getCurrentTopLevelState().getStateHierarchy();
    // check if there was a state change down the nesting hierarchy		
    if (!Arrays.equals(currentHierarchy, m_oldHierarchy)) {
        // if so, notify listeners
        for (Iterator<AcsStateChangeListener> iter = m_stateChangeListeners.iterator(); iter.hasNext(); ) {
            AcsStateChangeListener listener = iter.next();
            listener.stateChangedNotify(m_oldHierarchy, currentHierarchy);
        }
        m_oldHierarchy = currentHierarchy;
    }
}
Also used : AcsState(alma.acs.genfw.runtime.sm.AcsState) AcsStateChangeListener(alma.acs.genfw.runtime.sm.AcsStateChangeListener)

Aggregations

AcsState (alma.acs.genfw.runtime.sm.AcsState)1 AcsStateChangeListener (alma.acs.genfw.runtime.sm.AcsStateChangeListener)1