org.argouml.model.uml
Class CollaborationsFactoryImpl

java.lang.Object
  extended byorg.argouml.model.uml.AbstractUmlModelFactory
      extended byorg.argouml.model.uml.CollaborationsFactoryImpl
All Implemented Interfaces:
org.argouml.model.CollaborationsFactory

public class CollaborationsFactoryImpl
extends AbstractUmlModelFactory
implements org.argouml.model.CollaborationsFactory

Factory to create UML classes for the UML BehaviorialElements::Collaborations package. TODO: Change visibility to package after reflection problem solved.

Since:
ARGO0.11.2

Field Summary
private  NSUMLModelImplementation nsmodel
          The model implementation.
 
Constructor Summary
(package private) CollaborationsFactoryImpl(NSUMLModelImplementation implementation)
          Don't allow instantiation.
 
Method Summary
 Object buildActivator(Object owner, Object interaction)
          Builds an activator for some message.
 Object buildAssociationEndRole(Object atype)
          Builds an associationendrole based on some classifierrole.
 Object buildAssociationRole(Object link)
          Builds an associationrole based on a given link.
 Object buildAssociationRole(Object from, Object to)
          Builds a binary associationrole on basis of two classifierroles.
 Object buildAssociationRole(Object from, Object agg1, Object to, Object agg2, Boolean unidirectional)
          Builds a binary associationrole on basis of two classifierroles, navigation and aggregation.
 Object buildClassifierRole(Object collaboration)
          Creates a classifierrole and adds it to the given collaboration.
 Object buildCollaboration(Object handle)
          Builds a default collaboration not attached to a classifier.
 Object buildCollaboration(Object namespace, Object representedElement)
          Builds a collaboration that is owned by a certain namespace and represents the given represented element.
 Object buildInteraction(Object handle)
          Builds an interaction belonging to some collaboration.
 Object buildMessage(Object acollab, Object arole)
          Builds a message within some collaboration or interaction.
private  Object buildMessageCollab(Object acollab, Object arole)
           
private  ru.novosoft.uml.behavior.collaborations.MMessage buildMessageInteraction(ru.novosoft.uml.behavior.collaborations.MInteraction inter, ru.novosoft.uml.behavior.collaborations.MAssociationRole role)
          Builds a message within some interaction related to some assocationrole.
 Object createAssociationEndRole()
          Create an empty but initialized instance of a UML AssociationEndRole.
 Object createAssociationRole()
          Create an empty but initialized instance of a UML AssociationRole.
 Object createClassifierRole()
          Create an empty but initialized instance of a UML ClassifierRole.
 Object createCollaboration()
          Create an empty but initialized instance of a UML Collaboration.
 Object createInteraction()
          Create an empty but initialized instance of a UML Interaction.
 Object createMessage()
          Create an empty but initialized instance of a UML Message.
(package private)  void deleteAssociationEndRole(Object elem)
           
(package private)  void deleteAssociationRole(Object elem)
           
(package private)  void deleteClassifierRole(Object elem)
           
(package private)  void deleteCollaboration(Object elem)
           
(package private)  void deleteInteraction(Object elem)
           
(package private)  void deleteMessage(Object elem)
           
private  ru.novosoft.uml.behavior.collaborations.MMessage findEnd(ru.novosoft.uml.behavior.collaborations.MMessage m)
          Walks the tree of successors to m rooted until a leaf is found.
private  ru.novosoft.uml.behavior.collaborations.MMessage lastMessage(Collection c, ru.novosoft.uml.behavior.collaborations.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nsmodel

private NSUMLModelImplementation nsmodel
The model implementation.

Constructor Detail

CollaborationsFactoryImpl

CollaborationsFactoryImpl(NSUMLModelImplementation implementation)
Don't allow instantiation.

Parameters:
implementation - To get other helpers and factories.
Method Detail

createAssociationEndRole

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

Specified by:
createAssociationEndRole in interface org.argouml.model.CollaborationsFactory
Returns:
an initialized UML AssociationEndRole instance.

createAssociationRole

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

Specified by:
createAssociationRole in interface org.argouml.model.CollaborationsFactory
Returns:
an initialized UML AssociationRole instance.

createClassifierRole

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

Specified by:
createClassifierRole in interface org.argouml.model.CollaborationsFactory
Returns:
an initialized UML ClassifierRole instance.

createCollaboration

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

Specified by:
createCollaboration in interface org.argouml.model.CollaborationsFactory
Returns:
an initialized UML Collaboration instance.

createInteraction

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

Specified by:
createInteraction in interface org.argouml.model.CollaborationsFactory
Returns:
an initialized UML Interaction instance.

createMessage

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

Specified by:
createMessage in interface org.argouml.model.CollaborationsFactory
Returns:
an initialized UML Message instance.

buildClassifierRole

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

Specified by:
buildClassifierRole in interface org.argouml.model.CollaborationsFactory
Parameters:
collaboration - the given collaboration
Returns:
the created classifier role

buildCollaboration

public Object buildCollaboration(Object handle)
Builds a default collaboration not attached to a classifier. I.e. the represented element is NOT filled in.

Specified by:
buildCollaboration in interface org.argouml.model.CollaborationsFactory
Parameters:
handle - the namespace for the collaboration
Returns:
the created collaboration

buildCollaboration

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

Specified by:
buildCollaboration in interface org.argouml.model.CollaborationsFactory
Parameters:
namespace - the namespace for the collaboration
representedElement - the represented element
Returns:
the created collaboration

buildInteraction

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

Specified by:
buildInteraction in interface org.argouml.model.CollaborationsFactory
Parameters:
handle - the collaboration that will be the context for the new interaction
Returns:
the newly build interaction

buildAssociationEndRole

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

Specified by:
buildAssociationEndRole in interface org.argouml.model.CollaborationsFactory
Parameters:
atype - the classifierrole
Returns:
the associationendrole

buildAssociationRole

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

Specified by:
buildAssociationRole in interface org.argouml.model.CollaborationsFactory
Parameters:
from - the first classifierrole
to - the second classifierrole
Returns:
the newly build associationrole

buildAssociationRole

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

Specified by:
buildAssociationRole in interface org.argouml.model.CollaborationsFactory
Parameters:
from - the first classifierrole
agg1 - the first aggregationkind
to - the second classifierrole
agg2 - the second aggregationkind
unidirectional - true if unidirectional
Returns:
the newly build assoc. role

buildAssociationRole

public Object buildAssociationRole(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.

Specified by:
buildAssociationRole in interface org.argouml.model.CollaborationsFactory
Parameters:
link - a UML Link
Returns:
the newly created association role (an Object)

buildMessageInteraction

private ru.novosoft.uml.behavior.collaborations.MMessage buildMessageInteraction(ru.novosoft.uml.behavior.collaborations.MInteraction inter,
                                                                                 ru.novosoft.uml.behavior.collaborations.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.

Parameters:
inter - The Interaction.
role - The Association Role.
Returns:
The newly created Message.

lastMessage

private ru.novosoft.uml.behavior.collaborations.MMessage lastMessage(Collection c,
                                                                     ru.novosoft.uml.behavior.collaborations.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 ru.novosoft.uml.behavior.collaborations.MMessage findEnd(ru.novosoft.uml.behavior.collaborations.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 Object buildMessage(Object acollab,
                           Object arole)
Builds a message within some collaboration or interaction.

Specified by:
buildMessage in interface org.argouml.model.CollaborationsFactory
Parameters:
acollab - a collaboration or interaction
arole - an associationrole
Returns:
the newly build message

buildMessageCollab

private Object buildMessageCollab(Object acollab,
                                  Object arole)

buildActivator

public Object buildActivator(Object owner,
                             Object interaction)
Builds an activator for some message.

Specified by:
buildActivator in interface org.argouml.model.CollaborationsFactory
Parameters:
owner - the owner
interaction - the interaction
Returns:
the newly build message

deleteAssociationEndRole

void deleteAssociationEndRole(Object elem)
Parameters:
elem - the associationendrole

deleteAssociationRole

void deleteAssociationRole(Object elem)
Parameters:
elem - the associationrole

deleteClassifierRole

void deleteClassifierRole(Object elem)
Parameters:
elem - the UML element to be deleted

deleteCollaboration

void deleteCollaboration(Object elem)
Parameters:
elem - the UML element to be delete

deleteInteraction

void deleteInteraction(Object elem)
Parameters:
elem - the UML element to be delete

deleteMessage

void deleteMessage(Object elem)
Parameters:
elem - the UML element to be delete


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