Package com.nomagic.uml2.ext.jmi.helpers
Class InteractionHelper
java.lang.Object
com.nomagic.uml2.ext.jmi.helpers.InteractionHelper
Helper methods for dealing with model in interactions (sequence).
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Parameter
addParameterForOperation
(Operation operation, String name, boolean generateName) static Parameter
addParameterForOperation
(Operation operation, String name, boolean generateName, ParameterDirectionKind directionKind) Adds a parameter to an operation with a given name.static Property
addPropertyForSignal
(Signal signal, String name, boolean generateName) static boolean
canChangeMessageType
(Message message) Checks if this message can change its type.static void
changeSynchForMessage
(Message message) Change synch for message.static String
constructMessageText
(Message message, boolean showParameters) Deprecated.static ValueSpecification
createArgumentForMessage
(Message message, Type type) Creates an argument for a message.static ValueSpecification
createArgumentForMessage
(Message message, Type type, ValueSpecification defaultValue) Creates an argument for a message.static void
createArgumentsForCallMessage
(Message message) Creates the arguments for call message.static Duration
Deprecated.static Duration
createDuration
(DurationInterval interval, boolean createObservation) Create duration for duration interval min or max.static Property
createProperty
(String propertyName, Classifier type, Interaction inter) Creates property into interaction for the lifeline use.createReceiveEventByMessageSort
(Message message) Creates receive event occurrence according message sortstatic TimeExpression
Deprecated.static TimeExpression
createTimeExpression
(TimeInterval timeInterval, boolean createObservation) Creates time expression for give time interval min or max.static void
disposeMessageArguments
(Message message) Dispose message arguments.static void
enableExecutionSpecificationModeling
(DiagramPresentationElement diagramPresentationElement) Enable ExecutionSpecification modeling in given Sequence diagram.static boolean
ensureDestructionOccurrence
(Lifeline lifeline, boolean destruct) Ensures that a proper destruction occurrence is in the model on this lifeline.static void
ensureFragmentsAreInFragmentCollection
(Collection<InteractionFragment> collection, Collection<InteractionFragment> fragments) Ensures that fragments are in given fragment collection.static Operation
findCallOperation
(String name, Classifier classifier, List<Operation> preferredOperations, Message message) Find call operation.static Operation
findCallOperationWithArguments
(String name, Classifier classifier, List<Operation> preferredOperations, int paramCount, Message message) Find call operation, which has closest parameter count.static Interaction
findInteraction
(Element interactionElement) Finds interaction for a given interaction element.static Signal
findSignalForMessage
(Message message, String name) Find signal for message.Get argument supported value specification classes.static Collection<Operation>
Gets operations which are available to select for a call message.static Collection<Signal>
getAvailableSignals
(Message message) Gets all available signals to select for a message.Gets destruction occurrence specification from a given lifeline.Gets destruction occurrence specification from a given lifeline.static String[]
getIntervalMinMax
(IntervalConstraint interval) Returns min and max values.static Object[]
getIntervalMinMaxValues
(IntervalConstraint interval) Returns min and max values.static Collection<Lifeline>
getLifelines
(Message message) Returns lifelines that are covered by given messagestatic Classifier
getLifelineType
(Lifeline lifeline) Gets the lifeline type.static Message
getMessage
(Gate gate) Returns message, to which this gate is connected.static Classifier
getMessageEndClassifier
(Message message, boolean client) Returns classifier - receiver of message.getMessages
(Lifeline lifeline) Return all connected messages from given lifeline.static Message
getMessageSubstitute
(Message message) Returns message substitute for given message or the given message, if no substitution found.static String
getNestedNumberAsString
(List number) Gets the nested number as string.static Operation
getOperationOfCallMessage
(Message message) Gets the operation of call message.static Parameter
getOperationParameterByName
(Operation op, String name) Finds parameter from the operation by given namegetOperations
(Classifier classifier, Message message) Returns all operations for call actionsstatic Collection<Operation>
getOperationsForCallAction
(Classifier classifier) Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.static Collection<Operation>
getOperationsForCallAction
(Classifier classifier, Message message) Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.getPairableGate
(CombinedFragment fragment, boolean replayMessage) Gets iterator of Gates, which can be used to be formal pair of the gate.getPairableGate
(InteractionUse use, boolean replayMessage) Gets iterator of Gates, which can be used to be formal pair of the gate.static Element
getReceiveElement
(Message message) Gets the receive element.static Classifier
getReceiverClassifier
(Message message) Returns classifier - receiver of message.static ConnectableElement
getRemovableConnectableElement
(Lifeline lifeline) Check if the represents can be removed along with lifeline.static Message
getReplyMessage
(Message message) Return receive event holder of the given message.static int
getReturnParameterPosition
(Operation operation) Gets the return parameter position.static Classifier
getSendClassifier
(Message message) Returns classifier - receiver of message.static Element
getSendElement
(Message message) Return send event holder of the given message.static Property
getSignalAttributeByName
(Signal signal, String name) static Property
Gets signal attribute if it exists for a given message argument.static Signal
getSignalOfMessage
(Message message) Gets the signal of message.static Classifier
getStateInvariantClassifier
(StateInvariant stateInvariant) Gets classifier which is related to a given state invariant through a lifeline.static Constraint
getStateInvariantConstraint
(StateInvariant stateInvariant, boolean create) Gets state invariant constraint from state invariant.static State
getStateInvariantState
(StateInvariant stateInvariant) Retrieves state which is set to a given state invariant.static void
initCoveredInfo
(InteractionFragment fragment, Lifeline lifeline) Initializes the covered info.static void
initMessage
(Message message, Element source, Element target) Initializes message by the given source and target.static void
initMessage
(Message message, Lifeline source, Lifeline target) Initializes the message.static void
initOperationForCallMessage
(Message message, Classifier classifier, Operation operation) Init the operation for call message.static boolean
isCallMessage
(Message message) Indicates if message is a call message.static boolean
isCreateMessage
(Message message) Checks if is creates the message.static boolean
isDestroyMessage
(Message message) Checks if is destroy message.static Boolean
isFirstEvent
(DurationConstraint constraint, Element constrainedElement) Returns firstEvent value for a given constrained element by index.static boolean
isFoundMessage
(Message message) Indicates if given message is a found message.static boolean
isInsideMessage
(Message message, CombinedFragment fragment) Checks if given message is inside the fragment.static Element
isLifelinePort
(Message message) Checks if lifeline from message supplier is port and exists in lifeline context.static boolean
isLostMessage
(Message message) Indicates if given message is a lost message.static boolean
Checks if message send end is Gate (Message send from diagram border)static boolean
isReplyMessage
(Message message) Indicates if this message is a reply message.static boolean
isSendMessage
(Message message) Checks if is send message.static boolean
isSynchMessage
(Message message) Checks if is synch message.static void
makeFoundMessage
(Message message) Turns a message to a found message by removing its sending end and setting necessary properties.static void
makeLostMessage
(Message message) Turns a message to a lost message by removing its receiving end and setting necessary properties.static void
makeMessageOperationCallable
(Message message) If message is not call, makes it call.static String
parseArgumentName
(String text) Parses argument from parameter=argument tuple.static void
parseArguments
(Message message, String s) Parses arguments from string and sets them as message arguments.static String
parseParameterName
(String text) Parses parameter from parameter=argument tuple.static int
removeReturnParameter
(List parameters) Removes the return parameter.static void
setDurationInterval
(DurationConstraint durationConstraint, String minMax) Sets duration interval data.static void
setDurationInterval
(DurationConstraint dc, String minValue, String maxValue) Sets duration interval.static void
setDurationInterval
(DurationInterval durationInterval, String minMax, boolean createObservation) Sets duration interval value.static void
setDurationInterval
(DurationInterval interval, String minValue, String maxValue, boolean createObservation) Sets duration interval.static void
setDurationOwner
(Duration duration, Element findParentFrom) Sets the duration owner.static void
setEventForDuration
(Duration duration, NamedElement event1, NamedElement event2) Sets events for first DurationObservation referenced by given Duration.static void
setEventForDurationInterval
(DurationInterval interval, NamedElement event1, NamedElement event2, boolean createObservations) Sets events for DurationInterval min and max durations.static void
setEventForTimeExpression
(TimeExpression timeExpression, NamedElement event) Sets event for first time observation referenced by a given time expression.static void
setEventForTimeInterval
(TimeInterval interval, NamedElement event, boolean createObservation) Sets event for Time Interval min and max expressions.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.static void
Sets the guard.static void
setLifelineType
(Lifeline lifeline, Type type) Sets the lifeline type.static void
setMessageArguments
(Message message, List<ValueSpecification> arguments) Sets the message arguments.static void
setMessageSort
(Message message, MessageSort sort) Changes message sort by the given one.static void
setOperationForMessage
(Message message, Operation operation, boolean createArguments) Sets the operation for message.static void
setReturnValue
(Message message, String value) Sets the return value.static void
setReturnValueForMessage
(Message message, String value) Sets the return value for message.static void
setSignalForMessage
(Message message, Signal signal) Sets the signal for message.static void
setStateForStateInvariant
(StateInvariant stateInvariant, State state, boolean createConstraintIfNecessary) Sets state for state invariant to represent.static void
Sets the target.static void
setTimeExpressionOwner
(TimeExpression timeExpression, Element findParentFrom) Sets the time expression owner.static void
setTimeInterval
(TimeConstraint timeConstraint, String minMax) Sets time interval for a time constraint.static void
setTimeInterval
(TimeConstraint timeConstraint, String minValue, String maxValue) Sets time interval for a given time constraint.static void
setTimeInterval
(TimeInterval timeInterval, String minMax, boolean createObservation) Sets time interval data.static void
setTimeInterval
(TimeInterval timeInterval, String minValue, String maxValue, boolean createObservation) Sets time interval data.
-
Field Details
-
KEEP_ALL_OPERATION
- See Also:
-
-
Constructor Details
-
InteractionHelper
public InteractionHelper()
-
-
Method Details
-
isLostMessage
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
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
Checks if is send message.- Parameters:
message
- the message- Returns:
- true, if is send message
-
isSynchMessage
Checks if is synch message.- Parameters:
message
- the message- Returns:
- true, if is synch message
-
isDestroyMessage
Checks if is destroy message.- Parameters:
message
- the message- Returns:
- true, if is destroy message
-
isReplyMessage
Indicates if this message is a reply message.- Parameters:
message
- - message to check.- Returns:
- true if this is a reply message, false otherwise.
-
isCallMessage
Indicates if message is a call message.- Parameters:
message
- - message to check.- Returns:
- true if this message is a call message, false otherwise.
-
isCreateMessage
Checks if is creates the message.- Parameters:
message
- the message- Returns:
- true, if is creates the message
-
canChangeMessageType
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
Returns classifier - receiver of message.- Parameters:
message
- message- Returns:
- classifier
-
getSendClassifier
Returns classifier - receiver of message.- Parameters:
message
- message- Returns:
- classifier
-
getMessageEndClassifier
Returns classifier - receiver of message.- Parameters:
message
- messageclient
- the client- Returns:
- classifier
-
makeMessageOperationCallable
If message is not call, makes it call.- Parameters:
message
- message to check.
-
changeSynchForMessage
Change synch for message.- Parameters:
message
- the message
-
setMessageSort
Changes message sort by the given one. NOTE Message must have parent- Parameters:
message
- Given message, to change sortsort
- Given sort kind, one from MessageSortEnum- See Also:
-
initMessage
Initializes the message.- Parameters:
message
- the messagesource
- the sourcetarget
- the target
-
createReceiveEventByMessageSort
Creates receive event occurrence according message sort- Parameters:
message
- message- Returns:
- MessageOccurrenceSpecification
-
initCoveredInfo
Initializes the covered info.- Parameters:
fragment
- the fragmentlifeline
- the lifeline
-
findInteraction
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
- messagesource
- sourcetarget
- target
-
makeLostMessage
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
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.
-
constructMessageText
-
getMessageSubstitute
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
Gets the operation of call message.- Parameters:
message
- the message- Returns:
- the operation of call message
-
getSignalOfMessage
Gets the signal of message.- Parameters:
message
- the message- Returns:
- the signal of message
-
getSignalAttributeForArgument
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 messageoperation
- the operationcreateArguments
- the create arguments
-
setSignalForMessage
Sets the signal for message.- Parameters:
message
- the messagesignal
- the signal
-
findSignalForMessage
Find signal for message.- Parameters:
message
- the messagename
- the name- Returns:
- the signal
-
getAvailableOperationsForCallMessage
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
Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.- Parameters:
classifier
- classifier- Returns:
- classifiers
-
getOperationsForCallAction
public static Collection<Operation> getOperationsForCallAction(@CheckForNull Classifier classifier, @CheckForNull Message message) Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.- Parameters:
classifier
- classifiermessage
- call message- Returns:
- classifiers
-
getOperations
public static 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
Checks if message send end is Gate (Message send from diagram border)- Parameters:
message
- message- Returns:
- true if is not Gate, else false
-
isLifelinePort
Checks if lifeline from message supplier is port and exists in lifeline context.- Parameters:
message
- message- Returns:
- true if is port else false
-
getLifelines
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(String name, Classifier classifier, @CheckForNull 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 nameclassifier
- the classifierpreferredOperations
- list of preferred operationsparamCount
- preferred parameter countmessage
- call message- Returns:
- the operation
-
findCallOperation
@CheckForNull public static Operation findCallOperation(String name, Classifier classifier, @CheckForNull List<Operation> preferredOperations, Message message) Find call operation.- Parameters:
name
- the nameclassifier
- the classifierpreferredOperations
- the preferred operationsmessage
- call message- Returns:
- the operation
-
createArgumentsForCallMessage
Creates the arguments for call message.- Parameters:
message
- the message
-
createArgumentForMessage
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
Get argument supported value specification classes.- Returns:
- value specification classes.
-
getNestedNumberAsString
Gets the nested number as string.- Parameters:
number
- the number- Returns:
- the nested number as string
-
createProperty
public static Property createProperty(String propertyName, @CheckForNull Classifier type, Interaction inter) Creates property into interaction for the lifeline use.- Parameters:
propertyName
- nametype
- typeinter
- interaction- Returns:
- created property
-
disposeMessageArguments
Dispose message arguments.- Parameters:
message
- the message
-
setMessageArguments
public static void setMessageArguments(Message message, List<ValueSpecification> arguments) throws ParseException Sets the message arguments.- Parameters:
message
- the messagearguments
- the arguments- Throws:
ParseException
- the parse exception
-
removeReturnParameter
Removes the return parameter.- Parameters:
parameters
- the parameters- Returns:
- the int
-
setTarget
Sets the target.- Parameters:
message
- the messagetarget
- the target
-
setGuard
Sets the guard.- Parameters:
message
- the messageguard
- the guard
-
getReceiveElement
Gets the receive element.- Parameters:
message
- the message- Returns:
- the receive element
-
getSendElement
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
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
Sets the return value.- Parameters:
message
- the messagevalue
- the value
-
getReturnParameterPosition
Gets the return parameter position.- Parameters:
operation
- the operation- Returns:
- the return parameter position
-
setReturnValueForMessage
Sets the return value for message.- Parameters:
message
- the messagevalue
- the value
-
parseArguments
Parses arguments from string and sets them as message arguments.- Parameters:
message
- messages
- 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 messageclassifier
- the classifieroperation
- the op
-
setLifelineType
Sets the lifeline type.- Parameters:
lifeline
- the lifelinetype
- the type
-
getStateInvariantClassifier
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
Gets the lifeline type.- Parameters:
lifeline
- the lifeline- Returns:
- the lifeline type
-
getRemovableConnectableElement
Check if the represents can be removed along with lifeline.- Parameters:
lifeline
- lifeline- Returns:
- connectible element that should be disposed
-
setTimeInterval
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, String minValue, 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
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 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
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 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.
-
createTimeExpression
Deprecated.Creates time expression.- Parameters:
tc
- constraint- Returns:
- expression
-
createTimeExpression
public static TimeExpression createTimeExpression(TimeInterval timeInterval, boolean createObservation) Creates time expression for give time interval min or max.- Parameters:
timeInterval
- intervalcreateObservation
- create observation- Returns:
- expression
-
setTimeExpressionOwner
Sets the time expression owner.- Parameters:
timeExpression
- the time expressionfindParentFrom
- the find parent from
-
getIntervalMinMax
Returns min and max values. If not exist - can be null- Parameters:
interval
- interval- Returns:
- min max values
-
getIntervalMinMaxValues
Returns min and max values. If not exist - can be null- Parameters:
interval
- interval- Returns:
- min max values
-
createDuration
Deprecated.Creates duration with appropriate DurationObservationAction and min and max values.- Parameters:
dc
- constraint- Returns:
- constraint
-
createDuration
Create duration for duration interval min or max.- Parameters:
interval
- intervalcreateObservation
- create observation- Returns:
- duration
-
setDurationOwner
Sets the duration owner.- Parameters:
duration
- the durationfindParentFrom
- the find parent from
-
setDurationInterval
public static void setDurationInterval(DurationConstraint dc, @CheckForNull String minValue, @CheckForNull String maxValue) Sets duration interval.- Parameters:
dc
- constraintminValue
- min valuemaxValue
- max value
-
setDurationInterval
public static void setDurationInterval(DurationInterval interval, @CheckForNull String minValue, @CheckForNull String maxValue, boolean createObservation) Sets duration interval.- Parameters:
interval
- intervalminValue
- min valuemaxValue
- max valuecreateObservation
- create observation
-
isInsideMessage
Checks if given message is inside the fragment. Check - if given message has one end with the same covered lifeline asfragment
does - if given message has one end to the nested fragment Message is expected to have one end connected tofragment
- Parameters:
message
- Message to check if ii is insidefragment
- Check if given message is inside THIS fragment- Returns:
- true if given message is inside the given fragment
-
getMessage
Returns message, to which this gate is connected.- Parameters:
gate
- given gate to check message- Returns:
- Message, which is connected to the gate
-
getPairableGate
Gets iterator of Gates, which can be used to be formal pair of the gate.- Parameters:
use
- given interaction usereplayMessage
- if true, than all messages will be returned which are pairable for replay message kind- Returns:
- Iterator of gates. Not null.
-
getPairableGate
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 fragmentreplayMessage
- 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 intervalevent
- eventcreateObservation
- 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
- durationevent1
- event or nullevent2
- 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 intervalevent1
- event or nullevent2
- event or nullcreateObservations
- 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
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
Return all connected messages from given lifeline.- Parameters:
lifeline
- lifeline- Returns:
- all messages connected to this lifeline.
-
parseParameterName
Parses parameter from parameter=argument tuple.- Parameters:
text
- text to parse.- Returns:
- parsed parameter name.
-
parseArgumentName
Parses argument from parameter=argument tuple.- Parameters:
text
- text to parse.- Returns:
- parsed argument name.
-
addParameterForOperation
-
addParameterForOperation
@CheckForNull public static Parameter addParameterForOperation(Operation operation, 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
-
getOperationParameterByName
Finds parameter from the operation by given name- Parameters:
op
- provided operationname
- name for the parameter- Returns:
- parameter or null
-
getSignalAttributeByName
-
ensureFragmentsAreInFragmentCollection
public static void ensureFragmentsAreInFragmentCollection(Collection<InteractionFragment> collection, 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
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(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
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 IllegalArgumentException, IllegalStateException Enable ExecutionSpecification modeling in given Sequence diagram.- Parameters:
diagramPresentationElement
- sequence diagram.- Throws:
IllegalArgumentException
- if diagram is not sequence diagram.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
- constraintconstrainedElement
- constrained elementvalue
- firstEvent value
-
isFirstEvent
@CheckForNull public static Boolean isFirstEvent(DurationConstraint constraint, Element constrainedElement) Returns firstEvent value for a given constrained element by index.- Parameters:
constraint
- constraintconstrainedElement
- 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
-
ModelTextCreator.createMessageText(Message, MessageTextParams, Supplier)