diff options
Diffstat (limited to 'src/uml/qumlrealization.cpp')
-rw-r--r-- | src/uml/qumlrealization.cpp | 341 |
1 files changed, 11 insertions, 330 deletions
diff --git a/src/uml/qumlrealization.cpp b/src/uml/qumlrealization.cpp index 72432cd3..a0d23b3c 100644 --- a/src/uml/qumlrealization.cpp +++ b/src/uml/qumlrealization.cpp @@ -40,346 +40,27 @@ ****************************************************************************/ #include "qumlrealization.h" -#include <QtUml/QUmlComment> -#include <QtUml/QUmlDependency> -#include <QtUml/QUmlElement> -#include <QtUml/QUmlNamedElement> -#include <QtUml/QUmlNamespace> -#include <QtUml/QUmlOpaqueExpression> -#include <QtUml/QUmlPackage> -#include <QtUml/QUmlParameterableElement> -#include <QtUml/QUmlStringExpression> -#include <QtUml/QUmlTemplateParameter> - -QT_BEGIN_NAMESPACE +#include "private/qumlrealizationobject_p.h" /*! - \class UmlRealization + \class QUmlRealization \inmodule QtUml \brief Realization is a specialized abstraction relationship between two sets of model elements, one representing a specification (the supplier) and the other represents an implementation of the latter (the client). Realization can be used to model stepwise refinement, optimizations, transformations, templates, model synthesis, framework composition, etc. */ - -QUmlRealization::QUmlRealization(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlRealization::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlRealization::ownedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); -} - -/*! - The Element that owns this element. - */ -QUmlElement *QUmlRealization::owner() const -{ - return reinterpret_cast<QUmlElement *>(_owner); -} - -// OWNED ATTRIBUTES [ParameterableElement] - -/*! - The formal template parameter that owns this element. - */ -QUmlTemplateParameter *QUmlRealization::owningTemplateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_owningTemplateParameter); -} - -/*! - The template parameter that exposes this element as a formal parameter. - */ -QUmlTemplateParameter *QUmlRealization::templateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_templateParameter); -} - -// OWNED ATTRIBUTES [NamedElement] - -/*! - Indicates the dependencies that reference the client. - */ -const QSet<QUmlDependency *> QUmlRealization::clientDependency() const -{ - return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency)); -} - -/*! - The name of the NamedElement. - */ -QString QUmlRealization::name() const -{ - return _name; -} - -/*! - The string expression used to define the name of this named element. - */ -QUmlStringExpression *QUmlRealization::nameExpression() const -{ - return reinterpret_cast<QUmlStringExpression *>(_nameExpression); -} - -/*! - Specifies the namespace that owns the NamedElement. - */ -QUmlNamespace *QUmlRealization::namespace_() const -{ - return reinterpret_cast<QUmlNamespace *>(_namespace_); -} - -/*! - A name which allows the NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from the names of the containing namespaces starting at the root of the hierarchy and ending with the name of the NamedElement itself. - */ -QString QUmlRealization::qualifiedName() const -{ - return UmlNamedElement::qualifiedName(); -} -// OWNED ATTRIBUTES [PackageableElement] - -/*! - Indicates that packageable elements must always have a visibility, i.e., visibility is not optional. - */ -QtUml::VisibilityKind QUmlRealization::visibility() const -{ - return _visibility; -} - -// OWNED ATTRIBUTES [Relationship] - -/*! - Specifies the elements related by the Relationship. - */ -const QSet<QUmlElement *> QUmlRealization::relatedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_relatedElement)); -} - -// OWNED ATTRIBUTES [DirectedRelationship] - -/*! - Specifies the sources of the DirectedRelationship. - */ -const QSet<QUmlElement *> QUmlRealization::source() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_source)); -} - -/*! - Specifies the targets of the DirectedRelationship. - */ -const QSet<QUmlElement *> QUmlRealization::target() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_target)); -} - -// OWNED ATTRIBUTES [Dependency] - -/*! - The element(s) dependent on the supplier element(s). In some cases (such as a Trace Abstraction) the assignment of direction (that is, the designation of the client element) is at the discretion of the modeler, and is a stipulation. - */ -const QSet<QUmlNamedElement *> QUmlRealization::client() const -{ - return *(reinterpret_cast<const QSet<QUmlNamedElement *> *>(&_client)); -} - -/*! - The element(s) independent of the client element(s), in the same respect and the same dependency relationship. In some directed dependency relationships (such as Refinement Abstractions), a common convention in the domain of class-based OO software is to put the more abstract element in this role. Despite this convention, users of UML may stipulate a sense of dependency suitable for their domain, which makes a more abstract element dependent on that which is more specific. - */ -const QSet<QUmlNamedElement *> QUmlRealization::supplier() const -{ - return *(reinterpret_cast<const QSet<QUmlNamedElement *> *>(&_supplier)); -} - -// OWNED ATTRIBUTES [Abstraction] - -/*! - An composition of an Expression that states the abstraction relationship between the supplier and the client. In some cases, such as Derivation, it is usually formal and unidirectional; in other cases, such as Trace, it is usually informal and bidirectional. The mapping expression is optional and may be omitted if the precise relationship between the elements is not specified. - */ -QUmlOpaqueExpression *QUmlRealization::mapping() const -{ - return reinterpret_cast<QUmlOpaqueExpression *>(_mapping); -} - -// OPERATIONS [Element] - -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlRealization::allOwnedElements() const -{ - QSet<QUmlElement *> r; - foreach (UmlElement *element, UmlElement::allOwnedElements()) - r.insert(reinterpret_cast<QUmlElement *>(element)); - return r; -} - -/*! - The query mustBeOwned() indicates whether elements of this type must have an owner. Subclasses of Element that do not require an owner must override this operation. - */ -bool QUmlRealization::mustBeOwned() const -{ - return UmlElement::mustBeOwned(); -} - -// OPERATIONS [ParameterableElement] - -/*! - The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints. - */ -bool QUmlRealization::isCompatibleWith(QUmlParameterableElement *p) const -{ - return UmlParameterableElement::isCompatibleWith(p); -} - -/*! - The query isTemplateParameter() determines if this parameterable element is exposed as a formal template parameter. - */ -bool QUmlRealization::isTemplateParameter() const -{ - return UmlParameterableElement::isTemplateParameter(); -} - -// OPERATIONS [NamedElement] - -/*! - The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards. - */ -QList<QUmlNamespace *> QUmlRealization::allNamespaces() const -{ - QList<QUmlNamespace *> r; - foreach (UmlNamespace *element, UmlNamedElement::allNamespaces()) - r.append(reinterpret_cast<QUmlNamespace *>(element)); - return r; -} - -/*! - The query allOwningPackages() returns all the directly or indirectly owning packages. - */ -QSet<QUmlPackage *> QUmlRealization::allOwningPackages() const -{ - QSet<QUmlPackage *> r; - foreach (UmlPackage *element, UmlNamedElement::allOwningPackages()) - r.insert(reinterpret_cast<QUmlPackage *>(element)); - return r; -} - -/*! - The query isDistinguishableFrom() determines whether two NamedElements may logically co-exist within a Namespace. By default, two named elements are distinguishable if (a) they have unrelated types or (b) they have related types but different names. - */ -bool QUmlRealization::isDistinguishableFrom(QUmlNamedElement *n, QUmlNamespace *ns) const -{ - return UmlNamedElement::isDistinguishableFrom(n, ns); -} - -/*! - The query separator() gives the string that is used to separate names when constructing a qualified name. - */ -QString QUmlRealization::separator() const -{ - return UmlNamedElement::separator(); -} - -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlRealization::addOwnedComment(UmlComment *ownedComment) -{ - UmlElement::addOwnedComment(ownedComment); -} - -void QUmlRealization::removeOwnedComment(UmlComment *ownedComment) -{ - UmlElement::removeOwnedComment(ownedComment); -} - -// SLOTS FOR OWNED ATTRIBUTES [ParameterableElement] - -void QUmlRealization::setOwningTemplateParameter(QUmlTemplateParameter *owningTemplateParameter) -{ - UmlParameterableElement::setOwningTemplateParameter(owningTemplateParameter); -} - -void QUmlRealization::setTemplateParameter(QUmlTemplateParameter *templateParameter) -{ - UmlParameterableElement::setTemplateParameter(templateParameter); -} - -// SLOTS FOR OWNED ATTRIBUTES [NamedElement] - -void QUmlRealization::addClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::addClientDependency(clientDependency); -} - -void QUmlRealization::removeClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::removeClientDependency(clientDependency); -} - -void QUmlRealization::setName(QString name) +QUmlRealization::QUmlRealization(bool createQObject) : + QUmlAbstraction(false) { - UmlNamedElement::setName(name); + if (createQObject) + _qObject = new QUmlRealizationObject(this); } -void QUmlRealization::setNameExpression(QUmlStringExpression *nameExpression) +QUmlRealization::~QUmlRealization() { - UmlNamedElement::setNameExpression(nameExpression); + if (!deletingFromQObject) { + _qObject->setProperty("deletingFromModelingObject", true); + delete _qObject; + } } -// SLOTS FOR OWNED ATTRIBUTES [PackageableElement] - -void QUmlRealization::setVisibility(QtUml::VisibilityKind visibility) -{ - UmlPackageableElement::setVisibility(visibility); -} - -// SLOTS FOR OWNED ATTRIBUTES [Relationship] - -// SLOTS FOR OWNED ATTRIBUTES [DirectedRelationship] - -// SLOTS FOR OWNED ATTRIBUTES [Dependency] - -void QUmlRealization::addClient(UmlNamedElement *client) -{ - UmlDependency::addClient(client); -} - -void QUmlRealization::removeClient(UmlNamedElement *client) -{ - UmlDependency::removeClient(client); -} - -void QUmlRealization::addSupplier(UmlNamedElement *supplier) -{ - UmlDependency::addSupplier(supplier); -} - -void QUmlRealization::removeSupplier(UmlNamedElement *supplier) -{ - UmlDependency::removeSupplier(supplier); -} - -// SLOTS FOR OWNED ATTRIBUTES [Abstraction] - -void QUmlRealization::setMapping(QUmlOpaqueExpression *mapping) -{ - UmlAbstraction::setMapping(mapping); -} - -QT_END_NAMESPACE |