diff options
Diffstat (limited to 'src/uml/qumlinteractionconstraint.cpp')
-rw-r--r-- | src/uml/qumlinteractionconstraint.cpp | 344 |
1 files changed, 52 insertions, 292 deletions
diff --git a/src/uml/qumlinteractionconstraint.cpp b/src/uml/qumlinteractionconstraint.cpp index 5fe44423..bcadba41 100644 --- a/src/uml/qumlinteractionconstraint.cpp +++ b/src/uml/qumlinteractionconstraint.cpp @@ -40,335 +40,95 @@ ****************************************************************************/ #include "qumlinteractionconstraint.h" -#include <QtUml/QUmlComment> -#include <QtUml/QUmlDependency> -#include <QtUml/QUmlElement> -#include <QtUml/QUmlNamedElement> -#include <QtUml/QUmlNamespace> -#include <QtUml/QUmlPackage> -#include <QtUml/QUmlParameterableElement> -#include <QtUml/QUmlStringExpression> -#include <QtUml/QUmlTemplateParameter> -#include <QtUml/QUmlValueSpecification> +#include "private/qumlinteractionconstraintobject_p.h" -QT_BEGIN_NAMESPACE +#include <QtUml/QUmlValueSpecification> /*! - \class UmlInteractionConstraint + \class QUmlInteractionConstraint \inmodule QtUml \brief An interaction constraint is a Boolean expression that guards an operand in a combined fragment. */ - -QUmlInteractionConstraint::QUmlInteractionConstraint(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlInteractionConstraint::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlInteractionConstraint::ownedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); -} - -/*! - The Element that owns this element. - */ -QUmlElement *QUmlInteractionConstraint::owner() const -{ - return reinterpret_cast<QUmlElement *>(_owner); -} - -// OWNED ATTRIBUTES [ParameterableElement] - -/*! - The formal template parameter that owns this element. - */ -QUmlTemplateParameter *QUmlInteractionConstraint::owningTemplateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_owningTemplateParameter); -} - -/*! - The template parameter that exposes this element as a formal parameter. - */ -QUmlTemplateParameter *QUmlInteractionConstraint::templateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_templateParameter); -} - -// OWNED ATTRIBUTES [NamedElement] - -/*! - Indicates the dependencies that reference the client. - */ -const QSet<QUmlDependency *> QUmlInteractionConstraint::clientDependency() const -{ - return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency)); -} - -/*! - The name of the NamedElement. - */ -QString QUmlInteractionConstraint::name() const -{ - return _name; -} - -/*! - The string expression used to define the name of this named element. - */ -QUmlStringExpression *QUmlInteractionConstraint::nameExpression() const -{ - return reinterpret_cast<QUmlStringExpression *>(_nameExpression); -} - -/*! - Specifies the namespace that owns the NamedElement. - */ -QUmlNamespace *QUmlInteractionConstraint::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 QUmlInteractionConstraint::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 QUmlInteractionConstraint::visibility() const -{ - return _visibility; -} - -// OWNED ATTRIBUTES [Constraint] - -/*! - The ordered set of Elements referenced by this Constraint. - */ -const QList<QUmlElement *> QUmlInteractionConstraint::constrainedElement() const -{ - return *(reinterpret_cast<const QList<QUmlElement *> *>(&_constrainedElement)); -} - -/*! - Specifies the namespace that owns the NamedElement. - */ -QUmlNamespace *QUmlInteractionConstraint::context() const +QUmlInteractionConstraint::QUmlInteractionConstraint(bool createQObject) : + QUmlConstraint(false), + _maxint(0), + _minint(0) { - return reinterpret_cast<QUmlNamespace *>(_context); + if (createQObject) + _qObject = new QUmlInteractionConstraintObject(this); } -/*! - A condition that must be true when evaluated in order for the constraint to be satisfied. - */ -QUmlValueSpecification *QUmlInteractionConstraint::specification() const +QUmlInteractionConstraint::~QUmlInteractionConstraint() { - return reinterpret_cast<QUmlValueSpecification *>(_specification); + if (!deletingFromQObject) { + _qObject->setProperty("deletingFromModelingObject", true); + delete _qObject; + } } -// OWNED ATTRIBUTES [InteractionConstraint] +// OWNED ATTRIBUTES /*! The maximum number of iterations of a loop */ -QUmlValueSpecification *QUmlInteractionConstraint::maxint() const -{ - return reinterpret_cast<QUmlValueSpecification *>(_maxint); -} - -/*! - The minimum number of iterations of a loop - */ -QUmlValueSpecification *QUmlInteractionConstraint::minint() const +QUmlValueSpecification * +QUmlInteractionConstraint::maxint() const { - return reinterpret_cast<QUmlValueSpecification *>(_minint); -} - -// OPERATIONS [Element] - -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlInteractionConstraint::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 QUmlInteractionConstraint::mustBeOwned() const -{ - return UmlElement::mustBeOwned(); -} - -// OPERATIONS [ParameterableElement] + // This is a read-write association end -/*! - 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 QUmlInteractionConstraint::isCompatibleWith(QUmlParameterableElement *p) const -{ - return UmlParameterableElement::isCompatibleWith(p); + return _maxint; } -/*! - The query isTemplateParameter() determines if this parameterable element is exposed as a formal template parameter. - */ -bool QUmlInteractionConstraint::isTemplateParameter() const +void QUmlInteractionConstraint::setMaxint(QUmlValueSpecification *maxint) { - return UmlParameterableElement::isTemplateParameter(); -} + // This is a read-write association end -// OPERATIONS [NamedElement] + if (_maxint != maxint) { + // Adjust subsetted properties + removeOwnedElement(_maxint); -/*! - The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards. - */ -QList<QUmlNamespace *> QUmlInteractionConstraint::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 *> QUmlInteractionConstraint::allOwningPackages() const -{ - QSet<QUmlPackage *> r; - foreach (UmlPackage *element, UmlNamedElement::allOwningPackages()) - r.insert(reinterpret_cast<QUmlPackage *>(element)); - return r; -} + _maxint = maxint; + if (maxint->asQObject() && this->asQObject()) + QObject::connect(maxint->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setMaxint())); + maxint->asQObject()->setParent(this->asQObject()); -/*! - 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 QUmlInteractionConstraint::isDistinguishableFrom(QUmlNamedElement *n, QUmlNamespace *ns) const -{ - return UmlNamedElement::isDistinguishableFrom(n, ns); + // Adjust subsetted properties + if (maxint) { + addOwnedElement(maxint); + } + } } /*! - The query separator() gives the string that is used to separate names when constructing a qualified name. + The minimum number of iterations of a loop */ -QString QUmlInteractionConstraint::separator() const -{ - return UmlNamedElement::separator(); -} - -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlInteractionConstraint::addOwnedComment(UmlComment *ownedComment) -{ - UmlElement::addOwnedComment(ownedComment); -} - -void QUmlInteractionConstraint::removeOwnedComment(UmlComment *ownedComment) +QUmlValueSpecification * +QUmlInteractionConstraint::minint() const { - UmlElement::removeOwnedComment(ownedComment); -} - -// SLOTS FOR OWNED ATTRIBUTES [ParameterableElement] - -void QUmlInteractionConstraint::setOwningTemplateParameter(QUmlTemplateParameter *owningTemplateParameter) -{ - UmlParameterableElement::setOwningTemplateParameter(owningTemplateParameter); -} - -void QUmlInteractionConstraint::setTemplateParameter(QUmlTemplateParameter *templateParameter) -{ - UmlParameterableElement::setTemplateParameter(templateParameter); -} - -// SLOTS FOR OWNED ATTRIBUTES [NamedElement] - -void QUmlInteractionConstraint::addClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::addClientDependency(clientDependency); -} - -void QUmlInteractionConstraint::removeClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::removeClientDependency(clientDependency); -} - -void QUmlInteractionConstraint::setName(QString name) -{ - UmlNamedElement::setName(name); -} - -void QUmlInteractionConstraint::setNameExpression(QUmlStringExpression *nameExpression) -{ - UmlNamedElement::setNameExpression(nameExpression); -} -// SLOTS FOR OWNED ATTRIBUTES [PackageableElement] - -void QUmlInteractionConstraint::setVisibility(QtUml::VisibilityKind visibility) -{ - UmlPackageableElement::setVisibility(visibility); -} - -// SLOTS FOR OWNED ATTRIBUTES [Constraint] - -void QUmlInteractionConstraint::addConstrainedElement(UmlElement *constrainedElement) -{ - UmlConstraint::addConstrainedElement(constrainedElement); -} - -void QUmlInteractionConstraint::removeConstrainedElement(UmlElement *constrainedElement) -{ - UmlConstraint::removeConstrainedElement(constrainedElement); -} + // This is a read-write association end -void QUmlInteractionConstraint::setContext(QUmlNamespace *context) -{ - UmlConstraint::setContext(context); + return _minint; } -void QUmlInteractionConstraint::setSpecification(QUmlValueSpecification *specification) +void QUmlInteractionConstraint::setMinint(QUmlValueSpecification *minint) { - UmlConstraint::setSpecification(specification); -} + // This is a read-write association end -// SLOTS FOR OWNED ATTRIBUTES [InteractionConstraint] + if (_minint != minint) { + // Adjust subsetted properties + removeOwnedElement(_minint); -void QUmlInteractionConstraint::setMaxint(QUmlValueSpecification *maxint) -{ - UmlInteractionConstraint::setMaxint(maxint); -} + _minint = minint; + if (minint->asQObject() && this->asQObject()) + QObject::connect(minint->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setMinint())); + minint->asQObject()->setParent(this->asQObject()); -void QUmlInteractionConstraint::setMinint(QUmlValueSpecification *minint) -{ - UmlInteractionConstraint::setMinint(minint); + // Adjust subsetted properties + if (minint) { + addOwnedElement(minint); + } + } } -QT_END_NAMESPACE - |