Class InteractionHelper


  • @OpenApiAll
    public class InteractionHelper
    extends java.lang.Object
    Helper methods for dealing with model in interactions (sequence).
    • Field Detail

      • KEEP_ALL_OPERATION

        public static final java.lang.String KEEP_ALL_OPERATION
        See Also:
        Constant Field Values
    • Constructor Detail

      • InteractionHelper

        public InteractionHelper()
    • Method Detail

      • isLostMessage

        public static boolean isLostMessage​(Message message)
        Indicates if given message is a lost message.
        Parameters:
        message - message to check.
        Returns:
        true if given message is a lost message, false otherwise.
      • isFoundMessage

        public static boolean isFoundMessage​(Message message)
        Indicates if given message is a found message.
        Parameters:
        message - message to check.
        Returns:
        true if given message is a found message, false otherwise.
      • isSendMessage

        public static boolean isSendMessage​(Message message)
        Checks if is send message.
        Parameters:
        message - the message
        Returns:
        true, if is send message
      • isSynchMessage

        public static boolean isSynchMessage​(Message msg)
        Checks if is synch message.
        Parameters:
        msg - the msg
        Returns:
        true, if is synch message
      • isDestroyMessage

        public static boolean isDestroyMessage​(Message msg)
        Checks if is destroy message.
        Parameters:
        msg - the msg
        Returns:
        true, if is destroy message
      • isReplyMessage

        public static boolean isReplyMessage​(Message message)
        Indicates if this message is a reply message.
        Parameters:
        message - - message to check.
        Returns:
        true if this is a reply message, false otherwise.
      • isCallMessage

        public static boolean isCallMessage​(Message message)
        Indicates if message is a call message.
        Parameters:
        message - - message to check.
        Returns:
        true if this message is a call message, false otherwise.
      • isCreateMessage

        public static boolean isCreateMessage​(Message msg)
        Checks if is creates the message.
        Parameters:
        msg - the msg
        Returns:
        true, if is creates the message
      • canChangeMessageType

        public static boolean canChangeMessageType​(Message message)
        Checks if this message can change its type. This is not possible if message does not have receive event.
        Parameters:
        message - message to check.
        Returns:
        true if message can change type, false otherwise.
      • getReceiverClassifier

        @CheckForNull
        public static Classifier getReceiverClassifier​(Message message)
        Returns classifier - receiver of message.
        Parameters:
        message - message
        Returns:
        classifier
      • getSendClassifier

        @CheckForNull
        public static Classifier getSendClassifier​(Message message)
        Returns classifier - receiver of message.
        Parameters:
        message - message
        Returns:
        classifier
      • getMessageEndClassifier

        @CheckForNull
        public static Classifier getMessageEndClassifier​(Message message,
                                                         boolean client)
        Returns classifier - receiver of message.
        Parameters:
        message - message
        client - the client
        Returns:
        classifier
      • makeMessageOperationCallable

        public static void makeMessageOperationCallable​(Message message)
        If message is not call, makes it call.
        Parameters:
        message - message to check.
      • changeSynchForMessage

        public static void changeSynchForMessage​(Message message)
        Change synch for message.
        Parameters:
        message - the message
      • setMessageSort

        public static void setMessageSort​(Message message,
                                          MessageSort sort)
        Changes message sort by the given one.

        NOTE Message must have parent

        Parameters:
        message - Given message, to change sort
        sort - Given sort kind, one from MessageSortEnum
        See Also:
        MessageSortEnum
      • ensureCorrectSignature

        private static void ensureCorrectSignature​(Message message)
        Ensures that message has a correct signature according message sort.
        Parameters:
        message - message for which to ensure correct signature.
      • ensureCorrectReceiveEvent

        public static void ensureCorrectReceiveEvent​(Message message,
                                                     boolean preserveElementID,
                                                     java.lang.String elementIDSuffix)
        Ensures that a message has a correct receive occurrence (message or destruction).
        Parameters:
        message - message for which to ensure correct end.
        preserveElementID - indicates if element ID should be preserved.
        elementIDSuffix - element ID suffix to append.
      • replaceSendEvent

        private static void replaceSendEvent​(Message message,
                                             MessageEnd messageEnd,
                                             boolean preserveElementID,
                                             java.lang.String elementIDSuffix)
        Replaces send event for a given message.
        Parameters:
        message - message for which to replace send event.
        messageEnd - event to replace.
        preserveElementID - indicates if element ID should be preserved.
        elementIDSuffix - element ID suffix to append.
      • makeSendMessage

        private static void makeSendMessage​(Message message,
                                            @CheckForNull
                                            Signal signal)
        Make send message.
        Parameters:
        message - the message
        signal - the signal
      • initMessage

        public static void initMessage​(Message message,
                                       Lifeline source,
                                       Lifeline target)
        Initializes the message.
        Parameters:
        message - the message
        source - the source
        target - the target
      • createReceiveEventByMessageSort

        public static MessageOccurrenceSpecification createReceiveEventByMessageSort​(Message message)
        Creates receive event occurrence according message sort
        Parameters:
        message - message
        Returns:
        MessageOccurrenceSpecification
      • initCoveredInfo

        public static void initCoveredInfo​(InteractionFragment fragment,
                                           Lifeline lifeline)
        Initializes the covered info.
        Parameters:
        fragment - the fragment
        lifeline - the lifeline
      • findInteraction

        @CheckForNull
        public static Interaction findInteraction​(@CheckForNull
                                                  Element interactionElement)
        Finds interaction for a given interaction element.
        Parameters:
        interactionElement - an element in an interaction.
        Returns:
        interaction to which a given interaction element is related.
      • initMessage

        public static void initMessage​(Message message,
                                       @CheckForNull
                                       Element source,
                                       @CheckForNull
                                       Element target)
        Initializes message by the given source and target.
        • If source or target is of type Lifeline, then is created additionally MessageOccurrenceSpecification and covered by Lifeline
        • If source or target is of type CombinedFragment, InteractionUse or Interaction, then is created additionally Gate as MessageEnd. Gate is not covered by any lifeline
        Parameters:
        message - message
        source - source
        target - target
      • makeLostMessage

        public static void makeLostMessage​(Message message)
        Turns a message to a lost message by removing its receiving end and setting necessary properties.
        Parameters:
        message - message to turn into a lost message.
      • makeFoundMessage

        public static void makeFoundMessage​(Message message)
        Turns a message to a found message by removing its sending end and setting necessary properties.
        Parameters:
        message - message to turn into a found message.
      • getMessageSubstitute

        public static Message getMessageSubstitute​(Message message)
        Returns message substitute for given message or the given message, if no substitution found. Message substitution is message found by the formal gate.
        Parameters:
        message - message, for which substitution will be searched
        Returns:
        given message if no substitution found
      • getOperationOfCallMessage

        @CheckForNull
        public static Operation getOperationOfCallMessage​(Message message)
        Gets the operation of call message.
        Parameters:
        message - the message
        Returns:
        the operation of call message
      • getSignalOfMessage

        @CheckForNull
        public static Signal getSignalOfMessage​(Message message)
        Gets the signal of message.
        Parameters:
        message - the message
        Returns:
        the signal of message
      • getSignalAttributeForArgument

        @CheckForNull
        public static Property getSignalAttributeForArgument​(ValueSpecification argument)
        Gets signal attribute if it exists for a given message argument.
        Parameters:
        argument - argument for which to retrieve signal attribute.
        Returns:
        signal attribute related to the given argument if found, null otherwise.
      • setOperationForMessage

        public static void setOperationForMessage​(Message message,
                                                  Operation operation,
                                                  boolean createArguments)
        Sets the operation for message.
        Parameters:
        message - the message
        operation - the operation
        createArguments - the create arguments
      • setSignalForMessage

        public static void setSignalForMessage​(Message message,
                                               Signal signal)
        Sets the signal for message.
        Parameters:
        message - the message
        signal - the signal
      • findSignalForMessage

        @CheckForNull
        public static Signal findSignalForMessage​(Message message,
                                                  java.lang.String name)
        Find signal for message.
        Parameters:
        message - the message
        name - the name
        Returns:
        the signal
      • getAvailableOperationsForCallMessage

        public static java.util.Collection<Operation> getAvailableOperationsForCallMessage​(Message message)
        Gets operations which are available to select for a call message.
        Parameters:
        message - message for which to get available operations for selection.
        Returns:
        available operations.
      • getOperationsForCallAction

        public static java.util.Collection<Operation> getOperationsForCallAction​(@CheckForNull
                                                                                 Classifier classifier)
        Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.
        Parameters:
        classifier - classifier
        Returns:
        classifiers
      • getOperationsForCallAction

        public static java.util.Collection<Operation> getOperationsForCallAction​(@CheckForNull
                                                                                 Classifier classifier,
                                                                                 @CheckForNull
                                                                                 Message message)
        Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.
        Parameters:
        classifier - classifier
        message - call message
        Returns:
        classifiers
      • getOperations

        public static java.util.Set<Operation> getOperations​(@CheckForNull
                                                             Classifier classifier,
                                                             @CheckForNull
                                                             Message message)
        Returns all operations for call actions
        Parameters:
        classifier - classifier from which we select operations
        Returns:
        operation set
      • isNotGate

        public static boolean isNotGate​(@CheckForNull
                                        Message message)
        Checks if message send end is Gate (Message send from diagram border)
        Parameters:
        message - message
        Returns:
        true if is not Gate, else false
      • isLifelinePort

        @CheckForNull
        public static Element isLifelinePort​(@CheckForNull
                                             Message message)
        Checks if lifeline from message supplier is port and exists in lifeline context.
        Parameters:
        message - message
        Returns:
        true if is port else false
      • getLifelines

        @CheckForNull
        public static java.util.Collection<Lifeline> getLifelines​(@CheckForNull
                                                                  Message message)
        Returns lifelines that are covered by given message
        Parameters:
        message - message
        Returns:
        lifelines that are covered by given message, null if no lifeline is covered
      • findCallOperationWithArguments

        @CheckForNull
        public static Operation findCallOperationWithArguments​(java.lang.String name,
                                                               Classifier classifier,
                                                               java.util.List<Operation> preferredOperations,
                                                               int paramCount,
                                                               Message message)
        Find call operation, which has closest parameter count. Sometimes there are few operations with same names, but different parameter count - this function returns operation by name and closest match by paramCount.
        Parameters:
        name - the name
        classifier - the classifier
        preferredOperations - list of preferred operations
        paramCount - preferred parameter count
        message - call message
        Returns:
        the operation
      • findCallOperation

        @CheckForNull
        public static Operation findCallOperation​(java.lang.String name,
                                                  Classifier classifier,
                                                  java.util.List<Operation> preferredOperations,
                                                  Message message)
        Find call operation.
        Parameters:
        name - the name
        classifier - the classifier
        preferredOperations - the preferred operations
        message - call message
        Returns:
        the operation
      • createArgumentsForCallMessage

        public static void createArgumentsForCallMessage​(Message message)
        Creates the arguments for call message.
        Parameters:
        message - the message
      • createArgumentForMessage

        @CheckForNull
        public static ValueSpecification createArgumentForMessage​(Message message,
                                                                  Type type)
        Creates an argument for a message.
        Parameters:
        message - message for which to create an argument.
        type - type of the argument.
        Returns:
        created argument for message.
      • createArgumentForMessage

        @CheckForNull
        public static ValueSpecification createArgumentForMessage​(Message message,
                                                                  @CheckForNull
                                                                  Type type,
                                                                  @CheckForNull
                                                                  ValueSpecification defaultValue)
        Creates an argument for a message. Uses the passed default value to initialize the argument.
        Parameters:
        message - message for which to create an argument.
        type - type of the argument.
        defaultValue - default value for the argument.
        Returns:
        created argument for message.
      • getArgumentSupportedValueSpecifications

        public static java.util.List<java.lang.Class> getArgumentSupportedValueSpecifications()
        Get argument supported value specification classes.
        Returns:
        value specification classes.
      • getNestedNumberAsString

        public static java.lang.String getNestedNumberAsString​(java.util.List number)
        Gets the nested number as string.
        Parameters:
        number - the number
        Returns:
        the nested number as string
      • createProperty

        public static Property createProperty​(java.lang.String propertyName,
                                              @CheckForNull
                                              Classifier type,
                                              Interaction inter)
        Creates property into interaction for the lifeline use.
        Parameters:
        propertyName - name
        type - type
        inter - interaction
        Returns:
        created property
      • disposeMessageArguments

        public static void disposeMessageArguments​(Message message)
        Dispose message arguments.
        Parameters:
        message - the message
      • setMessageArguments

        public static void setMessageArguments​(Message message,
                                               java.util.List<ValueSpecification> arguments)
                                        throws ParseException
        Sets the message arguments.
        Parameters:
        message - the message
        arguments - the arguments
        Throws:
        ParseException - the parse exception
      • removeReturnParameter

        public static int removeReturnParameter​(java.util.List parameters)
        Removes the return parameter.
        Parameters:
        parameters - the parameters
        Returns:
        the int
      • setTarget

        public static void setTarget​(Message message,
                                     java.lang.String target)
        Sets the target.
        Parameters:
        message - the message
        target - the target
      • setGuard

        public static void setGuard​(Message message,
                                    java.lang.String guard)
        Sets the guard.
        Parameters:
        message - the message
        guard - the guard
      • getReceiveElement

        @CheckForNull
        public static Element getReceiveElement​(Message message)
        Gets the receive element.
        Parameters:
        message - the message
        Returns:
        the receive element
      • getSendElement

        @CheckForNull
        public static Element getSendElement​(Message message)
        Return send event holder of the given message.

        It can be:

        • covered lifeline
        • gate owner (Interaction, CombinedFragment, InteractionUse)
        Parameters:
        message - Given message, which will be analysed
        Returns:
        One of Lifeline, Interaction, CombinedFragment, InteractionUse. Can return null, if message has no send event
      • getReplyMessage

        public static Message getReplyMessage​(Message message)
        Return receive event holder of the given message.

        It can be:

        • covered lifeline
        • gate owner (Interaction, CombinedFragment, InteractionUse)
        Parameters:
        message - Given message, which will be analysed
        Returns:
        One of Lifeline, Interaction, CombinedFragment, InteractionUse. Can return null, if message has no receive event
      • setReturnValue

        public static void setReturnValue​(Message message,
                                          java.lang.String value)
        Sets the return value.
        Parameters:
        message - the message
        value - the value
      • getReturnParameterPosition

        public static int getReturnParameterPosition​(@CheckForNull
                                                     Operation operation)
        Gets the return parameter position.
        Parameters:
        operation - the operation
        Returns:
        the return parameter position
      • setReturnValueForMessage

        public static void setReturnValueForMessage​(Message message,
                                                    java.lang.String value)
        Sets the return value for message.
        Parameters:
        message - the message
        value - the value
      • parseArguments

        public static void parseArguments​(Message message,
                                          java.lang.String s)
        Parses arguments from string and sets them as message arguments.
        Parameters:
        message - message
        s - string to parse
      • initOperationForCallMessage

        public static void initOperationForCallMessage​(Message message,
                                                       @CheckForNull
                                                       Classifier classifier,
                                                       @CheckForNull
                                                       Operation operation)
        Init the operation for call message.
        Parameters:
        message - the message
        classifier - the classifier
        operation - the op
      • setLifelineType

        public static void setLifelineType​(Lifeline lifeline,
                                           @CheckForNull
                                           Type type)
        Sets the lifeline type.
        Parameters:
        lifeline - the lifeline
        type - the type
      • getStateInvariantClassifier

        @CheckForNull
        public static Classifier getStateInvariantClassifier​(StateInvariant stateInvariant)
        Gets classifier which is related to a given state invariant through a lifeline.
        Parameters:
        stateInvariant - state invariant for which classifier should found.
        Returns:
        classifier if found, null otherwise.
      • getLifelineType

        @CheckForNull
        public static Classifier getLifelineType​(Lifeline lifeline)
        Gets the lifeline type.
        Parameters:
        lifeline - the lifeline
        Returns:
        the lifeline type
      • getRemovableConnectableElement

        @CheckForNull
        public static ConnectableElement getRemovableConnectableElement​(Lifeline lifeline)
        Check if the represents can be removed along with lifeline.
        Parameters:
        lifeline - lifeline
        Returns:
        connectible element that should be disposed
      • setTimeInterval

        public static void setTimeInterval​(TimeConstraint timeConstraint,
                                           java.lang.String minValue,
                                           java.lang.String maxValue)
        Sets time interval for a given time constraint.
        Parameters:
        timeConstraint - time constraint to modify.
        minValue - min value.
        maxValue - max value.
      • setTimeInterval

        public static void setTimeInterval​(TimeInterval timeInterval,
                                           java.lang.String minValue,
                                           java.lang.String maxValue,
                                           boolean createObservation)
        Sets time interval data.
        Parameters:
        timeInterval - time interval to modify.
        minValue - min value.
        maxValue - max value.
        createObservation - indicates if observation should be created.
      • setTimeInterval

        public static void setTimeInterval​(TimeConstraint timeConstraint,
                                           java.lang.String minMax)
        Sets time interval for a time constraint. String is of type lower..higher values.
        Parameters:
        timeConstraint - constraint constraint for which to set time interval.
        minMax - min..max format value.
      • setTimeInterval

        public static void setTimeInterval​(TimeInterval timeInterval,
                                           @CheckForNull
                                           java.lang.String minMax,
                                           boolean createObservation)
        Sets time interval data. String is of type lower..higher values.
        Parameters:
        timeInterval - time interval to modify.
        minMax - min..max format value.
        createObservation - indicates if observation should be created.
      • setDurationInterval

        public static void setDurationInterval​(DurationConstraint durationConstraint,
                                               java.lang.String minMax)
        Sets duration interval data. String is of type lower..higher values.
        Parameters:
        durationConstraint - duration constraint to set.
        minMax - min..max format value.
      • setDurationInterval

        public static void setDurationInterval​(DurationInterval durationInterval,
                                               @CheckForNull
                                               java.lang.String minMax,
                                               boolean createObservation)
        Sets duration interval value. String is of type lower..higher values.
        Parameters:
        durationInterval - duration interval to modify.
        minMax - min..max format value.
        createObservation - indicates if observation should be created.
      • parseMinMax

        private static java.lang.String[] parseMinMax​(@CheckForNull
                                                      java.lang.String minMax)
        Parses given string to the min, max values. Given string should be of the format minValue..maxValue If give only one value, it will be treated as min value
        Parameters:
        minMax - min+max
        Returns:
        Returns array of the String. First member is min value, second is max value. If min or max value is not present, value in the array will be empty string.
      • createTimeExpression

        public static TimeExpression createTimeExpression​(TimeInterval timeInterval,
                                                          boolean createObservation)
        Creates time expression for give time interval min or max.
        Parameters:
        timeInterval - interval
        createObservation - create observation
        Returns:
        expression
      • setTimeExpressionOwner

        public static void setTimeExpressionOwner​(TimeExpression timeExpression,
                                                  Element findParentFrom)
        Sets the time expression owner.
        Parameters:
        timeExpression - the time expression
        findParentFrom - the find parent from
      • getIntervalMinMax

        public static java.lang.String[] getIntervalMinMax​(IntervalConstraint interval)
        Returns min and max values. If not exist - can be null
        Parameters:
        interval - interval
        Returns:
        min max values
      • valueToString

        @CheckForNull
        private static java.lang.String valueToString​(java.lang.Object value)
      • getIntervalMinMaxValues

        public static java.lang.Object[] getIntervalMinMaxValues​(IntervalConstraint interval)
        Returns min and max values. If not exist - can be null
        Parameters:
        interval - interval
        Returns:
        min max values
      • createDuration

        public static Duration createDuration​(DurationInterval interval,
                                              boolean createObservation)
        Create duration for duration interval min or max.
        Parameters:
        interval - interval
        createObservation - create observation
        Returns:
        duration
      • setDurationOwner

        public static void setDurationOwner​(Duration duration,
                                            Element findParentFrom)
        Sets the duration owner.
        Parameters:
        duration - the duration
        findParentFrom - the find parent from
      • setDurationInterval

        public static void setDurationInterval​(DurationConstraint dc,
                                               @CheckForNull
                                               java.lang.String minValue,
                                               @CheckForNull
                                               java.lang.String maxValue)
        Sets duration interval.
        Parameters:
        dc - constraint
        minValue - min value
        maxValue - max value
      • setDurationInterval

        public static void setDurationInterval​(DurationInterval interval,
                                               @CheckForNull
                                               java.lang.String minValue,
                                               @CheckForNull
                                               java.lang.String maxValue,
                                               boolean createObservation)
        Sets duration interval.
        Parameters:
        interval - interval
        minValue - min value
        maxValue - max value
        createObservation - create observation
      • isInsideMessage

        public static boolean isInsideMessage​(Message message,
                                              CombinedFragment fragment)
        Checks if given message is inside the fragment. Check - if given message has one end with the same covered lifeline as fragment does - if given message has one end to the nested fragment

        Message is expected to have one end connected to fragment

        Parameters:
        message - Message to check if ii is inside
        fragment - Check if given message is inside THIS fragment
        Returns:
        true if given message is inside the given fragment
      • isEventInside

        private static int isEventInside​(CombinedFragment fragment,
                                         @CheckForNull
                                         MessageEnd sendEvent)
        Checks if is event inside.
        Parameters:
        fragment - fragment
        sendEvent - event
        Returns:
        status if event is inside or not. 1 - is inside, -1 - is unknown, 0 is outside
      • isCovered

        private static boolean isCovered​(CombinedFragment fragment,
                                         MessageEnd sendEvent)
        Checks if is covered.
        Parameters:
        fragment - the fragment
        sendEvent - the send event
        Returns:
        true, if is covered
      • getMessage

        @CheckForNull
        public static Message getMessage​(Gate gate)
        Returns message, to which this gate is connected.
        Parameters:
        gate - given gate to check message
        Returns:
        Message, which is connected to the gate
      • getPairableGate

        public static java.util.Iterator<Gate> getPairableGate​(InteractionUse use,
                                                               boolean replayMessage)
        Gets iterator of Gates, which can be used to be formal pair of the gate.
        Parameters:
        use - given interaction use
        replayMessage - if true, than all messages will be returned which are pairable for replay message kind
        Returns:
        Iterator of gates. Not null.
      • getPairableGate

        public static java.util.Iterator<Gate> getPairableGate​(CombinedFragment fragment,
                                                               boolean replayMessage)
        Gets iterator of Gates, which can be used to be formal pair of the gate. The are : all gates, which are originated by inside messages of given fragment. Inside message must have at least one end which would cover lifeline, covered by given fragment
        Parameters:
        fragment - given interaction fragment
        replayMessage - if true, than all messages will be returned which are pairable for replay message kind
        Returns:
        Iterator of gates. Not null.
      • setEventForTimeExpression

        public static void setEventForTimeExpression​(TimeExpression timeExpression,
                                                     @CheckForNull
                                                     NamedElement event)
        Sets event for first time observation referenced by a given time expression. If time expression does not reference any time observation, call is ignored.
        Parameters:
        timeExpression - time expression to modify.
        event - event to set.
      • setEventForTimeInterval

        public static void setEventForTimeInterval​(TimeInterval interval,
                                                   @CheckForNull
                                                   NamedElement event,
                                                   boolean createObservation)
        Sets event for Time Interval min and max expressions. Creates min and max expressions if needed.
        Parameters:
        interval - time interval
        event - event
        createObservation - if true create TimeObservation if min and max expressions are created
      • setEventForDuration

        public static void setEventForDuration​(Duration duration,
                                               @CheckForNull
                                               NamedElement event1,
                                               @CheckForNull
                                               NamedElement event2)
        Sets events for first DurationObservation referenced by given Duration. If Duration do no reference any DurationObservation, call is ignored.
        Parameters:
        duration - duration
        event1 - event or null
        event2 - event or null
      • setEventForDurationInterval

        public static void setEventForDurationInterval​(DurationInterval interval,
                                                       @CheckForNull
                                                       NamedElement event1,
                                                       @CheckForNull
                                                       NamedElement event2,
                                                       boolean createObservations)
        Sets events for DurationInterval min and max durations. Creates min and max durations if needed
        Parameters:
        interval - duration interval
        event1 - event or null
        event2 - event or null
        createObservations - if true create DurationObservation if min and max durations are created
      • setStateForStateInvariant

        public static void setStateForStateInvariant​(StateInvariant stateInvariant,
                                                     State state,
                                                     boolean createConstraintIfNecessary)
        Sets state for state invariant to represent.
        Parameters:
        stateInvariant - state invariant for which state should be set.
        state - state which should be set to state invariant.
        createConstraintIfNecessary - creates constraint if constraint doesn't exist in a state invariant.
      • getStateInvariantConstraint

        @CheckForNull
        public static Constraint getStateInvariantConstraint​(StateInvariant stateInvariant,
                                                             boolean create)
        Gets state invariant constraint from state invariant.
        Parameters:
        stateInvariant - state invariant from which to get state invariant constraint.
        create - true if a new constraint should be created when no constraints are found.
        Returns:
        invariant constraint if found or new created, null if no constraint found.
      • getStateInvariantState

        @CheckForNull
        public static State getStateInvariantState​(StateInvariant stateInvariant)
        Retrieves state which is set to a given state invariant.
        Parameters:
        stateInvariant - state invariant for which state should be retrieved.
        Returns:
        state if found, null otherwise.
      • getMessages

        public static java.util.List<Message> getMessages​(Lifeline lifeline)
        Return all connected messages from given lifeline.
        Parameters:
        lifeline - lifeline
        Returns:
        all messages connected to this lifeline.
      • parseParameterName

        public static java.lang.String parseParameterName​(java.lang.String text)
        Parses parameter from parameter=argument tuple.
        Parameters:
        text - text to parse.
        Returns:
        parsed parameter name.
      • parseArgumentName

        public static java.lang.String parseArgumentName​(java.lang.String text)
        Parses argument from parameter=argument tuple.
        Parameters:
        text - text to parse.
        Returns:
        parsed argument name.
      • addParameterForOperation

        @CheckForNull
        public static Parameter addParameterForOperation​(Operation operation,
                                                         java.lang.String name,
                                                         boolean generateName)
      • addParameterForOperation

        @CheckForNull
        public static Parameter addParameterForOperation​(Operation operation,
                                                         java.lang.String name,
                                                         boolean generateName,
                                                         ParameterDirectionKind directionKind)
        Adds a parameter to an operation with a given name.
        Parameters:
        operation - operation for which to add a parameter.
        name - name to set.
        generateName - indicates whether name should be generated if given name is empty.
        directionKind - parameter direction
        Returns:
        created parameter.
      • addPropertyForSignal

        @CheckForNull
        public static Property addPropertyForSignal​(Signal signal,
                                                    java.lang.String name,
                                                    boolean generateName)
      • getOperationParameterByName

        @CheckForNull
        public static Parameter getOperationParameterByName​(Operation op,
                                                            java.lang.String name)
        Finds parameter from the operation by given name
        Parameters:
        op - provided operation
        name - name for the parameter
        Returns:
        parameter or null
      • getSignalAttributeByName

        @CheckForNull
        public static Property getSignalAttributeByName​(Signal signal,
                                                        java.lang.String name)
      • ensureFragmentsAreInFragmentCollection

        public static void ensureFragmentsAreInFragmentCollection​(java.util.Collection<InteractionFragment> collection,
                                                                  java.util.Collection<InteractionFragment> fragments)
        Ensures that fragments are in given fragment collection.
        Parameters:
        collection - collection to check.
        fragments - fragments to add to the fragment collection.
      • getAvailableSignals

        public static java.util.Collection<Signal> getAvailableSignals​(Message message)
        Gets all available signals to select for a message.
        Parameters:
        message - message for which to retrieve all available signals.
        Returns:
        available signals for a message.
      • getDestructionOccurrenceSpecification

        @CheckForNull
        public static DestructionOccurrenceSpecification getDestructionOccurrenceSpecification​(Lifeline lifeline)
        Gets destruction occurrence specification from a given lifeline.
        Parameters:
        lifeline - lifeline for which to get destruction occurrence specification.
        Returns:
        destruction occurrence specification if found any, null otherwise.
      • getDestructionOccurrenceSpecification

        @CheckForNull
        public static DestructionOccurrenceSpecification getDestructionOccurrenceSpecification​(java.util.Collection<InteractionFragment> collection)
        Gets destruction occurrence specification from a given lifeline.
        Parameters:
        collection - collection in which to search for destruction occurrence.
        Returns:
        destruction occurrence specification if found any, null otherwise.
      • ensureDestructionOccurrence

        public static boolean ensureDestructionOccurrence​(Lifeline lifeline,
                                                          boolean destruct)
        Ensures that a proper destruction occurrence is in the model on this lifeline.
        Parameters:
        lifeline - lifeline for which to ensure destruction occurrence.
        destruct - indicates whether lifeline is destructed or not.
        Returns:
        true if destruction event was changed
      • enableExecutionSpecificationModeling

        public static void enableExecutionSpecificationModeling​(DiagramPresentationElement diagramPresentationElement)
                                                         throws java.lang.IllegalArgumentException,
                                                                java.lang.IllegalStateException
        Enable ExecutionSpecification modeling in given Sequence diagram.
        Parameters:
        diagramPresentationElement - sequence diagram.
        Throws:
        java.lang.IllegalArgumentException - if diagram is not sequence diagram.
        java.lang.IllegalStateException - if session is not created at the current moment, or diagram is not loaded.
      • setFirstEvent

        public static void setFirstEvent​(DurationConstraint constraint,
                                         Element constrainedElement,
                                         boolean value)
        Sets firstEvent value for a given constrained element Does nothing if given element is not a constrained element or firstEvent list size is out of sync with constrainedElement list size.
        Parameters:
        constraint - constraint
        constrainedElement - constrained element
        value - firstEvent value
      • isFirstEvent

        @CheckForNull
        public static java.lang.Boolean isFirstEvent​(DurationConstraint constraint,
                                                     Element constrainedElement)
        Returns firstEvent value for a given constrained element by index.
        Parameters:
        constraint - constraint
        constrainedElement - constrained element
        Returns:
        value or null if given element is not a constrained element or firstEvent list size is out of the sync with constrainedElement list size