UML

org.topcased.modeler.uml.sequencediagram
Class SequenceUtils

java.lang.Object
  extended by org.topcased.modeler.uml.sequencediagram.SequenceUtils

public final class SequenceUtils
extends java.lang.Object

Utility class to manipulate UML EObjects for the sequence diagram.


Field Summary
static int ALIGNEMENT_MESSAGE_STEP
          The step where the message becomes rectilinear
 
Method Summary
static int alignPosAnchor(org.eclipse.draw2d.geometry.Point pos, org.eclipse.draw2d.geometry.Point oppositepos)
          Align a position of an anchor to the opposite anchor if they are on "approximatively" on the same ordinate
static GraphConnector createGraphConnector(org.eclipse.draw2d.geometry.Point p, GraphElement element, GraphEdge graphEdge)
          Create a new graph connector
static GraphConnector getGraphConnector(org.eclipse.uml2.uml.MessageOccurrenceSpecification occurrenceSpecification, GraphNode edgeContainer)
          Return the connector corresponding to the occurrenceSpecification
static java.util.Collection getMessageArguments(org.eclipse.uml2.uml.Message message)
          Get the collection of arguments of the signature of a message.
static org.eclipse.uml2.uml.MessageEvent getMessageEvent(org.eclipse.uml2.uml.Message msg)
          Get the MessageEvent associated with a Message.
static java.lang.String getMessageNotation(org.eclipse.uml2.uml.Message message)
          Get the notation of the message
static org.eclipse.uml2.uml.MessageOccurrenceSpecification getMessageOccurrenceSpecification(GraphConnector connector)
          Return the occurrenceSpecification corresponding to the connector
static org.eclipse.draw2d.geometry.Point getOccurrenceSpecificationPosition(org.eclipse.draw2d.IFigure figure, GraphNode edgeContainer, org.eclipse.uml2.uml.MessageOccurrenceSpecification occurrenceSpecification)
          Get the occurrenceSpecification position on the lifeline
static java.lang.String getOperationCallText(org.eclipse.uml2.uml.Operation operation)
          Get the text representing the typical call of an the operation This function will return a string with the operation name and a sequence of '-' for each parameter.
static org.eclipse.draw2d.geometry.Point getSourceAbsolutePosition(MessageEditPart msgEdit)
          Return the absolute position of the source of the message
static org.eclipse.draw2d.geometry.Point getSourcePosition(MessageEditPart msgEdit)
          Return the relative position of the source of the message
static java.lang.String getStringValue(org.eclipse.uml2.uml.ValueSpecification valueSpec)
          Return the string representation of the ValueSpecification
static org.eclipse.draw2d.geometry.Point getTargetAbsolutePosition(MessageEditPart msgEdit)
          Return the absolute position of the target of the message
static org.eclipse.draw2d.geometry.Point getTargetPosition(MessageEditPart msgEdit)
          Return the relative position of the target of the message
static void insertOccurrenceSpecification(GraphEdge edge, org.eclipse.draw2d.IFigure figure, org.eclipse.uml2.uml.MessageOccurrenceSpecification newOccurrenceSpecification, org.eclipse.uml2.uml.Lifeline lifeline, org.eclipse.draw2d.geometry.Point newPos)
          Insert an OccurrenceSpecification to the lifeline at the correct postition If there is another occurrenceSpecification corresponding a message which is not drawn on the diagram, the new occurrenceSpecification is inserted before it.
static boolean isCall(org.eclipse.uml2.uml.Message message)
          Return true if the message is a Call Message
static boolean isCreateMessage(org.eclipse.uml2.uml.Message message)
          Return true if the message is a Create Message
static boolean isDeleteMessage(org.eclipse.uml2.uml.Message message)
          Return true if the message is a Delete Message
static boolean isReplyMessage(org.eclipse.uml2.uml.Message message)
          Return true if the message is a reply message
static boolean isSignal(org.eclipse.uml2.uml.Message message)
          Return true if the message is a Signal Message
static boolean isSynchCallMessage(org.eclipse.uml2.uml.Message message)
          Return true if the message is a SynchronousCall Message
static void removeGraphConnector(GraphConnector connector, GraphElement element, GraphEdge graphedge)
          Remove a graph connector from the model
static void setMessageEventSignature(org.eclipse.uml2.uml.MessageEvent messEvent, org.eclipse.uml2.uml.NamedElement signature)
          This method is used to set the signature of a MessageEvent
static void updateArguments(java.util.Collection newArguments, java.util.Collection oldArguments)
          Deprecated. The update of the Arguments should be done step by step
static void updateOccurrenceSpecification(GraphEdge edge, org.eclipse.uml2.uml.MessageOccurrenceSpecification changedOccurrenceSpecification, org.eclipse.draw2d.geometry.Point newPos, BaseEditPart oldNodeEdit, BaseEditPart newNodeEdit)
          Update an occurrenceSpecification
