diff options
Diffstat (limited to 'src/uml/qumldurationinterval.cpp')
-rw-r--r-- | src/uml/qumldurationinterval.cpp | 363 |
1 files changed, 38 insertions, 325 deletions
diff --git a/src/uml/qumldurationinterval.cpp b/src/uml/qumldurationinterval.cpp index 44634e89..96e2e430 100644 --- a/src/uml/qumldurationinterval.cpp +++ b/src/uml/qumldurationinterval.cpp @@ -40,364 +40,77 @@ ****************************************************************************/ #include "qumldurationinterval.h" -#include <QtUml/QUmlComment> -#include <QtUml/QUmlDependency> -#include <QtUml/QUmlDuration> -#include <QtUml/QUmlElement> -#include <QtUml/QUmlNamedElement> -#include <QtUml/QUmlNamespace> -#include <QtUml/QUmlPackage> -#include <QtUml/QUmlParameterableElement> -#include <QtUml/QUmlStringExpression> -#include <QtUml/QUmlTemplateParameter> -#include <QtUml/QUmlType> -#include <QtUml/QUmlValueSpecification> +#include "private/qumldurationintervalobject_p.h" -QT_BEGIN_NAMESPACE +#include <QtUml/QUmlDuration> /*! - \class UmlDurationInterval + \class QUmlDurationInterval \inmodule QtUml \brief A duration interval defines the range between two durations. */ - -QUmlDurationInterval::QUmlDurationInterval(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlDurationInterval::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlDurationInterval::ownedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); -} - -/*! - The Element that owns this element. - */ -QUmlElement *QUmlDurationInterval::owner() const -{ - return reinterpret_cast<QUmlElement *>(_owner); -} - -// OWNED ATTRIBUTES [NamedElement] - -/*! - Indicates the dependencies that reference the client. - */ -const QSet<QUmlDependency *> QUmlDurationInterval::clientDependency() const +QUmlDurationInterval::QUmlDurationInterval(bool createQObject) : + QUmlInterval(false), + _max(0), + _min(0) { - return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency)); + if (createQObject) + _qObject = new QUmlDurationIntervalObject(this); } -/*! - The name of the NamedElement. - */ -QString QUmlDurationInterval::name() const +QUmlDurationInterval::~QUmlDurationInterval() { - return _name; + if (!deletingFromQObject) { + _qObject->setProperty("deletingFromModelingObject", true); + delete _qObject; + } } -/*! - The string expression used to define the name of this named element. - */ -QUmlStringExpression *QUmlDurationInterval::nameExpression() const -{ - return reinterpret_cast<QUmlStringExpression *>(_nameExpression); -} - -/*! - Specifies the namespace that owns the NamedElement. - */ -QUmlNamespace *QUmlDurationInterval::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 QUmlDurationInterval::qualifiedName() const -{ - return UmlNamedElement::qualifiedName(); -} -// OWNED ATTRIBUTES [TypedElement] - -/*! - This information is derived from the return result for this Operation.The type of the TypedElement. - */ -QUmlType *QUmlDurationInterval::type() const -{ - return reinterpret_cast<QUmlType *>(_type); -} - -// OWNED ATTRIBUTES [ParameterableElement] - -/*! - The formal template parameter that owns this element. - */ -QUmlTemplateParameter *QUmlDurationInterval::owningTemplateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_owningTemplateParameter); -} - -/*! - The template parameter that exposes this element as a formal parameter. - */ -QUmlTemplateParameter *QUmlDurationInterval::templateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_templateParameter); -} - -// OWNED ATTRIBUTES [PackageableElement] - -/*! - Indicates that packageable elements must always have a visibility, i.e., visibility is not optional. - */ -QtUml::VisibilityKind QUmlDurationInterval::visibility() const -{ - return _visibility; -} - -// OWNED ATTRIBUTES [DurationInterval] +// OWNED ATTRIBUTES /*! Refers to the Duration denoting the maximum value of the range. */ -QUmlDuration *QUmlDurationInterval::max() const +QUmlDuration * +QUmlDurationInterval::max() const { - return reinterpret_cast<QUmlDuration *>(_max); -} + // This is a read-write association end -/*! - Refers to the Duration denoting the minimum value of the range. - */ -QUmlDuration *QUmlDurationInterval::min() const -{ - return reinterpret_cast<QUmlDuration *>(_min); -} - -// OPERATIONS [Element] - -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlDurationInterval::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 QUmlDurationInterval::mustBeOwned() const -{ - return UmlElement::mustBeOwned(); -} - -// OPERATIONS [NamedElement] - -/*! - The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards. - */ -QList<QUmlNamespace *> QUmlDurationInterval::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 *> QUmlDurationInterval::allOwningPackages() const -{ - QSet<QUmlPackage *> r; - foreach (UmlPackage *element, UmlNamedElement::allOwningPackages()) - r.insert(reinterpret_cast<QUmlPackage *>(element)); - return r; + return _max; } -/*! - 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 QUmlDurationInterval::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 QUmlDurationInterval::separator() const -{ - return UmlNamedElement::separator(); -} - -// OPERATIONS [ParameterableElement] - -/*! - The query isTemplateParameter() determines if this parameterable element is exposed as a formal template parameter. - */ -bool QUmlDurationInterval::isTemplateParameter() const -{ - return UmlParameterableElement::isTemplateParameter(); -} - -// OPERATIONS [ValueSpecification] - -/*! - The query booleanValue() gives a single Boolean value when one can be computed. - */ -bool QUmlDurationInterval::booleanValue() const -{ - return UmlValueSpecification::booleanValue(); -} - -/*! - The query integerValue() gives a single Integer value when one can be computed. - */ -int QUmlDurationInterval::integerValue() const -{ - return UmlValueSpecification::integerValue(); -} - -/*! - 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. In addition, for ValueSpecification, the type must be conformant with the type of the specified parameterable element. - */ -bool QUmlDurationInterval::isCompatibleWith(QUmlParameterableElement *p) const -{ - return UmlValueSpecification::isCompatibleWith(p); -} - -/*! - The query isComputable() determines whether a value specification can be computed in a model. This operation cannot be fully defined in OCL. A conforming implementation is expected to deliver true for this operation for all value specifications that it can compute, and to compute all of those for which the operation is true. A conforming implementation is expected to be able to compute the value of all literals. - */ -bool QUmlDurationInterval::isComputable() const -{ - return UmlValueSpecification::isComputable(); -} - -/*! - The query isNull() returns true when it can be computed that the value is null. - */ -bool QUmlDurationInterval::isNull() const -{ - return UmlValueSpecification::isNull(); -} - -/*! - The query realValue() gives a single Real value when one can be computed. - */ -double QUmlDurationInterval::realValue() const +void QUmlDurationInterval::setMax(QUmlDuration *max) { - return UmlValueSpecification::realValue(); -} + // This is a read-write association end -/*! - The query stringValue() gives a single String value when one can be computed. - */ -QString QUmlDurationInterval::stringValue() const -{ - return UmlValueSpecification::stringValue(); + if (_max != max) { + _max = max; + if (max->asQObject() && this->asQObject()) + QObject::connect(max->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setMax())); + } } /*! - The query unlimitedValue() gives a single UnlimitedNatural value when one can be computed. + Refers to the Duration denoting the minimum value of the range. */ -int QUmlDurationInterval::unlimitedValue() const -{ - return UmlValueSpecification::unlimitedValue(); -} - -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlDurationInterval::addOwnedComment(UmlComment *ownedComment) +QUmlDuration * +QUmlDurationInterval::min() const { - UmlElement::addOwnedComment(ownedComment); -} + // This is a read-write association end -void QUmlDurationInterval::removeOwnedComment(UmlComment *ownedComment) -{ - UmlElement::removeOwnedComment(ownedComment); -} - -// SLOTS FOR OWNED ATTRIBUTES [NamedElement] - -void QUmlDurationInterval::addClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::addClientDependency(clientDependency); -} - -void QUmlDurationInterval::removeClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::removeClientDependency(clientDependency); -} - -void QUmlDurationInterval::setName(QString name) -{ - UmlNamedElement::setName(name); -} - -void QUmlDurationInterval::setNameExpression(QUmlStringExpression *nameExpression) -{ - UmlNamedElement::setNameExpression(nameExpression); -} -// SLOTS FOR OWNED ATTRIBUTES [TypedElement] - -void QUmlDurationInterval::setType(QUmlType *type) -{ - UmlTypedElement::setType(type); -} - -// SLOTS FOR OWNED ATTRIBUTES [ParameterableElement] - -void QUmlDurationInterval::setOwningTemplateParameter(QUmlTemplateParameter *owningTemplateParameter) -{ - UmlParameterableElement::setOwningTemplateParameter(owningTemplateParameter); -} - -void QUmlDurationInterval::setTemplateParameter(QUmlTemplateParameter *templateParameter) -{ - UmlParameterableElement::setTemplateParameter(templateParameter); -} - -// SLOTS FOR OWNED ATTRIBUTES [PackageableElement] - -void QUmlDurationInterval::setVisibility(QtUml::VisibilityKind visibility) -{ - UmlPackageableElement::setVisibility(visibility); -} - -// SLOTS FOR OWNED ATTRIBUTES [DurationInterval] - -void QUmlDurationInterval::setMax(QUmlDuration *max) -{ - UmlDurationInterval::setMax(max); + return _min; } void QUmlDurationInterval::setMin(QUmlDuration *min) { - UmlDurationInterval::setMin(min); -} + // This is a read-write association end -QT_END_NAMESPACE + if (_min != min) { + _min = min; + if (min->asQObject() && this->asQObject()) + QObject::connect(min->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setMin())); + } +} |