umbrello API Documentation

UMLAssociation Class Reference

This class contains the non-graphic representation of an association. Sets up association information. More...

#include <association.h>

Inheritance diagram for UMLAssociation:

UMLObject List of all members.

Public Member Functions

 UMLAssociation (Uml::Association_Type type, UMLObject *roleA, UMLObject *roleB)
 Sets up an association.
 UMLAssociation (Uml::Association_Type type=Uml::at_Unknown)
 Constructs an association - for loading only.
bool operator== (UMLAssociation &rhs)
 Overloaded '==' operator.
virtual ~UMLAssociation ()
 Standard deconstructor.
QString toString () const
 Returns a String representation of this UMLAssociation.
Uml::Association_Type getAssocType () const
 Returns the Association_Type of the UMLAssociation.
UMLObjectgetObject (Uml::Role_Type role)
 Returns the UMLObject assigned to the given role.
Uml::IDType getObjectId (Uml::Role_Type role)
 Returns the ID of the UMLObject assigned to the given role.
Uml::Changeability_Type getChangeability (Uml::Role_Type role) const
 Returns the Changeablity of the given role.
Uml::Visibility getVisibility (Uml::Role_Type role) const
 Returns the Visibility of the given role.
QString getMulti (Uml::Role_Type role) const
 Returns the multiplicity assigned to the given role.
QString getRoleName (Uml::Role_Type role) const
 Returns the name assigned to the role A.
QString getRoleDoc (Uml::Role_Type role) const
 Returns the documentation assigned to the given role.
void setAssocType (Uml::Association_Type assocType)
 Sets the assocType of the UMLAssociation.
void setObject (UMLObject *obj, Uml::Role_Type role)
 Sets the UMLObject playing the given role in the association.
void setVisibility (Uml::Visibility value, Uml::Role_Type role)
 Sets the visibility of the given role of the UMLAssociation.
void setChangeability (Uml::Changeability_Type value, Uml::Role_Type role)
 Sets the changeability of the given role of the UMLAssociation.
void setMulti (const QString &multi, Uml::Role_Type role)
 Sets the multiplicity of the given role of the UMLAssociation.
void setRoleName (const QString &roleName, Uml::Role_Type role)
 Sets the name of the given role of the UMLAssociation.
void setRoleDoc (const QString &doc, Uml::Role_Type role)
 Sets the documentation on the given role in the association.
UMLRolegetUMLRole (Uml::Role_Type role)
 Get the underlying UMLRole object for the given role.
void setOldLoadMode (bool value=true)
 Set backward compatibility flag for loading version 1.3.x files.
bool getOldLoadMode () const
 Return the backward compatibility flag for loading files.
virtual UMLObjectclone () const
 Make a clone of this object.
virtual bool resolveRef ()
 Resolve types.
void saveToXMI (QDomDocument &qDoc, QDomElement &qElement)
 Creates the <UML:Generalization> or <UML:Association> XMI element including its role objects.

Static Public Member Functions

static QString typeAsString (Uml::Association_Type atype)
 Converts a Uml::Association_Type to its string representation.
static bool assocTypeHasUMLRepresentation (Uml::Association_Type atype)
 Returns true if the given Association_Type has a representation as a UMLAssociation.
static QString ChangeabilityToString (Uml::Changeability_Type type)
 Convert Changeability_Type value into QString representation.

Protected Member Functions

bool load (QDomElement &element)
 Creates the <UML:Generalization> or <UML:Association> XMI element including its role objects.
void init (Uml::Association_Type type, UMLObject *roleAObj, UMLObject *roleBObj)
 Common initializations at construction time.

Protected Attributes

int nrof_parent_widgets
UMLRolem_pRole [2]
Uml::Association_Type m_AssocType
QString m_Name
 The objects name.
bool m_bOldLoadMode

Static Protected Attributes

static const Uml::Association_Type atypeFirst = Uml::at_Generalization
static const Uml::Association_Type atypeLast = Uml::at_Relationship
static const unsigned int nAssocTypes
static const QString assocTypeStr []

Friends

class AssociationWidget

Detailed Description

This class contains the non-graphic representation of an association. Sets up association information.

An association can be a generalization, realization, simple association, directed association, aggregation, or composition.

