Package com.nomagic.uml2.ext.jmi.helpers
Class InteractionHelper
- java.lang.Object
-
- com.nomagic.uml2.ext.jmi.helpers.InteractionHelper
-
@OpenApiAll public class InteractionHelper extends java.lang.Object
Helper methods for dealing with model in interactions (sequence).
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEEP_ALL_OPERATION
-
Constructor Summary
Constructors Constructor Description InteractionHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Parameter
addParameterForOperation(Operation operation, java.lang.String name, boolean generateName)
static Parameter
addParameterForOperation(Operation operation, java.lang.String name, boolean generateName, ParameterDirectionKind directionKind)
Adds a parameter to an operation with a given name.static Property
addPropertyForSignal(Signal signal, java.lang.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 java.lang.String
constructMessageText(Message message, boolean showParameters)
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
createDuration(DurationConstraint dc)
Deprecated.static Duration
createDuration(DurationInterval interval, boolean createObservation)
Create duration for duration interval min or max.static Property
createProperty(java.lang.String propertyName, Classifier type, Interaction inter)
Creates property into interaction for the lifeline use.static MessageOccurrenceSpecification
createReceiveEventByMessageSort(Message message)
Creates receive event occurrence according message sortstatic TimeExpression
createTimeExpression(TimeConstraint tc)
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(java.util.Collection<InteractionFragment> collection, java.util.Collection<InteractionFragment> fragments)
Ensures that fragments are in given fragment collection.static Operation
findCallOperation(java.lang.String name, Classifier classifier, java.util.List<Operation> preferredOperations, Message message)
Find call operation.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.static Interaction
findInteraction(Element interactionElement)
Finds interaction for a given interaction element.static Signal
findSignalForMessage(Message message, java.lang.String name)
Find signal for message.static java.util.List<java.lang.Class>
getArgumentSupportedValueSpecifications()
Get argument supported value specification classes.static java.util.Collection<Operation>
getAvailableOperationsForCallMessage(Message message)
Gets operations which are available to select for a call message.static java.util.Collection<Signal>
getAvailableSignals(Message message)
Gets all available signals to select for a message.static DestructionOccurrenceSpecification
getDestructionOccurrenceSpecification(Lifeline lifeline)
Gets destruction occurrence specification from a given lifeline.static DestructionOccurrenceSpecification
getDestructionOccurrenceSpecification(java.util.Collection<InteractionFragment> collection)
Gets destruction occurrence specification from a given lifeline.static java.lang.String[]
getIntervalMinMax(IntervalConstraint interval)
Returns min and max values.static java.lang.Object[]
getIntervalMinMaxValues(IntervalConstraint interval)
Returns min and max values.static java.util.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.static java.util.List<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 java.lang.String
getNestedNumberAsString(java.util.List number)
Gets the nested number as string.static Operation
getOperationOfCallMessage(Message message)
Gets the operation of call message.static Parameter
getOperationParameterByName(Operation op, java.lang.String name)
Finds parameter from the operation by given namestatic java.util.Set<Operation>
getOperations(Classifier classifier, Message message)
Returns all operations for call actionsstatic java.util.Collection<Operation>
getOperationsForCallAction(Classifier classifier)
Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.static java.util.Collection<Operation>
getOperationsForCallAction(Classifier classifier, Message message)
Collects operations from given classifiers, base classifiers and provided interfaces of given classifiers.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.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.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, java.lang.String name)
static Property
getSignalAttributeForArgument(ValueSpecification argument)
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 java.lang.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
isNotGate(Message message)
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 java.lang.String
parseArgumentName(java.lang.String text)
Parses argument from parameter=argument tuple.static void
parseArguments(Message message, java.lang.String s)
Parses arguments from string and sets them as message arguments.static java.lang.String
parseParameterName(java.lang.String text)
Parses parameter from parameter=argument tuple.static int
removeReturnParameter(java.util.List parameters)
Removes the return parameter.static void
setDurationInterval(DurationConstraint durationConstraint, java.lang.String minMax)
Sets duration interval data.static void
setDurationInterval(DurationConstraint dc, java.lang.String minValue, java.lang.String maxValue)
Sets duration interval.static void
setDurationInterval(DurationInterval durationInterval, java.lang.String minMax, boolean createObservation)
Sets duration interval value.static void
setDurationInterval(DurationInterval interval, java.lang.String minValue, java.lang.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
setGuard(Message message, java.lang.String guard)
Sets the guard.static void
setLifelineType(Lifeline lifeline, Type type)
Sets the lifeline type.static void
setMessageArguments(Message message, java.util.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, java.lang.String value)
Sets the return value.static void
setReturnValueForMessage(Message message, java.lang.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
setTarget(Message message, java.lang.String target)
Sets the target.static void
setTimeExpressionOwner(TimeExpression timeExpression, Element findParentFrom)
Sets the time expression owner.static void
setTimeInterval(TimeConstraint timeConstraint, java.lang.String minMax)
Sets time interval for a time constraint.static void
setTimeInterval(TimeConstraint timeConstraint, java.lang.String minValue, java.lang.String maxValue)
Sets time interval for a given time constraint.static void
setTimeInterval(TimeInterval timeInterval, java.lang.String minMax, boolean createObservation)
Sets time interval data.static void
setTimeInterval(TimeInterval timeInterval, java.lang.String minValue, java.lang.String maxValue, boolean createObservation)
Sets time interval data.
-
-
-
Field Detail
-
KEEP_ALL_OPERATION
public static final java.lang.String KEEP_ALL_OPERATION
- See Also:
- Constant Field Values
-
-
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 message)
Checks if is synch message.- Parameters:
message
- the message- Returns:
- true, if is synch message
-
isDestroyMessage
public static boolean isDestroyMessage(Message message)
Checks if is destroy message.- Parameters:
message
- the message- 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 message)
Checks if is creates the message.- Parameters:
message
- the message- 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
- messageclient
- 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 sortsort
- Given sort kind, one from MessageSortEnum- See Also:
MessageSortEnum
-
initMessage
public static void initMessage(Message message, Lifeline source, Lifeline target)
Initializes the message.- Parameters:
message
- the messagesource
- the sourcetarget
- 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 fragmentlifeline
- 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
- messagesource
- sourcetarget
- 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.
-
constructMessageText
@Deprecated public static java.lang.String constructMessageText(Message message, boolean showParameters)
-
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 messageoperation
- the operationcreateArguments
- the create arguments
-
setSignalForMessage
public static void setSignalForMessage(Message message, Signal signal)
Sets the signal for message.- Parameters:
message
- the messagesignal
- the signal
-
findSignalForMessage
@CheckForNull public static Signal findSignalForMessage(Message message, java.lang.String name)
Find signal for message.- Parameters:
message
- the messagename
- 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
- classifiermessage
- 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, @CheckForNull 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 nameclassifier
- the classifierpreferredOperations
- list of preferred operationsparamCount
- preferred parameter countmessage
- call message- Returns:
- the operation
-
findCallOperation
@CheckForNull public static Operation findCallOperation(java.lang.String name, Classifier classifier, @CheckForNull java.util.List<Operation> preferredOperations, Message message)
Find call operation.- Parameters:
name
- the nameclassifier
- the classifierpreferredOperations
- the preferred operationsmessage
- 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
- nametype
- typeinter
- 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 messagearguments
- 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 messagetarget
- the target
-
setGuard
public static void setGuard(Message message, java.lang.String guard)
Sets the guard.- Parameters:
message
- the messageguard
- 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 messagevalue
- 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 messagevalue
- 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
- 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
public static void setLifelineType(Lifeline lifeline, @CheckForNull Type type)
Sets the lifeline type.- Parameters:
lifeline
- the lifelinetype
- 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.
-
createTimeExpression
@Deprecated public static TimeExpression createTimeExpression(TimeConstraint tc)
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
public static void setTimeExpressionOwner(TimeExpression timeExpression, Element findParentFrom)
Sets the time expression owner.- Parameters:
timeExpression
- the time expressionfindParentFrom
- 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
-
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
@Deprecated public static Duration createDuration(DurationConstraint dc)
Deprecated.Creates duration with appropriate DurationObservationAction and min and max values.- Parameters:
dc
- constraint- Returns:
- constraint
-
createDuration
public static Duration createDuration(DurationInterval interval, boolean createObservation)
Create duration for duration interval min or max.- Parameters:
interval
- intervalcreateObservation
- create observation- Returns:
- duration
-
setDurationOwner
public static void setDurationOwner(Duration duration, Element findParentFrom)
Sets the duration owner.- Parameters:
duration
- the durationfindParentFrom
- 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
- constraintminValue
- min valuemaxValue
- 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
- intervalminValue
- min valuemaxValue
- max valuecreateObservation
- create observation
-
isInsideMessage
public static boolean isInsideMessage(@CheckForNull Message message, CombinedFragment fragment)
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
@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 usereplayMessage
- 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 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
@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 operationname
- 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
- constraintconstrainedElement
- constrained elementvalue
- 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
- 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
-
-