static void updateStartAndFinishOccurrenceSpecification(BehaviorExecutionSpecificationEditPart execEdit)
          Set the start and finish OccurrenceSpecification of an ExecutionOccurrence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIGNEMENT_MESSAGE_STEP

public static final int ALIGNEMENT_MESSAGE_STEP
The step where the message becomes rectilinear

See Also:
Constant Field Values
Method Detail

insertOccurrenceSpecification

public static void insertOccurrenceSpecification(GraphEdge edge,
                                                 org.eclipse.draw2d.IFigure figure,
                                                 org.eclipse.uml2.uml.MessageOccurrenceSpecification newOccurrenceSpecification,
                                                 org.eclipse.uml2.uml.Lifeline lifeline,
                                                 org.eclipse.draw2d.geometry.Point newPos)
Insert an OccurrenceSpecification to the lifeline at the correct postition If there is another occurrenceSpecification corresponding a message which is not drawn on the diagram, the new occurrenceSpecification is inserted before it.

Parameters:
edge - the edge of the new occurrenceSpecification
figure - the figure of the edge (or node for lost or found)
newOccurrenceSpecification - the new OccurrenceSpecification to insert
lifeline - the lifeline
newPos - the position of the occurrenceSpecification on the lifeline

getOccurrenceSpecificationPosition

public static org.eclipse.draw2d.geometry.Point getOccurrenceSpecificationPosition(org.eclipse.draw2d.IFigure figure,
                                                                                   GraphNode edgeContainer,
                                                                                   org.eclipse.uml2.uml.MessageOccurrenceSpecification occurrenceSpecification)
Get the occurrenceSpecification position on the lifeline

Parameters:
figure - the figure owning the anchor of the occurrenceSpecification
edgeContainer - the graph node that contains every edge
occurrenceSpecification - the occurrenceSpecification
Returns:
the position on the lifeline

getSourcePosition

public static org.eclipse.draw2d.geometry.Point getSourcePosition(MessageEditPart msgEdit)
Return the relative position of the source of the message

Parameters:
msgEdit - the edit part of the message
Returns:
the relative source position

getTargetPosition

public static org.eclipse.draw2d.geometry.Point getTargetPosition(MessageEditPart msgEdit)
Return the relative position of the target of the message

Parameters:
msgEdit - the edit part of the message
Returns:
the relative target position

getSourceAbsolutePosition

public static org.eclipse.draw2d.geometry.Point getSourceAbsolutePosition(MessageEditPart msgEdit)
Return the absolute position of the source of the message

Parameters:
msgEdit - the edit part of the message
Returns:
the absolute source position

getTargetAbsolutePosition

public static org.eclipse.draw2d.geometry.Point getTargetAbsolutePosition(MessageEditPart msgEdit)
Return the absolute position of the target of the message

Parameters:
msgEdit - the edit part of the message
Returns:
the absolute target position

alignPosAnchor

public static int alignPosAnchor(org.eclipse.draw2d.geometry.Point pos,
                                 org.eclipse.draw2d.geometry.Point oppositepos)
Align a position of an anchor to the opposite anchor if they are on "approximatively" on the same ordinate

Parameters:
oppositepos - absolute position of the opposite anchor
pos - position of the anchor the align
Returns:
the difference of the aligned position and the initial position

updateStartAndFinishOccurrenceSpecification

public static void updateStartAndFinishOccurrenceSpecification(BehaviorExecutionSpecificationEditPart execEdit)
Set the start and finish OccurrenceSpecification of an ExecutionOccurrence. The start ExecutionOccurrence will be the top OccurrenceSpecification on the ExecutionOccurrence. The finish ExecutionOccurrence will be the bottom OccurrenceSpecification on the ExecutionOccurrence.

Parameters:
execEdit - the edit part of the ExecutionSpecification

getGraphConnector

public static GraphConnector getGraphConnector(org.eclipse.uml2.uml.MessageOccurrenceSpecification occurrenceSpecification,
                                               GraphNode edgeContainer)
Return the connector corresponding to the occurrenceSpecification

Parameters:
occurrenceSpecification - the occurrenceSpecification
edgeContainer - the container of the edge (the diagram node)
Returns:
the graph connector of the event

getMessageOccurrenceSpecification

public static org.eclipse.uml2.uml.MessageOccurrenceSpecification getMessageOccurrenceSpecification(GraphConnector connector)
Return the occurrenceSpecification corresponding to the connector

Parameters:
connector - the connector
Returns:
the occurrenceSpecification of the graph connector

createGraphConnector

