summaryrefslogtreecommitdiffstats
path: root/src/uml/qumlactivitynode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uml/qumlactivitynode.cpp')
-rw-r--r--src/uml/qumlactivitynode.cpp466
1 files changed, 208 insertions, 258 deletions
diff --git a/src/uml/qumlactivitynode.cpp b/src/uml/qumlactivitynode.cpp
index a658c19a..271ef3bc 100644
--- a/src/uml/qumlactivitynode.cpp
+++ b/src/uml/qumlactivitynode.cpp
@@ -44,387 +44,337 @@
#include <QtUml/QUmlActivityEdge>
#include <QtUml/QUmlActivityGroup>
#include <QtUml/QUmlActivityPartition>
-#include <QtUml/QUmlClassifier>
-#include <QtUml/QUmlComment>
-#include <QtUml/QUmlDependency>
-#include <QtUml/QUmlElement>
#include <QtUml/QUmlInterruptibleActivityRegion>
-#include <QtUml/QUmlNamedElement>
-#include <QtUml/QUmlNamespace>
-#include <QtUml/QUmlPackage>
-#include <QtUml/QUmlRedefinableElement>
-#include <QtUml/QUmlStringExpression>
#include <QtUml/QUmlStructuredActivityNode>
-QT_BEGIN_NAMESPACE
-
/*!
- \class UmlActivityNode
+ \class QUmlActivityNode
\inmodule QtUml
\brief ActivityNode is an abstract class for points in the flow of an activity connected by edges.
*/
-
-QUmlActivityNode::QUmlActivityNode(QObject *parent) :
- QObject(parent)
+QUmlActivityNode::QUmlActivityNode() :
+ _activity(0),
+ _inStructuredNode(0)
{
}
-// OWNED ATTRIBUTES [Element]
-
-/*!
- The Comments owned by this element.
- */
-const QSet<QUmlComment *> QUmlActivityNode::ownedComment() const
+QUmlActivityNode::~QUmlActivityNode()
{
- return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment));
}
+// OWNED ATTRIBUTES
+
/*!
- The Elements owned by this element.
+ Activity containing the node.
*/
-const QSet<QUmlElement *> QUmlActivityNode::ownedElement() const
+QUmlActivity *
+QUmlActivityNode::activity() const
{
- return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement));
+ // This is a read-write association end
+
+ return _activity;
}
-/*!
- The Element that owns this element.
- */
-QUmlElement *QUmlActivityNode::owner() const
+void QUmlActivityNode::setActivity(QUmlActivity *activity)
{
- return reinterpret_cast<QUmlElement *>(_owner);
-}
+ // This is a read-write association end
-// OWNED ATTRIBUTES [NamedElement]
+ if (_activity != activity) {
+ // Adjust subsetted properties
-/*!
- Indicates the dependencies that reference the client.
- */
-const QSet<QUmlDependency *> QUmlActivityNode::clientDependency() const
-{
- return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency));
-}
+ _activity = activity;
+ if (activity->asQObject() && this->asQObject())
+ QObject::connect(activity->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setActivity()));
-/*!
- The name of the NamedElement.
- */
-QString QUmlActivityNode::name() const
-{
- return _name;
+ // Adjust subsetted properties
+ setOwner(activity);
+ }
}
/*!
- The string expression used to define the name of this named element.
+ Groups containing the node.
*/
-QUmlStringExpression *QUmlActivityNode::nameExpression() const
+const QSet<QUmlActivityGroup *>
+QUmlActivityNode::inGroup() const
{
- return reinterpret_cast<QUmlStringExpression *>(_nameExpression);
-}
+ // This is a read-only derived union association end
-/*!
- Specifies the namespace that owns the NamedElement.
- */
-QUmlNamespace *QUmlActivityNode::namespace_() const
-{
- return reinterpret_cast<QUmlNamespace *>(_namespace_);
+ return _inGroup;
}
-/*!
- 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 QUmlActivityNode::qualifiedName() const
+void QUmlActivityNode::addInGroup(QUmlActivityGroup *inGroup)
{
- return UmlNamedElement::qualifiedName();
+ // This is a read-only derived union association end
+
+ if (!_inGroup.contains(inGroup)) {
+ _inGroup.insert(inGroup);
+ if (inGroup->asQObject() && this->asQObject())
+ QObject::connect(inGroup->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeInGroup(QObject *)));
+
+ // Adjust opposite properties
+ if (inGroup) {
+ inGroup->addContainedNode(this);
+ }
+ }
}
-/*!
- Determines where the NamedElement appears within different Namespaces within the overall model, and its accessibility.
- */
-QtUml::VisibilityKind QUmlActivityNode::visibility() const
+void QUmlActivityNode::removeInGroup(QUmlActivityGroup *inGroup)
{
- return _visibility;
-}
+ // This is a read-only derived union association end
-// OWNED ATTRIBUTES [RedefinableElement]
+ if (_inGroup.contains(inGroup)) {
+ _inGroup.remove(inGroup);
-/*!
- Indicates whether it is possible to further redefine a RedefinableElement. If the value is true, then it is not possible to further redefine the RedefinableElement. Note that this property is preserved through package merge operations; that is, the capability to redefine a RedefinableElement (i.e., isLeaf=false) must be preserved in the resulting RedefinableElement of a package merge operation where a RedefinableElement with isLeaf=false is merged with a matching RedefinableElement with isLeaf=true: the resulting RedefinableElement will have isLeaf=false. Default value is false.
- */
-bool QUmlActivityNode::isLeaf() const
-{
- return _isLeaf;
+ // Adjust opposite properties
+ if (inGroup) {
+ inGroup->removeContainedNode(this);
+ }
+ }
}
/*!
- The redefinable element that is being redefined by this element.
+ Interruptible regions containing the node.
*/
-const QSet<QUmlRedefinableElement *> QUmlActivityNode::redefinedElement() const
+const QSet<QUmlInterruptibleActivityRegion *>
+QUmlActivityNode::inInterruptibleRegion() const
{
- return *(reinterpret_cast<const QSet<QUmlRedefinableElement *> *>(&_redefinedElement));
+ // This is a read-write association end
+
+ return _inInterruptibleRegion;
}
-/*!
- References the contexts that this element may be redefined from.
- */
-const QSet<QUmlClassifier *> QUmlActivityNode::redefinitionContext() const
+void QUmlActivityNode::addInInterruptibleRegion(QUmlInterruptibleActivityRegion *inInterruptibleRegion)
{
- return *(reinterpret_cast<const QSet<QUmlClassifier *> *>(&_redefinitionContext));
-}
+ // This is a read-write association end
-// OWNED ATTRIBUTES [ActivityNode]
+ if (!_inInterruptibleRegion.contains(inInterruptibleRegion)) {
+ _inInterruptibleRegion.insert(inInterruptibleRegion);
+ if (inInterruptibleRegion->asQObject() && this->asQObject())
+ QObject::connect(inInterruptibleRegion->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeInInterruptibleRegion(QObject *)));
-/*!
- Activity containing the node.
- */
-QUmlActivity *QUmlActivityNode::activity() const
-{
- return reinterpret_cast<QUmlActivity *>(_activity);
-}
+ // Adjust subsetted properties
+ addInGroup(inInterruptibleRegion);
-/*!
- Groups containing the node.
- */
-const QSet<QUmlActivityGroup *> QUmlActivityNode::inGroup() const
-{
- return *(reinterpret_cast<const QSet<QUmlActivityGroup *> *>(&_inGroup));
+ // Adjust opposite properties
+ if (inInterruptibleRegion) {
+ inInterruptibleRegion->addNode(this);
+ }
+ }
}
-/*!
- Interruptible regions containing the node.
- */
-const QSet<QUmlInterruptibleActivityRegion *> QUmlActivityNode::inInterruptibleRegion() const
+void QUmlActivityNode::removeInInterruptibleRegion(QUmlInterruptibleActivityRegion *inInterruptibleRegion)
{
- return *(reinterpret_cast<const QSet<QUmlInterruptibleActivityRegion *> *>(&_inInterruptibleRegion));
-}
+ // This is a read-write association end
-/*!
- Partitions containing the node.
- */
-const QSet<QUmlActivityPartition *> QUmlActivityNode::inPartition() const
-{
- return *(reinterpret_cast<const QSet<QUmlActivityPartition *> *>(&_inPartition));
-}
+ if (_inInterruptibleRegion.contains(inInterruptibleRegion)) {
+ _inInterruptibleRegion.remove(inInterruptibleRegion);
-/*!
- Structured activity node containing the node.
- */
-QUmlStructuredActivityNode *QUmlActivityNode::inStructuredNode() const
-{
- return reinterpret_cast<QUmlStructuredActivityNode *>(_inStructuredNode);
-}
+ // Adjust subsetted properties
+ removeInGroup(inInterruptibleRegion);
-/*!
- Edges that have the node as target.
- */
-const QSet<QUmlActivityEdge *> QUmlActivityNode::incoming() const
-{
- return *(reinterpret_cast<const QSet<QUmlActivityEdge *> *>(&_incoming));
+ // Adjust opposite properties
+ if (inInterruptibleRegion) {
+ inInterruptibleRegion->removeNode(this);
+ }
+ }
}
/*!
- Edges that have the node as source.
+ Partitions containing the node.
*/
-const QSet<QUmlActivityEdge *> QUmlActivityNode::outgoing() const
+const QSet<QUmlActivityPartition *>
+QUmlActivityNode::inPartition() const
{
- return *(reinterpret_cast<const QSet<QUmlActivityEdge *> *>(&_outgoing));
+ // This is a read-write association end
+
+ return _inPartition;
}
-/*!
- Inherited nodes replaced by this node in a specialization of the activity.
- */
-const QSet<QUmlActivityNode *> QUmlActivityNode::redefinedNode() const
+void QUmlActivityNode::addInPartition(QUmlActivityPartition *inPartition)
{
- return *(reinterpret_cast<const QSet<QUmlActivityNode *> *>(&_redefinedNode));
-}
+ // This is a read-write association end
-// OPERATIONS [Element]
+ if (!_inPartition.contains(inPartition)) {
+ _inPartition.insert(inPartition);
+ if (inPartition->asQObject() && this->asQObject())
+ QObject::connect(inPartition->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeInPartition(QObject *)));
-/*!
- The query allOwnedElements() gives all of the direct and indirect owned elements of an element.
- */
-QSet<QUmlElement *> QUmlActivityNode::allOwnedElements() const
-{
- QSet<QUmlElement *> r;
- foreach (UmlElement *element, UmlElement::allOwnedElements())
- r.insert(reinterpret_cast<QUmlElement *>(element));
- return r;
+ // Adjust subsetted properties
+ addInGroup(inPartition);
+
+ // Adjust opposite properties
+ if (inPartition) {
+ inPartition->addNode(this);
+ }
+ }
}
-/*!
- 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 QUmlActivityNode::mustBeOwned() const
+void QUmlActivityNode::removeInPartition(QUmlActivityPartition *inPartition)
{
- return UmlElement::mustBeOwned();
-}
+ // This is a read-write association end
-// OPERATIONS [NamedElement]
+ if (_inPartition.contains(inPartition)) {
+ _inPartition.remove(inPartition);
-/*!
- The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards.
- */
-QList<QUmlNamespace *> QUmlActivityNode::allNamespaces() const
-{
- QList<QUmlNamespace *> r;
- foreach (UmlNamespace *element, UmlNamedElement::allNamespaces())
- r.append(reinterpret_cast<QUmlNamespace *>(element));
- return r;
-}
+ // Adjust subsetted properties
+ removeInGroup(inPartition);
-/*!
- The query allOwningPackages() returns all the directly or indirectly owning packages.
- */
-QSet<QUmlPackage *> QUmlActivityNode::allOwningPackages() const
-{
- QSet<QUmlPackage *> r;
- foreach (UmlPackage *element, UmlNamedElement::allOwningPackages())
- r.insert(reinterpret_cast<QUmlPackage *>(element));
- return r;
+ // Adjust opposite properties
+ if (inPartition) {
+ inPartition->removeNode(this);
+ }
+ }
}
/*!
- 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.
+ Structured activity node containing the node.
*/
-bool QUmlActivityNode::isDistinguishableFrom(QUmlNamedElement *n, QUmlNamespace *ns) const
+QUmlStructuredActivityNode *
+QUmlActivityNode::inStructuredNode() const
{
- return UmlNamedElement::isDistinguishableFrom(n, ns);
+ // This is a read-write association end
+
+ return _inStructuredNode;
}
-/*!
- The query separator() gives the string that is used to separate names when constructing a qualified name.
- */
-QString QUmlActivityNode::separator() const
+void QUmlActivityNode::setInStructuredNode(QUmlStructuredActivityNode *inStructuredNode)
{
- return UmlNamedElement::separator();
-}
+ // This is a read-write association end
-// OPERATIONS [RedefinableElement]
+ if (_inStructuredNode != inStructuredNode) {
+ // Adjust subsetted properties
+ removeInGroup(_inStructuredNode);
-/*!
- The query isConsistentWith() specifies, for any two RedefinableElements in a context in which redefinition is possible, whether redefinition would be logically consistent. By default, this is false; this operation must be overridden for subclasses of RedefinableElement to define the consistency conditions.
- */
-bool QUmlActivityNode::isConsistentWith(QUmlRedefinableElement *redefinee) const
-{
- return UmlRedefinableElement::isConsistentWith(redefinee);
+ _inStructuredNode = inStructuredNode;
+ if (inStructuredNode->asQObject() && this->asQObject())
+ QObject::connect(inStructuredNode->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setInStructuredNode()));
+
+ // Adjust subsetted properties
+ if (inStructuredNode) {
+ addInGroup(inStructuredNode);
+ }
+ setOwner(inStructuredNode);
+ }
}
/*!
- The query isRedefinitionContextValid() specifies whether the redefinition contexts of this RedefinableElement are properly related to the redefinition contexts of the specified RedefinableElement to allow this element to redefine the other. By default at least one of the redefinition contexts of this element must be a specialization of at least one of the redefinition contexts of the specified element.
+ Edges that have the node as target.
*/
-bool QUmlActivityNode::isRedefinitionContextValid(QUmlRedefinableElement *redefined) const
+const QSet<QUmlActivityEdge *>
+QUmlActivityNode::incoming() const
{
- return UmlRedefinableElement::isRedefinitionContextValid(redefined);
-}
+ // This is a read-write association end
-// SLOTS FOR OWNED ATTRIBUTES [Element]
-
-void QUmlActivityNode::addOwnedComment(UmlComment *ownedComment)
-{
- UmlElement::addOwnedComment(ownedComment);
+ return _incoming;
}
-void QUmlActivityNode::removeOwnedComment(UmlComment *ownedComment)
+void QUmlActivityNode::addIncoming(QUmlActivityEdge *incoming)
{
- UmlElement::removeOwnedComment(ownedComment);
-}
+ // This is a read-write association end
-// SLOTS FOR OWNED ATTRIBUTES [NamedElement]
+ if (!_incoming.contains(incoming)) {
+ _incoming.insert(incoming);
+ if (incoming->asQObject() && this->asQObject())
+ QObject::connect(incoming->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeIncoming(QObject *)));
-void QUmlActivityNode::addClientDependency(UmlDependency *clientDependency)
-{
- UmlNamedElement::addClientDependency(clientDependency);
+ // Adjust opposite properties
+ if (incoming) {
+ incoming->setTarget(this);
+ }
+ }
}
-void QUmlActivityNode::removeClientDependency(UmlDependency *clientDependency)
+void QUmlActivityNode::removeIncoming(QUmlActivityEdge *incoming)
{
- UmlNamedElement::removeClientDependency(clientDependency);
-}
+ // This is a read-write association end
-void QUmlActivityNode::setName(QString name)
-{
- UmlNamedElement::setName(name);
-}
+ if (_incoming.contains(incoming)) {
+ _incoming.remove(incoming);
-void QUmlActivityNode::setNameExpression(QUmlStringExpression *nameExpression)
-{
- UmlNamedElement::setNameExpression(nameExpression);
+ // Adjust opposite properties
+ if (incoming) {
+ incoming->setTarget(0);
+ }
+ }
}
-void QUmlActivityNode::setVisibility(QtUml::VisibilityKind visibility)
+/*!
+ Edges that have the node as source.
+ */
+const QSet<QUmlActivityEdge *>
+QUmlActivityNode::outgoing() const
{
- UmlNamedElement::setVisibility(visibility);
-}
+ // This is a read-write association end
-// SLOTS FOR OWNED ATTRIBUTES [RedefinableElement]
+ return _outgoing;
+}
-void QUmlActivityNode::setLeaf(bool isLeaf)
+void QUmlActivityNode::addOutgoing(QUmlActivityEdge *outgoing)
{
- UmlRedefinableElement::setLeaf(isLeaf);
-}
+ // This is a read-write association end
-// SLOTS FOR OWNED ATTRIBUTES [ActivityNode]
+ if (!_outgoing.contains(outgoing)) {
+ _outgoing.insert(outgoing);
+ if (outgoing->asQObject() && this->asQObject())
+ QObject::connect(outgoing->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeOutgoing(QObject *)));
-void QUmlActivityNode::setActivity(QUmlActivity *activity)
-{
- UmlActivityNode::setActivity(activity);
+ // Adjust opposite properties
+ if (outgoing) {
+ outgoing->setSource(this);
+ }
+ }
}
-void QUmlActivityNode::addInInterruptibleRegion(UmlInterruptibleActivityRegion *inInterruptibleRegion)
+void QUmlActivityNode::removeOutgoing(QUmlActivityEdge *outgoing)
{
- UmlActivityNode::addInInterruptibleRegion(inInterruptibleRegion);
-}
+ // This is a read-write association end
-void QUmlActivityNode::removeInInterruptibleRegion(UmlInterruptibleActivityRegion *inInterruptibleRegion)
-{
- UmlActivityNode::removeInInterruptibleRegion(inInterruptibleRegion);
-}
+ if (_outgoing.contains(outgoing)) {
+ _outgoing.remove(outgoing);
-void QUmlActivityNode::addInPartition(UmlActivityPartition *inPartition)
-{
- UmlActivityNode::addInPartition(inPartition);
+ // Adjust opposite properties
+ if (outgoing) {
+ outgoing->setSource(0);
+ }
+ }
}
-void QUmlActivityNode::removeInPartition(UmlActivityPartition *inPartition)
+/*!
+ Inherited nodes replaced by this node in a specialization of the activity.
+ */
+const QSet<QUmlActivityNode *>
+QUmlActivityNode::redefinedNode() const
{
- UmlActivityNode::removeInPartition(inPartition);
-}
+ // This is a read-write association end
-void QUmlActivityNode::setInStructuredNode(QUmlStructuredActivityNode *inStructuredNode)
-{
- UmlActivityNode::setInStructuredNode(inStructuredNode);
+ return _redefinedNode;
}
-void QUmlActivityNode::addIncoming(UmlActivityEdge *incoming)
+void QUmlActivityNode::addRedefinedNode(QUmlActivityNode *redefinedNode)
{
- UmlActivityNode::addIncoming(incoming);
-}
+ // This is a read-write association end
-void QUmlActivityNode::removeIncoming(UmlActivityEdge *incoming)
-{
- UmlActivityNode::removeIncoming(incoming);
-}
+ if (!_redefinedNode.contains(redefinedNode)) {
+ _redefinedNode.insert(redefinedNode);
+ if (redefinedNode->asQObject() && this->asQObject())
+ QObject::connect(redefinedNode->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeRedefinedNode(QObject *)));
-void QUmlActivityNode::addOutgoing(UmlActivityEdge *outgoing)
-{
- UmlActivityNode::addOutgoing(outgoing);
+ // Adjust subsetted properties
+ addRedefinedElement(redefinedNode);
+ }
}
-void QUmlActivityNode::removeOutgoing(UmlActivityEdge *outgoing)
+void QUmlActivityNode::removeRedefinedNode(QUmlActivityNode *redefinedNode)
{
- UmlActivityNode::removeOutgoing(outgoing);
-}
+ // This is a read-write association end
-void QUmlActivityNode::addRedefinedNode(UmlActivityNode *redefinedNode)
-{
- UmlActivityNode::addRedefinedNode(redefinedNode);
-}
+ if (_redefinedNode.contains(redefinedNode)) {
+ _redefinedNode.remove(redefinedNode);
-void QUmlActivityNode::removeRedefinedNode(UmlActivityNode *redefinedNode)
-{
- UmlActivityNode::removeRedefinedNode(redefinedNode);
+ // Adjust subsetted properties
+ removeRedefinedElement(redefinedNode);
+ }
}
-QT_END_NAMESPACE
-