/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * The operation containingStateMachine() returns the sate machine in which this Region is defined * result = if stateMachine->isEmpty() * then * state.containingStateMachine() * else * stateMachine * endif * @param region The receiving '<em><b>Region</b></em>' model object. * <!-- end-model-doc --> * @generated NOT */ public static StateMachine containingStateMachine(Region region) { StateMachine stateMachine = region.getStateMachine(); if (stateMachine == null) { State state = region.getState(); return state == null ? null : state.containingStateMachine(); } else { return stateMachine; } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * The query isRedefinitionContextValid() specifies whether the redefinition contexts of a region are properly related to the redefinition contexts of the specified region to allow this element to redefine the other. The containing statemachine/state of a redefining region must redefine the containing statemachine/state of the redefined region. * result = true * @param region The receiving '<em><b>Region</b></em>' model object. * <!-- end-model-doc --> * @generated NOT */ public static boolean isRedefinitionContextValid(Region region, Region redefined) { if (redefined != null) { StateMachine stateMachine = region.getStateMachine(); if (stateMachine != null) { return StateMachineOperations.getAllExtendedStateMachines( stateMachine).contains(redefined.getStateMachine()); } else { State state = region.getState(); return state != null && StateOperations.getAllRedefinedStates(state).contains( redefined.getState()); } } return false; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * The operation belongsToPSM () checks if the region belongs to a protocol state machine * result = if not stateMachine->isEmpty() then * oclIsTypeOf(ProtocolStateMachine) * else if not state->isEmpty() then * state.container.belongsToPSM () * else false * @param region The receiving '<em><b>Region</b></em>' model object. * <!-- end-model-doc --> * @generated NOT */ public static boolean belongsToPSM(Region region) { StateMachine stateMachine = region.getStateMachine(); if (stateMachine != null) { return stateMachine instanceof ProtocolStateMachine; } else { State state = region.getState(); if (state != null) { Region container = state.getContainer(); return container != null && container.belongsToPSM(); } return false; } }