public static GraphConnector createGraphConnector(org.eclipse.draw2d.geometry.Point p,
                                                  GraphElement element,
                                                  GraphEdge graphEdge)
Create a new graph connector

Parameters:
p - the position of the connector
element - the receiving graph element
graphEdge - the owning graph edge
Returns:
the new graph connector

removeGraphConnector

public static void removeGraphConnector(GraphConnector connector,
                                        GraphElement element,
                                        GraphEdge graphedge)
Remove a graph connector from the model

Parameters:
connector - the connector to remove
element - the element wich receive the connector
graphedge - the owning graph edge

updateOccurrenceSpecification

public static void updateOccurrenceSpecification(GraphEdge edge,
                                                 org.eclipse.uml2.uml.MessageOccurrenceSpecification changedOccurrenceSpecification,
                                                 org.eclipse.draw2d.geometry.Point newPos,
                                                 BaseEditPart oldNodeEdit,
                                                 BaseEditPart newNodeEdit)
Update an occurrenceSpecification

Parameters:
edge - the egde of the occurrenceSpecification
changedOccurrenceSpecification - the changed occurrenceSpecification
newPos - the new position of the occurrenceSpecification
oldNodeEdit - the old receiving node
newNodeEdit - the new receiving node

getOperationCallText

public static java.lang.String getOperationCallText(org.eclipse.uml2.uml.Operation operation)
Get the text representing the typical call of an the operation This function will return a string with the operation name and a sequence of '-' for each parameter. For example, a function with 3 arguments : function(-, -, -)

Parameters:
operation - the operation
Returns:
the call text

isSignal

public static boolean isSignal(org.eclipse.uml2.uml.Message message)
Return true if the message is a Signal Message

Parameters:
message - the message to check
Returns:
true if the message is a Signal Message

isCall

public static boolean isCall(org.eclipse.uml2.uml.Message message)
Return true if the message is a Call Message

Parameters:
message - the message to check
Returns:
true if the message is a Call Signal

isSynchCallMessage

public static boolean isSynchCallMessage(org.eclipse.uml2.uml.Message message)
Return true if the message is a SynchronousCall Message

Parameters:
message - the message to check
Returns:
true if the message is a SynchronousCall Message

isReplyMessage

public static boolean isReplyMessage(org.eclipse.uml2.uml.Message message)
Return true if the message is a reply message

Parameters:
message - the Message to check
Returns:
true if the message is a reply message

isCreateMessage

public static boolean isCreateMessage(org.eclipse.uml2.uml.Message message)
Return true if the message is a Create Message

Parameters:
message - the Message to check
Returns:
true if the message is a Create Message

isDeleteMessage

public static boolean isDeleteMessage(org.eclipse.uml2.uml.Message message)
Return true if the message is a Delete Message

Parameters:
message - the Message to check
Returns:
true if the message is a Delete Message

getMessageArguments

public static java.util.Collection getMessageArguments(org.eclipse.uml2.uml.Message message)
Get the collection of arguments of the signature of a message. The signature must be an Operation or a Signal. The contents of the returned Collection are of type MessageArgument

Parameters:
message - the Message
Returns:
a Collection of MessageArgument

updateArguments

public static void updateArguments(java.util.Collection newArguments,
                                   java.util.Collection oldArguments)
Deprecated. The update of the Arguments should be done step by step

Complete the list of MessageArgument by the lacking parameters values, and remove the unexisting ones. This function is used when the parameters of the operation has change, so we need to update the arguments of a Message.

Parameters:
newArguments - the new collection of MessageArgument
oldArguments - the old collection of MessageArgument

setMessageEventSignature

public static void setMessageEventSignature(org.eclipse.uml2.uml.MessageEvent messEvent,
                                            org.eclipse.uml2.uml.NamedElement signature)
This method is used to set the signature of a MessageEvent

Parameters:
messEvent - the MessageEvent
signature - the newSignature. This may be a null Signature.

getMessageEvent

public static org.eclipse.uml2.uml.MessageEvent getMessageEvent(org.eclipse.uml2.uml.Message msg)
Get the MessageEvent associated with a Message. The MessageEvent will be associated with the Signature of the Message. So we first search the SendEvent and then the ReceiveEvent in the case of the SendEvent does not exist.

Parameters:
msg - the Message
Returns:
the MessageEvent that will be associated with the Signature of the Message

getMessageNotation

public static java.lang.String getMessageNotation(org.eclipse.uml2.uml.Message message)
Get the notation of the message

Parameters:
message - the message
Returns:
the notation of the message

getStringValue

public static java.lang.String getStringValue(org.eclipse.uml2.uml.ValueSpecification valueSpec)
Return the string representation of the ValueSpecification

Parameters:
valueSpec - the ValueSpecification
Returns:
the string representation of the ValueSpecification

UML

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.