org.argouml.model.uml.behavioralelements.collaborations
Class CollaborationsFactory

java.lang.Object
  |
  +--org.argouml.model.uml.AbstractUmlModelFactory
        |
        +--org.argouml.model.uml.behavioralelements.collaborations.CollaborationsFactory

public class CollaborationsFactory
extends AbstractUmlModelFactory

Factory to create UML classes for the UML BehaviorialElements::Collaborations package.

Since:
ARGO0.11.2

Field Summary
private static CollaborationsFactory SINGLETON
          Singleton instance.
 
Fields inherited from class org.argouml.model.uml.AbstractUmlModelFactory
 
Constructor Summary
private CollaborationsFactory()
          Don't allow instantiation
 
Method Summary
 MMessage buildActivator(MMessage owner, MInteraction interaction)
          Builds an activator for some message
 MAssociationEndRole buildAssociationEndRole(java.lang.Object atype)
          Builds an associationendrole based on some classifierrole
 MAssociationRole buildAssociationRole(MClassifierRole from, MAggregationKind agg1, MClassifierRole to, MAggregationKind agg2, java.lang.Boolean unidirectional)
          Builds a binary associationrole on basis of two classifierroles, navigation and aggregation
 java.lang.Object buildAssociationRole(java.lang.Object link)
          Builds an associationrole based on a given link.
 MAssociationRole buildAssociationRole(java.lang.Object from, java.lang.Object to)
          Builds a binary associationrole on basis of two classifierroles
 java.lang.Object buildClassifierRole(java.lang.Object collaboration)
          Creates a classifierrole and adds it to the given collaboration
 MCollaboration buildCollaboration(java.lang.Object handle)
          Builds a default collaboration not attached to a classifier
 java.lang.Object buildCollaboration(java.lang.Object namespace, java.lang.Object representedElement)
          Builds a collaboration that is owned by a certain namespace and represents the given represented element.
 MInteraction buildInteraction(java.lang.Object handle)
          Builds an interaction belonging to some collaboration
 java.lang.Object buildMessage(java.lang.Object acollab, java.lang.Object arole)
          Builds a message within some collaboration or interaction.
private  java.lang.Object buildMessageCollab(java.lang.Object acollab, java.lang.Object arole)
           
private  MMessage buildMessageInteraction(MInteraction inter, MAssociationRole role)
          Builds a message within some interaction related to some assocationrole.
 MAssociationEndRole createAssociationEndRole()
          Create an empty but initialized instance of a UML AssociationEndRole.
 MAssociationRole createAssociationRole()
          Create an empty but initialized instance of a UML AssociationRole.
 MClassifierRole createClassifierRole()
          Create an empty but initialized instance of a UML ClassifierRole.
 MCollaboration createCollaboration()
          Create an empty but initialized instance of a UML Collaboration.
 MInteraction createInteraction()
          Create an empty but initialized instance of a UML Interaction.
 MMessage createMessage()
          Create an empty but initialized instance of a UML Message.
 void deleteAssociationEndRole(MAssociationEndRole elem)
           
 void deleteAssociationRole(MAssociationRole elem)
           
 void deleteClassifierRole(MClassifierRole elem)
           
 void deleteCollaboration(MCollaboration elem)
           
 void deleteInteraction(MInteraction elem)
           
 void deleteMessage(MMessage elem)
           
private  MMessage findEnd(MMessage m)
          Walks the tree of successors to m rooted until a leaf is found.
static CollaborationsFactory getFactory()
          Singleton instance access method.
private  MMessage lastMessage(java.util.Collection c, MMessage m)
          Finds the last message in the collection not equal to null and not equal to m.
 
Methods inherited from class org.argouml.model.uml.AbstractUmlModelFactory
addListenersToModelElement, initialize, isGuiEnabled, setGuiEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON

private static CollaborationsFactory SINGLETON
Singleton instance.

Constructor Detail

CollaborationsFactory

private CollaborationsFactory()
Don't allow instantiation

Method Detail

getFactory

public static CollaborationsFactory getFactory()
Singleton instance access method.


createAssociationEndRole

public MAssociationEndRole createAssociationEndRole()
Create an empty but initialized instance of a UML AssociationEndRole.

Returns:
an initialized UML AssociationEndRole instance.

createAssociationRole