Author:
Oliver Kellogg <okellogg@users.sourceforge.net>
See also:
UMLObject Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org

Definition at line 33 of file association.h.


Constructor & Destructor Documentation

UMLAssociation::UMLAssociation Uml::Association_Type  type,
UMLObject roleA,
UMLObject roleB
 

Sets up an association.

A new unique ID is assigned internally.

Parameters:
type The Uml::Association_Type to construct.
roleA Pointer to the UMLObject in role A.
roleB Pointer to the UMLObject in role B.

Definition at line 36 of file association.cpp.

References UMLObject::init(), and UMLObject::setID().

UMLAssociation::UMLAssociation Uml::Association_Type  type = Uml::at_Unknown  ) 
 

Constructs an association - for loading only.

This constructor should not normally be used as it constructs an incomplete association (i.e. the role objects are missing.)

Parameters:
type The Uml::Association_Type to construct. Default: Uml::at_Unknown.

Definition at line 46 of file association.cpp.

References UMLObject::init().

UMLAssociation::~UMLAssociation  )  [virtual]
 

Standard deconstructor.

Definition at line 53 of file association.cpp.


Member Function Documentation

bool UMLAssociation::operator== UMLAssociation rhs  ) 
 

Overloaded '==' operator.

Definition at line 70 of file association.cpp.

References m_Name.

QString UMLAssociation::toString  )  const
 

Returns a String representation of this UMLAssociation.

Definition at line 106 of file association.cpp.

References UMLObject::getName(), UMLRole::getObject(), and typeAsString().

QString UMLAssociation::typeAsString Uml::Association_Type  atype  )  [static]
 

Converts a Uml::Association_Type to its string representation.

Parameters:
atype The Association_Type enum value to convert.
Returns:
The string representation of the Association_Type.

Definition at line 125 of file association.cpp.

Referenced by toString(), and IDLWriter::writeClass().

bool UMLAssociation::assocTypeHasUMLRepresentation Uml::Association_Type  atype  )  [static]
 

Returns true if the given Association_Type has a representation as a UMLAssociation.

Definition at line 132 of file association.cpp.

Uml::Association_Type UMLAssociation::getAssocType  )  const
 

Returns the Association_Type of the UMLAssociation.

Returns:
The Association_Type of the UMLAssociation.

Definition at line 102 of file association.cpp.

Referenced by AssociationWidget::activate(), UMLView::createAutoAssociations(), UMLDoc::findAssociation(), AssociationWidget::getAssocType(), UMLCanvasObject::getSpecificAssocs(), AssociationWidget::loadFromXMI(), UMLRole::saveToXMI(), CodeClassField::setParentUMLObject(), and IDLWriter::writeClass().

UMLObject * UMLAssociation::getObject Uml::Role_Type  role  ) 
 

Returns the UMLObject assigned to the given role.

Returns:
Pointer to the UMLObject in the given role.

Definition at line 447 of file association.cpp.

References UMLRole::getObject().

Referenced by UMLPackage::addObject(), UMLView::createAutoAssociations(), UMLDoc::findAssociation(), Model_Utils::guessContainer(), load(), UMLCanvasObject::removeAllAssociationEnds(), SQLWriter::writeClass(), PhpWriter::writeClass(), Php5Writer::writeClass(), IDLWriter::writeClass(), and CSharpWriter::writeClass().

Uml::IDType UMLAssociation::getObjectId Uml::Role_Type  role  ) 
 

Returns the ID of the UMLObject assigned to the given role.

Shorthand for getObject(role)->getID().

Returns:
ID of the UMLObject in the given role.

Definition at line 451 of file association.cpp.

References UMLObject::getID(), UMLRole::getObject(), and UMLObject::getSecondaryId().

Referenced by UMLClassifier::getUniAssociationToBeImplemented(), AssociationWidget::getWidgetID(), load(), and saveToXMI().

Changeability_Type UMLAssociation::getChangeability Uml::Role_Type  role  )  const
 

Returns the Changeablity of the given role.

Returns:
Changeability_Type of the given role.

Definition at line 475 of file association.cpp.

References UMLRole::getChangeability().

Referenced by AssociationWidget::getChangeability(), and AssociationWidget::syncToModel().

Uml::Visibility UMLAssociation::getVisibility Uml::Role_Type  role  )  const
 

Returns the Visibility of the given role.

Returns:
Visibility of the given role.

Definition at line 479 of file association.cpp.

References UMLObject::getVisibility().

Referenced by AssociationWidget::getVisibility(), and AssociationWidget::syncToModel().

QString UMLAssociation::getMulti Uml::Role_Type  role  )  const
 

Returns the multiplicity assigned to the given role.

Returns:
The multiplicity assigned to the given role.

Definition at line 483 of file association.cpp.

References UMLRole::getMultiplicity().

Referenced by AssociationWidget::syncToModel(), PhpWriter::writeClass(), Php5Writer::writeClass(), and IDLWriter::writeClass().

QString UMLAssociation::getRoleName Uml::Role_Type  role  )  const
 

Returns the name assigned to the role A.

Returns:
The name assigned to the given role.

Definition at line 487 of file association.cpp.

References UMLObject::getName().

Referenced by UMLClassifier::getUniAssociationToBeImplemented(), AssociationWidget::syncToModel(), and SQLWriter::writeClass().

QString UMLAssociation::getRoleDoc Uml::Role_Type  role  )  const
 

Returns the documentation assigned to the given role.

Returns:
Documentation text of given role.

Definition at line 491 of file association.cpp.

References UMLObject::getDoc().

Referenced by AssociationWidget::getRoleDoc().

void UMLAssociation::setAssocType Uml::Association_Type  assocType  ) 
 

Sets the assocType of the UMLAssociation.

Parameters:
assocType The Association_Type of the UMLAssociation.

Definition at line 507 of file association.cpp.

References UMLApp::getDocument(), UMLDoc::loading(), and UMLObject::modified().

Referenced by UMLRole::load(), load(), AssociationWidget::setAssocType(), and Import_Rose::umbrellify().

void UMLAssociation::setObject UMLObject obj,
Uml::Role_Type  role
 

Sets the UMLObject playing the given role in the association.

Parameters:
obj Pointer to the UMLObject of the given role.

Definition at line 522 of file association.cpp.

References UMLRole::setObject().

Referenced by AssociationWidget::setWidget().

void UMLAssociation::setVisibility Uml::Visibility  value,
Uml::Role_Type  role
 

Sets the visibility of the given role of the UMLAssociation.

Parameters:
value Visibility of role A visibility.

Definition at line 526 of file association.cpp.

References UMLObject::setVisibility().

Referenced by load(), and AssociationWidget::setVisibility().

void UMLAssociation::setChangeability Uml::Changeability_Type  value,
Uml::Role_Type  role
 

Sets the changeability of the given role of the UMLAssociation.

Parameters:
value Changeability_Type of the given role.

Definition at line 530 of file association.cpp.

References UMLRole::setChangeability().

Referenced by load(), and AssociationWidget::setChangeability().

void UMLAssociation::setMulti const QString &  multi,
Uml::Role_Type  role
 

Sets the multiplicity of the given role of the UMLAssociation.

Parameters:
multi The multiplicity of the given role.

Definition at line 534 of file association.cpp.

References UMLRole::setMultiplicity().

Referenced by load(), and AssociationWidget::setMulti().

void UMLAssociation::setRoleName const QString &  roleName,
Uml::Role_Type  role
 

Sets the name of the given role of the UMLAssociation.

Parameters:
roleName The name to set for the given role.
role The Uml::Role_Type for which to set the name.

Definition at line 538 of file association.cpp.

References UMLObject::setName().

Referenced by load(), and AssociationWidget::setRoleName().

void UMLAssociation::setRoleDoc const QString &  doc,
Uml::Role_Type  role
 

Sets the documentation on the given role in the association.

Parameters:
doc The string with the documentation.

Definition at line 542 of file association.cpp.

References UMLObject::setDoc().

Referenced by load(), and AssociationWidget::setRoleDoc().

QString UMLAssociation::ChangeabilityToString Uml::Changeability_Type  type  )  [static]
 

Convert Changeability_Type value into QString representation.

Parameters:
type The Changeability_Type enum value to convert.

Definition at line 546 of file association.cpp.

Referenced by AssociationWidget::setChangeability().

UMLRole * UMLAssociation::getUMLRole Uml::Role_Type  role  ) 
 

Get the underlying UMLRole object for the given role.

Returns:
Pointer to the UMLRole object for the given role.

Definition at line 495 of file association.cpp.

Referenced by Model_Utils::findObjectInList(), load(), resolveRef(), saveToXMI(), OwnedCodeBlock::setAttributesFromNode(), CodeParameter::setAttributesFromNode(), and Import_Rose::umbrellify().

void UMLAssociation::setOldLoadMode bool  value = true  ) 
 

Set backward compatibility flag for loading version 1.3.x files.

This flag is necessary because the handling of the isNavigable attribute of <associationend> was incorrect.

Definition at line 499 of file association.cpp.

Referenced by UMLRole::load().

bool UMLAssociation::getOldLoadMode  )  const
 

Return the backward compatibility flag for loading files.

Definition at line 503 of file association.cpp.

Referenced by UMLRole::load().

virtual UMLObject* UMLAssociation::clone  )  const [inline, virtual]
 

Make a clone of this object.

Cloning associations is not supported yet.

Implements UMLObject.

Definition at line 231 of file association.h.

bool UMLAssociation::resolveRef  )  [virtual]
 

Resolve types.

Required when dealing with foreign XMI files. Needs to be called after all UML objects are loaded from file. Overrides the method from UMLObject. Calls resolveRef() for each role.

Returns:
True for success.

Reimplemented from UMLObject.

Definition at line 145 of file association.cpp.

References UMLPackage::addAssocToConcepts(), UMLObject::getBaseType(), UMLRole::getObject(), getUMLRole(), and UMLObject::resolveRef().

void UMLAssociation::saveToXMI QDomDocument &  qDoc,
QDomElement &  qElement
[virtual]
 

Creates the <UML:Generalization> or <UML:Association> XMI element including its role objects.

Implements UMLObject.

Definition at line 162 of file association.cpp.

References getObjectId(), getUMLRole(), UMLObject::save(), and UMLRole::saveToXMI().

bool UMLAssociation::load QDomElement &  element  )  [protected, virtual]
 

Creates the <UML:Generalization> or <UML:Association> XMI element including its role objects.

Reimplemented from UMLObject.

Definition at line 193 of file association.cpp.

References Model_Utils::convert_OT_MT(), UMLDoc::findObjectById(), UMLObject::getBaseType(), UMLApp::getDocument(), UMLObject::getID(), getObject(), getObjectId(), UMLDoc::getRootFolder(), getUMLRole(), UMLObject::loadFromXMI(), setAssocType(), setChangeability(), setMulti(), UMLRole::setObject(), setRoleDoc(), setRoleName(), UMLObject::setSecondaryId(), setVisibility(), and Uml::tagEq().

void UMLAssociation::init Uml::Association_Type  type,
UMLObject roleAObj,
UMLObject roleBObj
[protected]
 

Common initializations at construction time.

Parameters:
type The Association_Type to represent.
roleAObj Pointer to the role A UMLObject.
roleBObj Pointer to the role B UMLObject.

Definition at line 561 of file association.cpp.

References UMLDoc::currentRoot(), UMLApp::getDocument(), and m_Name.


Member Data Documentation

const unsigned UMLAssociation::nAssocTypes [static, protected]
 

Initial value:

 (unsigned)atypeLast -
        (unsigned)atypeFirst + 1

Definition at line 32 of file association.cpp.

const QString UMLAssociation::assocTypeStr [static, protected]
 

Initial value:

 {
            
            i18n("Generalization"),             
            i18n("Aggregation"),                
            i18n("Dependency"),                 
            i18n("Association"),                
            i18n("Self Association"),           
            i18n("Collaboration Message"),      
            i18n("Sequence Message"),           
            i18n("Collaboration Self Message"), 
            i18n("Sequence Self Message"),      
            i18n("Containment"),                
            i18n("Composition"),                
            i18n("Realization"),                
            i18n("Uni Association"),            
            i18n("Anchor"),                     
            i18n("State Transition"),           
            i18n("Activity"),                   
        }

Definition at line 81 of file association.cpp.

QString UMLAssociation::m_Name [protected]
 

The objects name.

Reimplemented from UMLObject.

Definition at line 282 of file association.h.

Referenced by init(), and operator==().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:06 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003