summaryrefslogtreecommitdiffstats
path: root/src/uml/qumlinteractionuse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uml/qumlinteractionuse.cpp')
-rw-r--r--src/uml/qumlinteractionuse.cpp381
1 files changed, 108 insertions, 273 deletions
diff --git a/src/uml/qumlinteractionuse.cpp b/src/uml/qumlinteractionuse.cpp
index 6f327a67..b497f7be 100644
--- a/src/uml/qumlinteractionuse.cpp
+++ b/src/uml/qumlinteractionuse.cpp
@@ -40,356 +40,191 @@
****************************************************************************/
#include "qumlinteractionuse.h"
-#include <QtUml/QUmlComment>
-#include <QtUml/QUmlDependency>
-#include <QtUml/QUmlElement>
+#include "private/qumlinteractionuseobject_p.h"
+
#include <QtUml/QUmlGate>
-#include <QtUml/QUmlGeneralOrdering>
#include <QtUml/QUmlInteraction>
-#include <QtUml/QUmlInteractionOperand>
-#include <QtUml/QUmlLifeline>
-#include <QtUml/QUmlNamedElement>
-#include <QtUml/QUmlNamespace>
-#include <QtUml/QUmlPackage>
#include <QtUml/QUmlProperty>
-#include <QtUml/QUmlStringExpression>
#include <QtUml/QUmlValueSpecification>
-QT_BEGIN_NAMESPACE
-
/*!
- \class UmlInteractionUse
+ \class QUmlInteractionUse
\inmodule QtUml
\brief An interaction use refers to an interaction. The interaction use is a shorthand for copying the contents of the referenced interaction where the interaction use is. To be accurate the copying must take into account substituting parameters with arguments and connect the formal gates with the actual ones.
*/
-
-QUmlInteractionUse::QUmlInteractionUse(QObject *parent) :
- QObject(parent)
+QUmlInteractionUse::QUmlInteractionUse(bool createQObject) :
+ _refersTo(0),
+ _returnValue(0),
+ _returnValueRecipient(0)
{
+ if (createQObject)
+ _qObject = new QUmlInteractionUseObject(this);
}
-// OWNED ATTRIBUTES [Element]
-
-/*!
- The Comments owned by this element.
- */
-const QSet<QUmlComment *> QUmlInteractionUse::ownedComment() const
+QUmlInteractionUse::~QUmlInteractionUse()
{
- return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment));
+ if (!deletingFromQObject) {
+ _qObject->setProperty("deletingFromModelingObject", true);
+ delete _qObject;
+ }
}
-/*!
- The Elements owned by this element.
- */
-const QSet<QUmlElement *> QUmlInteractionUse::ownedElement() const
-{
- return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement));
-}
+// OWNED ATTRIBUTES
/*!
- The Element that owns this element.
+ The actual gates of the InteractionUse
*/
-QUmlElement *QUmlInteractionUse::owner() const
+const QSet<QUmlGate *>
+QUmlInteractionUse::actualGate() const
{
- return reinterpret_cast<QUmlElement *>(_owner);
-}
-
-// OWNED ATTRIBUTES [NamedElement]
+ // This is a read-write association end
-/*!
- Indicates the dependencies that reference the client.
- */
-const QSet<QUmlDependency *> QUmlInteractionUse::clientDependency() const
-{
- return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency));
+ return _actualGate;
}
-/*!
- The name of the NamedElement.
- */
-QString QUmlInteractionUse::name() const
+void QUmlInteractionUse::addActualGate(QUmlGate *actualGate)
{
- return _name;
-}
+ // This is a read-write association end
-/*!
- The string expression used to define the name of this named element.
- */
-QUmlStringExpression *QUmlInteractionUse::nameExpression() const
-{
- return reinterpret_cast<QUmlStringExpression *>(_nameExpression);
-}
-
-/*!
- Specifies the namespace that owns the NamedElement.
- */
-QUmlNamespace *QUmlInteractionUse::namespace_() const
-{
- return reinterpret_cast<QUmlNamespace *>(_namespace_);
-}
+ if (!_actualGate.contains(actualGate)) {
+ _actualGate.insert(actualGate);
+ if (actualGate->asQObject() && this->asQObject())
+ QObject::connect(actualGate->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeActualGate(QObject *)));
+ actualGate->asQObject()->setParent(this->asQObject());
-/*!
- 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 QUmlInteractionUse::qualifiedName() const
-{
- return UmlNamedElement::qualifiedName();
+ // Adjust subsetted properties
+ addOwnedElement(actualGate);
+ }
}
-/*!
- Determines where the NamedElement appears within different Namespaces within the overall model, and its accessibility.
- */
-QtUml::VisibilityKind QUmlInteractionUse::visibility() const
+void QUmlInteractionUse::removeActualGate(QUmlGate *actualGate)
{
- return _visibility;
-}
+ // This is a read-write association end
-// OWNED ATTRIBUTES [InteractionFragment]
+ if (_actualGate.contains(actualGate)) {
+ _actualGate.remove(actualGate);
+ if (actualGate->asQObject())
+ actualGate->asQObject()->setParent(0);
-/*!
- References the Lifelines that the InteractionFragment involves.
- */
-const QSet<QUmlLifeline *> QUmlInteractionUse::covered() const
-{
- return *(reinterpret_cast<const QSet<QUmlLifeline *> *>(&_covered));
+ // Adjust subsetted properties
+ removeOwnedElement(actualGate);
+ }
}
/*!
- The Interaction enclosing this InteractionFragment.
- */
-QUmlInteraction *QUmlInteractionUse::enclosingInteraction() const
-{
- return reinterpret_cast<QUmlInteraction *>(_enclosingInteraction);
-}
-
-/*!
- The operand enclosing this InteractionFragment (they may nest recursively)
- */
-QUmlInteractionOperand *QUmlInteractionUse::enclosingOperand() const
-{
- return reinterpret_cast<QUmlInteractionOperand *>(_enclosingOperand);
-}
-
-/*!
- The general ordering relationships contained in this fragment.
+ The actual arguments of the Interaction
*/
-const QSet<QUmlGeneralOrdering *> QUmlInteractionUse::generalOrdering() const
+const QList<QUmlValueSpecification *>
+QUmlInteractionUse::argument() const
{
- return *(reinterpret_cast<const QSet<QUmlGeneralOrdering *> *>(&_generalOrdering));
-}
+ // This is a read-write association end
-// OWNED ATTRIBUTES [InteractionUse]
-
-/*!
- The actual gates of the InteractionUse
- */
-const QSet<QUmlGate *> QUmlInteractionUse::actualGate() const
-{
- return *(reinterpret_cast<const QSet<QUmlGate *> *>(&_actualGate));
+ return _argument;
}
-/*!
- The actual arguments of the Interaction
- */
-const QList<QUmlValueSpecification *> QUmlInteractionUse::argument() const
+void QUmlInteractionUse::addArgument(QUmlValueSpecification *argument)
{
- return *(reinterpret_cast<const QList<QUmlValueSpecification *> *>(&_argument));
-}
+ // This is a read-write association end
-/*!
- Refers to the Interaction that defines its meaning
- */
-QUmlInteraction *QUmlInteractionUse::refersTo() const
-{
- return reinterpret_cast<QUmlInteraction *>(_refersTo);
-}
+ if (!_argument.contains(argument)) {
+ _argument.append(argument);
+ if (argument->asQObject() && this->asQObject())
+ QObject::connect(argument->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeArgument(QObject *)));
+ argument->asQObject()->setParent(this->asQObject());
-/*!
- The value of the executed Interaction.
- */
-QUmlValueSpecification *QUmlInteractionUse::returnValue() const
-{
- return reinterpret_cast<QUmlValueSpecification *>(_returnValue);
+ // Adjust subsetted properties
+ addOwnedElement(argument);
+ }
}
-/*!
- The recipient of the return value.
- */
-QUmlProperty *QUmlInteractionUse::returnValueRecipient() const
+void QUmlInteractionUse::removeArgument(QUmlValueSpecification *argument)
{
- return reinterpret_cast<QUmlProperty *>(_returnValueRecipient);
-}
+ // This is a read-write association end
-// OPERATIONS [Element]
+ if (_argument.contains(argument)) {
+ _argument.removeAll(argument);
+ if (argument->asQObject())
+ argument->asQObject()->setParent(0);
-/*!
- The query allOwnedElements() gives all of the direct and indirect owned elements of an element.
- */
-QSet<QUmlElement *> QUmlInteractionUse::allOwnedElements() const
-{
- QSet<QUmlElement *> r;
- foreach (UmlElement *element, UmlElement::allOwnedElements())
- r.insert(reinterpret_cast<QUmlElement *>(element));
- return r;
+ // Adjust subsetted properties
+ removeOwnedElement(argument);
+ }
}
/*!
- 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.
+ Refers to the Interaction that defines its meaning
*/
-bool QUmlInteractionUse::mustBeOwned() const
+QUmlInteraction *
+QUmlInteractionUse::refersTo() const
{
- return UmlElement::mustBeOwned();
-}
+ // This is a read-write association end
-// OPERATIONS [NamedElement]
-
-/*!
- The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards.
- */
-QList<QUmlNamespace *> QUmlInteractionUse::allNamespaces() const
-{
- QList<QUmlNamespace *> r;
- foreach (UmlNamespace *element, UmlNamedElement::allNamespaces())
- r.append(reinterpret_cast<QUmlNamespace *>(element));
- return r;
+ return _refersTo;
}
-/*!
- The query allOwningPackages() returns all the directly or indirectly owning packages.
- */
-QSet<QUmlPackage *> QUmlInteractionUse::allOwningPackages() const
+void QUmlInteractionUse::setRefersTo(QUmlInteraction *refersTo)
{
- QSet<QUmlPackage *> r;
- foreach (UmlPackage *element, UmlNamedElement::allOwningPackages())
- r.insert(reinterpret_cast<QUmlPackage *>(element));
- return r;
-}
+ // This is a read-write association end
-/*!
- 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 QUmlInteractionUse::isDistinguishableFrom(QUmlNamedElement *n, QUmlNamespace *ns) const
-{
- return UmlNamedElement::isDistinguishableFrom(n, ns);
+ if (_refersTo != refersTo) {
+ _refersTo = refersTo;
+ if (refersTo->asQObject() && this->asQObject())
+ QObject::connect(refersTo->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setRefersTo()));
+ }
}
/*!
- The query separator() gives the string that is used to separate names when constructing a qualified name.
+ The value of the executed Interaction.
*/
-QString QUmlInteractionUse::separator() const
+QUmlValueSpecification *
+QUmlInteractionUse::returnValue() const
{
- return UmlNamedElement::separator();
-}
-
-// SLOTS FOR OWNED ATTRIBUTES [Element]
+ // This is a read-write association end
-void QUmlInteractionUse::addOwnedComment(UmlComment *ownedComment)
-{
- UmlElement::addOwnedComment(ownedComment);
-}
-
-void QUmlInteractionUse::removeOwnedComment(UmlComment *ownedComment)
-{
- UmlElement::removeOwnedComment(ownedComment);
-}
-
-// SLOTS FOR OWNED ATTRIBUTES [NamedElement]
-
-void QUmlInteractionUse::addClientDependency(UmlDependency *clientDependency)
-{
- UmlNamedElement::addClientDependency(clientDependency);
-}
-
-void QUmlInteractionUse::removeClientDependency(UmlDependency *clientDependency)
-{
- UmlNamedElement::removeClientDependency(clientDependency);
-}
-
-void QUmlInteractionUse::setName(QString name)
-{
- UmlNamedElement::setName(name);
-}
-
-void QUmlInteractionUse::setNameExpression(QUmlStringExpression *nameExpression)
-{
- UmlNamedElement::setNameExpression(nameExpression);
-}
-
-void QUmlInteractionUse::setVisibility(QtUml::VisibilityKind visibility)
-{
- UmlNamedElement::setVisibility(visibility);
+ return _returnValue;
}
-// SLOTS FOR OWNED ATTRIBUTES [InteractionFragment]
-
-void QUmlInteractionUse::addCovered(UmlLifeline *covered)
-{
- UmlInteractionFragment::addCovered(covered);
-}
-
-void QUmlInteractionUse::removeCovered(UmlLifeline *covered)
-{
- UmlInteractionFragment::removeCovered(covered);
-}
-
-void QUmlInteractionUse::setEnclosingInteraction(QUmlInteraction *enclosingInteraction)
-{
- UmlInteractionFragment::setEnclosingInteraction(enclosingInteraction);
-}
-
-void QUmlInteractionUse::setEnclosingOperand(QUmlInteractionOperand *enclosingOperand)
-{
- UmlInteractionFragment::setEnclosingOperand(enclosingOperand);
-}
-
-void QUmlInteractionUse::addGeneralOrdering(UmlGeneralOrdering *generalOrdering)
-{
- UmlInteractionFragment::addGeneralOrdering(generalOrdering);
-}
-
-void QUmlInteractionUse::removeGeneralOrdering(UmlGeneralOrdering *generalOrdering)
-{
- UmlInteractionFragment::removeGeneralOrdering(generalOrdering);
-}
-
-// SLOTS FOR OWNED ATTRIBUTES [InteractionUse]
-
-void QUmlInteractionUse::addActualGate(UmlGate *actualGate)
+void QUmlInteractionUse::setReturnValue(QUmlValueSpecification *returnValue)
{
- UmlInteractionUse::addActualGate(actualGate);
-}
+ // This is a read-write association end
-void QUmlInteractionUse::removeActualGate(UmlGate *actualGate)
-{
- UmlInteractionUse::removeActualGate(actualGate);
-}
+ if (_returnValue != returnValue) {
+ // Adjust subsetted properties
+ removeOwnedElement(_returnValue);
-void QUmlInteractionUse::addArgument(UmlValueSpecification *argument)
-{
- UmlInteractionUse::addArgument(argument);
-}
+ _returnValue = returnValue;
+ if (returnValue->asQObject() && this->asQObject())
+ QObject::connect(returnValue->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setReturnValue()));
+ returnValue->asQObject()->setParent(this->asQObject());
-void QUmlInteractionUse::removeArgument(UmlValueSpecification *argument)
-{
- UmlInteractionUse::removeArgument(argument);
+ // Adjust subsetted properties
+ if (returnValue) {
+ addOwnedElement(returnValue);
+ }
+ }
}
-void QUmlInteractionUse::setRefersTo(QUmlInteraction *refersTo)
+/*!
+ The recipient of the return value.
+ */
+QUmlProperty *
+QUmlInteractionUse::returnValueRecipient() const
{
- UmlInteractionUse::setRefersTo(refersTo);
-}
+ // This is a read-write association end
-void QUmlInteractionUse::setReturnValue(QUmlValueSpecification *returnValue)
-{
- UmlInteractionUse::setReturnValue(returnValue);
+ return _returnValueRecipient;
}
void QUmlInteractionUse::setReturnValueRecipient(QUmlProperty *returnValueRecipient)
{
- UmlInteractionUse::setReturnValueRecipient(returnValueRecipient);
-}
+ // This is a read-write association end
-QT_END_NAMESPACE
+ if (_returnValueRecipient != returnValueRecipient) {
+ _returnValueRecipient = returnValueRecipient;
+ if (returnValueRecipient->asQObject() && this->asQObject())
+ QObject::connect(returnValueRecipient->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setReturnValueRecipient()));
+ }
+}