public MAssociationRole createAssociationRole()
Create an empty but initialized instance of a UML AssociationRole.

Returns:
an initialized UML AssociationRole instance.

createClassifierRole

public MClassifierRole createClassifierRole()
Create an empty but initialized instance of a UML ClassifierRole.

Returns:
an initialized UML ClassifierRole instance.

createCollaboration

public MCollaboration createCollaboration()
Create an empty but initialized instance of a UML Collaboration.

Returns:
an initialized UML Collaboration instance.

createInteraction

public MInteraction createInteraction()
Create an empty but initialized instance of a UML Interaction.

Returns:
an initialized UML Interaction instance.

createMessage

public MMessage createMessage()
Create an empty but initialized instance of a UML Message.

Returns:
an initialized UML Message instance.

buildClassifierRole

public java.lang.Object buildClassifierRole(java.lang.Object collaboration)
Creates a classifierrole and adds it to the given collaboration

Parameters:
collaboration -
Returns:
the created classifier role

buildCollaboration

public MCollaboration buildCollaboration(java.lang.Object handle)
Builds a default collaboration not attached to a classifier


buildCollaboration

public java.lang.Object buildCollaboration(java.lang.Object namespace,
                                           java.lang.Object representedElement)
Builds a collaboration that is owned by a certain namespace and represents the given represented element.

Parameters:
namespace -
representedElement -
Returns:
the created collaboration

buildInteraction

public MInteraction buildInteraction(java.lang.Object handle)
Builds an interaction belonging to some collaboration


buildAssociationEndRole

public MAssociationEndRole buildAssociationEndRole(java.lang.Object atype)
Builds an associationendrole based on some classifierrole


buildAssociationRole

public MAssociationRole buildAssociationRole(java.lang.Object from,
                                             java.lang.Object to)
Builds a binary associationrole on basis of two classifierroles


buildAssociationRole

public MAssociationRole buildAssociationRole(MClassifierRole from,
                                             MAggregationKind agg1,
                                             MClassifierRole to,
                                             MAggregationKind agg2,
                                             java.lang.Boolean unidirectional)
Builds a binary associationrole on basis of two classifierroles, navigation and aggregation


buildAssociationRole

public java.lang.Object buildAssociationRole(java.lang.Object link)
Builds an associationrole based on a given link. The link must have a source and a destination instance that both have a classifierrole as classifier. The classifierroles must have the same collaboration as owner. This collaboration will be the new owner of the associationrole.

Parameters:
link -
Returns:
the newly created association role (an Object)

buildMessageInteraction

private MMessage buildMessageInteraction(MInteraction inter,
                                         MAssociationRole role)
Builds a message within some interaction related to some assocationrole. The message is added as the last in the interaction sequence. Furthermore, the message is added as the last to the list of messages allready attached to the role. Effectively, the allready attached messages become predecessors of this message.


lastMessage

private MMessage lastMessage(java.util.Collection c,
                             MMessage m)
Finds the last message in the collection not equal to null and not equal to m.

Parameters:
c - A collection containing exclusively MMessages.
m - A MMessage.
Returns:
The last message in the collection, or null.

findEnd

private MMessage findEnd(MMessage m)
Walks the tree of successors to m rooted until a leaf is found. The leaf is the returned. If m is itself a leaf, then m is returned.

Parameters:
m - A MMessage.
Returns:
The last message in one branch of the tree rooted at m.

buildMessage

public java.lang.Object buildMessage(java.lang.Object acollab,
                                     java.lang.Object arole)
Builds a message within some collaboration or interaction.


buildMessageCollab

private java.lang.Object buildMessageCollab(java.lang.Object acollab,
                                            java.lang.Object arole)

buildActivator

public MMessage buildActivator(MMessage owner,
                               MInteraction interaction)
Builds an activator for some message


deleteAssociationEndRole

public void deleteAssociationEndRole(MAssociationEndRole elem)

deleteAssociationRole

public void deleteAssociationRole(MAssociationRole elem)

deleteClassifierRole

public void deleteClassifierRole(MClassifierRole elem)

deleteCollaboration

public void deleteCollaboration(MCollaboration elem)

deleteInteraction

public void deleteInteraction(MInteraction elem)

deleteMessage

public void deleteMessage(MMessage elem)


ArgoUML © 1996-2004 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook