org.argouml.model
Class AbstractCollaborationsHelperDecorator

java.lang.Object
  extended by org.argouml.model.AbstractCollaborationsHelperDecorator
All Implemented Interfaces:
CollaborationsHelper

public abstract class AbstractCollaborationsHelperDecorator
extends java.lang.Object
implements CollaborationsHelper

An abstract Decorator for the CollaborationsHelper.


Constructor Summary
protected AbstractCollaborationsHelperDecorator(CollaborationsHelper component)
           
 
Method Summary
 void addBase(java.lang.Object arole, java.lang.Object abase)
          Adds a base to the given classifierrole.
 void addConstrainingElement(java.lang.Object handle, java.lang.Object constraint)
          Add a constraining element.
 void addInstance(java.lang.Object classifierRole, java.lang.Object instance)
          Adds an instance to a classifier role.
 void addMessage(java.lang.Object handle, java.lang.Object elem)
          Add a message to an interaction or association role.
 void addPredecessor(java.lang.Object handle, java.lang.Object predecessor)
          Adds a predecessor to a message.
 void addSuccessor(java.lang.Object handle, java.lang.Object mess)
          Add Message to a predecessor Message.
 java.util.Collection allAvailableContents(java.lang.Object arole)
          Returns all available contents for a given classifierrole as defined in section 2.10.3.3 of the UML 1.3 spec.
 java.util.Collection allAvailableFeatures(java.lang.Object arole)
          Returns all available features for a given classifierrole as defined in section 2.10.3.3 of the UML 1.3 spec.
 java.util.Collection getAllClassifierRoles(java.lang.Object ns)
          Returns all classifierroles found in this namespace and in its children.
 java.util.Collection getAllPossibleActivators(java.lang.Object ames)
          Returns all possible activators for some message mes.
 java.util.Collection getAllPossibleAssociationRoles(java.lang.Object role)
          Returns all associations the bases of the classifierrole has, thereby forming the set of associationroles the classifierrole can use.
 java.util.Collection getAllPossibleBases(java.lang.Object role)
          Returns all possible bases for the given element (a ClassifierRole or AssociationRole).
 java.util.Collection getAllPossiblePredecessors(java.lang.Object amessage)
          Returns all possible predecessors for some message, taking into account the wellformednessrules as defined in section 2.10 of the UML spec.
 java.lang.Object getAssociationRole(java.lang.Object afrom, java.lang.Object ato)
          Returns the first found associationrole between two classifierroles.
 java.util.Collection getClassifierRoles(java.lang.Object role)
          Returns all classifierroles associated via associationroles to some classifierrole role.
protected  CollaborationsHelper getComponent()
          The component we are decorating.
 boolean hasAsActivator(java.lang.Object message, java.lang.Object activator)
          Returns true if the given message has the message activator somewhere as it's activator.
 boolean isAddingCollaborationAllowed(java.lang.Object context)
          Returns true if a collaboration may be added to the given context.
 void removeBase(java.lang.Object handle, java.lang.Object c)
          This method removes a classifier from a classifier role.
 void removeConstrainingElement(java.lang.Object handle, java.lang.Object constraint)
          Remove a constraining element.
 void removeInteraction(java.lang.Object collab, java.lang.Object interaction)
          Remove an Interaction from a Collaboration.
 void removeMessage(java.lang.Object handle, java.lang.Object message)
          Removes a message from the interaction or association role.
 void removeMessage3(java.lang.Object handle, java.lang.Object mess)
           
 void removePredecessor(java.lang.Object handle, java.lang.Object message)
          Removes a predecessor message.
 void removeSuccessor(java.lang.Object handle, java.lang.Object mess)
          Removes a successor message.
 void setAction(java.lang.Object handle, java.lang.Object action)
          Sets the action to a message.
 void setActivator(java.lang.Object ames, java.lang.Object anactivator)
          Sets the activator of some given message mes.
 void setBase(java.lang.Object arole, java.lang.Object abase)
          Sets the base checking for wellformedness according to 2.10.3 in the UML 1.3 specification.
 void setBases(java.lang.Object role, java.util.Collection bases)
          Sets the bases of the given classifierrole to the given collection bases.
 void setContext(java.lang.Object handle, java.lang.Object col)
          Set the context of an interaction.
 void setPredecessors(java.lang.Object handle, java.util.Collection predecessors)
          Set the collection of predecessor messages.
 void setRepresentedClassifier(java.lang.Object handle, java.lang.Object classifier)
          Sets the represented classifier of some collaboration.
 void setRepresentedOperation(java.lang.Object handle, java.lang.Object operation)
          Sets the represented operation of some collaboration.
 void setSender(java.lang.Object handle, java.lang.Object sender)
          Sets the sender of some model element.
 void setSuccessors(java.lang.Object handle, java.util.Collection messages)
          Set the successors of a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCollaborationsHelperDecorator

protected AbstractCollaborationsHelperDecorator(CollaborationsHelper component)
Parameters:
component - The component to decorate.
Method Detail

getComponent

protected CollaborationsHelper getComponent()
The component we are decorating.

Returns:
Returns the component.

getAllClassifierRoles

public java.util.Collection getAllClassifierRoles(java.lang.Object ns)
Description copied from interface: CollaborationsHelper
Returns all classifierroles found in this namespace and in its children.

Specified by:
getAllClassifierRoles in interface CollaborationsHelper
Parameters:
ns - the namespace
Returns:
Collection collection of all classifierroles

getAllPossibleAssociationRoles

public java.util.Collection getAllPossibleAssociationRoles(java.lang.Object role)
Description copied from interface: CollaborationsHelper
Returns all associations the bases of the classifierrole has, thereby forming the set of associationroles the classifierrole can use. UML Spec 1.3 section 2.10.3.3.

Specified by:
getAllPossibleAssociationRoles in interface CollaborationsHelper
Parameters:
role - the classifierrole
Returns:
Collection the set of associationroles the classifierrole can use

getClassifierRoles

public java.util.Collection getClassifierRoles(java.lang.Object role)
Description copied from interface: CollaborationsHelper
Returns all classifierroles associated via associationroles to some classifierrole role.

Specified by:
getClassifierRoles in interface CollaborationsHelper
Parameters:
role - the classifierrole
Returns:
Collection all classifierroles associated via associationroles to the given classifierrole role

getAssociationRole

public java.lang.Object getAssociationRole(java.lang.Object afrom,
                                           java.lang.Object ato)
Description copied from interface: CollaborationsHelper
Returns the first found associationrole between two classifierroles.

Specified by:
getAssociationRole in interface CollaborationsHelper
Parameters:
afrom - the first classifierrole
ato - the second classifierrole
Returns:
MAssociationRole the association between them, or null if none

getAllPossibleActivators

public java.util.Collection getAllPossibleActivators(java.lang.Object ames)
Description copied from interface: CollaborationsHelper
Returns all possible activators for some message mes. The possible activators are all messages in the same interaction as the given message that are not part of the predecessors of the message and that are not equal to the given message.

Specified by:
getAllPossibleActivators in interface CollaborationsHelper
Parameters:
ames - the message
Returns:
Collection all possible activators for the given message

hasAsActivator

public boolean hasAsActivator(java.lang.Object message,
                              java.lang.Object activator)
Description copied from interface: CollaborationsHelper
Returns true if the given message has the message activator somewhere as it's activator. This is defined as that the message activator can be the activator itself of the given message OR that the given activator can be the activator of the activator of the given message (recursive) OR that the given activator is part of the predecessors of the activator of the given message (recursive too).

Specified by:
hasAsActivator in interface CollaborationsHelper
Parameters:
message - the given message
activator - the given activator (a message).
Returns:
boolean true if the given message has the message activator somewhere as it's activator

setActivator

public void setActivator(java.lang.Object ames,
                         java.lang.Object anactivator)
Description copied from interface: CollaborationsHelper
Sets the activator of some given message mes. Checks the wellformednessrules as defined in the UML 1.3 spec in section 2.10.3.6, will throw an IllegalArgumentException if the wellformednessrules are not met. Not only sets the activator for the given message mes but also for the predecessors of mes. This is done since it can not be the case that a list of messages (defined by the predecessor) has a different activator.

Specified by:
setActivator in interface CollaborationsHelper
Parameters:
ames - the given message
anactivator - the given activator or null.

getAllPossiblePredecessors

public java.util.Collection getAllPossiblePredecessors(java.lang.Object amessage)
Description copied from interface: CollaborationsHelper
Returns all possible predecessors for some message, taking into account the wellformednessrules as defined in section 2.10 of the UML spec.

Specified by:
getAllPossiblePredecessors in interface CollaborationsHelper
Parameters:
amessage - the given message
Returns:
Collection all possible predecessors

addBase

public void addBase(java.lang.Object arole,
                    java.lang.Object abase)
Description copied from interface: CollaborationsHelper
Adds a base to the given classifierrole. If the classifierrole does not have a name yet and there is only one base, the name of the classifierrole is set to the name of the given base according to the wellformednessrules of section 2.10.3 of the UML 1.3 spec.

Specified by:
addBase in interface CollaborationsHelper
Parameters:
arole - the given classifierrole
abase - the base to be added

setBases

public void setBases(java.lang.Object role,
                     java.util.Collection bases)
Description copied from interface: CollaborationsHelper
Sets the bases of the given classifierrole to the given collection bases.

Specified by:
setBases in interface CollaborationsHelper
Parameters:
role - the given classifierrole
bases - the given collection of bases

allAvailableFeatures

public java.util.Collection allAvailableFeatures(java.lang.Object arole)
Description copied from interface: CollaborationsHelper
Returns all available features for a given classifierrole as defined in section 2.10.3.3 of the UML 1.3 spec. Does not use the standard getAvailableFeatures method on ClassifierRole since this is derived information.

Specified by:
allAvailableFeatures in interface CollaborationsHelper
Parameters:
arole - the given classifierrole
Returns:
Collection all available features

allAvailableContents

public java.util.Collection allAvailableContents(java.lang.Object arole)
Description copied from interface: CollaborationsHelper
Returns all available contents for a given classifierrole as defined in section 2.10.3.3 of the UML 1.3 spec. Does not use the standard getAvailableContents method on ClassifierRole since this is derived information.

Specified by:
allAvailableContents in interface CollaborationsHelper
Parameters:
arole - the given classifierrole
Returns:
Collection all available contents

getAllPossibleBases

public java.util.Collection getAllPossibleBases(java.lang.Object role)
Description copied from interface: CollaborationsHelper
Returns all possible bases for the given element (a ClassifierRole or AssociationRole).

TODO: Beware: this function does not return the current base! Is that by design or a bug?

Specified by:
getAllPossibleBases in interface CollaborationsHelper
Parameters:
role - the given classifierrole or associationrole
Returns:
all available bases

setBase

public void setBase(java.lang.Object arole,
                    java.lang.Object abase)
Description copied from interface: CollaborationsHelper
Sets the base checking for wellformedness according to 2.10.3 in the UML 1.3 specification.

Either the role can be an AssociationRole in which case the given base must be an Association. Or the role can be an AssocationEndRole in which case the given base must be an AssociationEnd.

To set the base(s) of a ClassifierRole use CollaborationsHelper.setBases(Object, Collection).

Specified by:
setBase in interface CollaborationsHelper
Parameters:
arole - The given role.
abase - The base to set (or null to clear).

isAddingCollaborationAllowed

public boolean isAddingCollaborationAllowed(java.lang.Object context)
Description copied from interface: CollaborationsHelper
Returns true if a collaboration may be added to the given context. To decouple ArgoUML as much as possible from the model implementation, the parameter of the method is of type Object.

Specified by:
isAddingCollaborationAllowed in interface CollaborationsHelper
Parameters:
context - the given context
Returns:
boolean true if a collaboration may be added

removeBase

public void removeBase(java.lang.Object handle,
                       java.lang.Object c)
Description copied from interface: CollaborationsHelper
This method removes a classifier from a classifier role.

Specified by:
removeBase in interface CollaborationsHelper
Parameters:
handle - is the classifier role
c - is the classifier

removeConstrainingElement

public void removeConstrainingElement(java.lang.Object handle,
                                      java.lang.Object constraint)
Description copied from interface: CollaborationsHelper
Remove a constraining element.

Specified by:
removeConstrainingElement in interface CollaborationsHelper
Parameters:
handle - The collaboration to remove a constraint to.
constraint - The constraint to remove.

removeMessage

public void removeMessage(java.lang.Object handle,
                          java.lang.Object message)
Description copied from interface: CollaborationsHelper
Removes a message from the interaction or association role.

Specified by:
removeMessage in interface CollaborationsHelper
Parameters:
handle - The interaction or association role to remove the message from.
message - The message to remove.

removeMessage3

public void removeMessage3(java.lang.Object handle,
                           java.lang.Object mess)

removeSuccessor

public void removeSuccessor(java.lang.Object handle,
                            java.lang.Object mess)
Description copied from interface: CollaborationsHelper
Removes a successor message.

Specified by:
removeSuccessor in interface CollaborationsHelper
Parameters:
handle - the Message that needs to loose a successor
mess - the Message that is removed

removePredecessor

public void removePredecessor(java.lang.Object handle,
                              java.lang.Object message)
Description copied from interface: CollaborationsHelper
Removes a predecessor message.

Specified by:
removePredecessor in interface CollaborationsHelper
Parameters:
handle - the Message that needs to loose a predecessor
message - the Message that is removed

addConstrainingElement

public void addConstrainingElement(java.lang.Object handle,
                                   java.lang.Object constraint)
Description copied from interface: CollaborationsHelper
Add a constraining element.

Specified by:
addConstrainingElement in interface CollaborationsHelper
Parameters:
handle - The collaboration to add a constraint to.
constraint - The constraint to add.

addInstance

public void addInstance(java.lang.Object classifierRole,
                        java.lang.Object instance)
Description copied from interface: CollaborationsHelper
Adds an instance to a classifier role.

Specified by:
addInstance in interface CollaborationsHelper
Parameters:
classifierRole - is the classifier role
instance - is the instance to add

addMessage

public void addMessage(java.lang.Object handle,
                       java.lang.Object elem)
Description copied from interface: CollaborationsHelper
Add a message to an interaction or association role.

Specified by:
addMessage in interface CollaborationsHelper
Parameters:
handle - The interaction or association role.
elem - The message.

addSuccessor

public void addSuccessor(java.lang.Object handle,
                         java.lang.Object mess)
Description copied from interface: CollaborationsHelper
Add Message to a predecessor Message.

Specified by:
addSuccessor in interface CollaborationsHelper
Parameters:
handle - predecessor Message
mess - Message to be added

addPredecessor

public void addPredecessor(java.lang.Object handle,
                           java.lang.Object predecessor)
Description copied from interface: CollaborationsHelper
Adds a predecessor to a message.

Specified by:
addPredecessor in interface CollaborationsHelper
Parameters:
handle - the message
predecessor - is the predecessor

setAction

public void setAction(java.lang.Object handle,
                      java.lang.Object action)
Description copied from interface: CollaborationsHelper
Sets the action to a message.

Specified by:
setAction in interface CollaborationsHelper
Parameters:
handle - is the message
action - is the action

setContext

public void setContext(java.lang.Object handle,
                       java.lang.Object col)
Description copied from interface: CollaborationsHelper
Set the context of an interaction.

Specified by:
setContext in interface CollaborationsHelper
Parameters:
handle - The interaction.
col - The collaboration to set as the context.

setSuccessors

public void setSuccessors(java.lang.Object handle,
                          java.util.Collection messages)
Description copied from interface: CollaborationsHelper
Set the successors of a message.

Specified by:
setSuccessors in interface CollaborationsHelper
Parameters:
handle - Message
messages - Collection of successor messages

setPredecessors

public void setPredecessors(java.lang.Object handle,
                            java.util.Collection predecessors)
Description copied from interface: CollaborationsHelper
Set the collection of predecessor messages.

Specified by:
setPredecessors in interface CollaborationsHelper
Parameters:
handle - Message
predecessors - Collection of Messages

setRepresentedClassifier

public void setRepresentedClassifier(java.lang.Object handle,
                                     java.lang.Object classifier)
Description copied from interface: CollaborationsHelper
Sets the represented classifier of some collaboration.

Specified by:
setRepresentedClassifier in interface CollaborationsHelper
Parameters:
handle - the collaboration
classifier - is the classifier or null

setRepresentedOperation

public void setRepresentedOperation(java.lang.Object handle,
                                    java.lang.Object operation)
Description copied from interface: CollaborationsHelper
Sets the represented operation of some collaboration.

Specified by:
setRepresentedOperation in interface CollaborationsHelper
Parameters:
handle - the collaboration
operation - is the operation or null

setSender

public void setSender(java.lang.Object handle,
                      java.lang.Object sender)
Description copied from interface: CollaborationsHelper
Sets the sender of some model element.

Specified by:
setSender in interface CollaborationsHelper
Parameters:
handle - model element
sender - the sender

removeInteraction

public void removeInteraction(java.lang.Object collab,
                              java.lang.Object interaction)
Description copied from interface: CollaborationsHelper
Remove an Interaction from a Collaboration.

Specified by:
removeInteraction in interface CollaborationsHelper
Parameters:
collab - The collaboration.
interaction - The interaction.


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook