Package com.nomagic.uml2.ext.jmi.helpers
Class StateMachineHelper
- java.lang.Object
-
- com.nomagic.uml2.ext.jmi.helpers.StateMachineHelper
-
@OpenApiAll public class StateMachineHelper extends java.lang.Object
An utility class with utility methods operating on state machine domain elements
-
-
Constructor Summary
Constructors Constructor Description StateMachineHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
disposeEvent(Event event)
Disposes event if it is not used any more by other elements in the model.static void
disposeTriggers(java.util.Collection<Trigger> triggers)
static void
disposeTriggers(java.util.List<Trigger> triggers)
Deprecated.static Classifier
getClassifierForTransition(Transition transition)
Returns the classifier as context for given transition.static Event
getEventForTransition(Transition transition)
Returns an event of given transition.static Trigger
getFirstTrigger(Transition transition)
Returns first trigger from transitionstatic Operation
getOperationForTransition(Transition transition)
Returns an operation of given transition.static java.util.Collection<Operation>
getOperationsForTransition(Classifier classifier)
Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.static Signal
getSignalForTransition(Transition transition)
Returns a signal of given transition.static Classifier
getStateMachineContext(StateMachine machine)
Returns the context of the state machine.static boolean
isCallEvent(Transition transition)
Check if event of given transition is CallEventstatic boolean
isSignalEvent(Transition transition)
Check if event of given transition is SignalEventstatic void
setOperationForTransition(Transition transition, Operation operation)
Set derived property operation for transition.static void
setSignalForTransition(Transition transition, Signal signal)
Set derived property signal for transition.
-
-
-
Method Detail
-
setOperationForTransition
public static void setOperationForTransition(Transition transition, Operation operation)
Set derived property operation for transition. Operation is mapped to first trigger call event operation. If transition does not own trigger, new one is created. If trigger does not reference CallEvent or old even is referenced by other elements, new CallEvent is created.- Parameters:
transition
- the given transitionoperation
- the given operation
-
setSignalForTransition
public static void setSignalForTransition(Transition transition, Signal signal)
Set derived property signal for transition. Signal is mapped to first trigger signal event signal. If transition does not own trigger, new one is created. If trigger does not reference SignalEvent or old even is referenced by other elements, new SignalEvent is created.- Parameters:
transition
- the given transitionsignal
- the given signal
-
getOperationForTransition
@CheckForNull public static Operation getOperationForTransition(Transition transition)
Returns an operation of given transition. Operation is taken from trigger call event.- Parameters:
transition
- the given transition- Returns:
- an operation of given transition
-
getSignalForTransition
@CheckForNull public static Signal getSignalForTransition(Transition transition)
Returns a signal of given transition. Signal is taken from trigger signal event.- Parameters:
transition
- the given transition- Returns:
- a signal of given transition
-
isSignalEvent
public static boolean isSignalEvent(Transition transition)
Check if event of given transition is SignalEvent- Parameters:
transition
- transition- Returns:
- true if event is SignalEvent
-
isCallEvent
public static boolean isCallEvent(Transition transition)
Check if event of given transition is CallEvent- Parameters:
transition
- transition- Returns:
- true if event is CallEvent
-
getOperationsForTransition
public static java.util.Collection<Operation> getOperationsForTransition(@CheckForNull Classifier classifier)
Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers. Current implementation uses InteractionHelper.getOperationsForCallAction(classifier)- Parameters:
classifier
- classifier- Returns:
- operations
- See Also:
InteractionHelper.getOperationsForCallAction(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier)
-
getClassifierForTransition
@CheckForNull public static Classifier getClassifierForTransition(Transition transition)
Returns the classifier as context for given transition. If transition is in protocol state machine, ProtocolStateMachine.Interface can be returned.- Parameters:
transition
- transition- Returns:
- classifier
-
getStateMachineContext
@CheckForNull public static Classifier getStateMachineContext(StateMachine machine)
Returns the context of the state machine.- Parameters:
machine
- - state machine.- Returns:
- context of the state machine.
-
disposeTriggers
@Deprecated public static void disposeTriggers(java.util.List<Trigger> triggers)
Deprecated.Disposes given collection of triggers and referenced by them events- Parameters:
triggers
- triggers
-
disposeTriggers
public static void disposeTriggers(java.util.Collection<Trigger> triggers)
-
disposeEvent
public static void disposeEvent(@CheckForNull Event event)
Disposes event if it is not used any more by other elements in the model.- Parameters:
event
- event
-
getEventForTransition
@CheckForNull public static Event getEventForTransition(Transition transition)
Returns an event of given transition. Event is taken from trigger.- Parameters:
transition
- the given transition- Returns:
- an event of given transition
-
getFirstTrigger
@CheckForNull public static Trigger getFirstTrigger(Transition transition)
Returns first trigger from transition- Parameters:
transition
- transition- Returns:
- trigger
-
-