summaryrefslogtreecommitdiffstats
path: root/src/uml/qmultiplicityelement.cpp
blob: fdbb2c26737c8edf5e78c5aa2d44dd6f1cb59950 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/****************************************************************************
**
** Copyright (C) 2012 Sandro S. Andrade <sandroandrade@kde.org>
** Contact: http://www.qt-project.org/
**
** This file is part of the QtUml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "qmultiplicityelement.h"
#include "qmultiplicityelement_p.h"

#include <QtUml/QValueSpecification>

QT_BEGIN_NAMESPACE_QTUML

QMultiplicityElementPrivate::QMultiplicityElementPrivate() :
    isUnique(true),
    isOrdered(false),
    upperValue(0),
    lowerValue(0)
{
}

QMultiplicityElementPrivate::~QMultiplicityElementPrivate()
{
}

/*!
    \class QMultiplicityElement

    \inmodule QtUml

    \brief A multiplicity is a definition of an inclusive interval of non-negative integers beginning with a lower bound and ending with a (possibly infinite) upper bound. A multiplicity element embeds this information to specify the allowable cardinalities for an instantiation of this element.
 */

QMultiplicityElement::QMultiplicityElement(QtMof::QMofObject *parent, QtMof::QMofObject *wrapper) :
    QElement(*new QMultiplicityElementPrivate, parent, wrapper)
{
}

QMultiplicityElement::QMultiplicityElement(QMultiplicityElementPrivate &dd, QtMof::QMofObject *parent, QtMof::QMofObject *wrapper) :
    QElement(dd, parent, wrapper)
{
}

QMultiplicityElement::~QMultiplicityElement()
{
}

// ---------------------------------------------------------------
// ATTRIBUTES FROM QMultiplicityElement
// ---------------------------------------------------------------

/*!
    Specifies the upper bound of the multiplicity interval.
 */
qint32 QMultiplicityElement::upper() const
{
    // This is a read-write derived attribute

    qWarning("QMultiplicityElement::upper: to be implemented (this is a derived attribute)");

    return qint32(); // change here to your derived return
}

void QMultiplicityElement::setUpper(qint32 upper)
{
    // This is a read-write derived attribute

    qWarning("QMultiplicityElement::setUpper: to be implemented (this is a derived attribute)");
    Q_UNUSED(upper);

    if (false) { // change to your derived change criteria
        // change to your derived code
    }
}

/*!
    For a multivalued multiplicity, this attributes specifies whether the values in an instantiation of this element are unique.
 */
bool QMultiplicityElement::isUnique() const
{
    // This is a read-write attribute

    Q_D(const QMultiplicityElement);
    return d->isUnique;
}

void QMultiplicityElement::setUnique(bool isUnique)
{
    // This is a read-write attribute

    Q_D(QMultiplicityElement);
    if (d->isUnique != isUnique) {
        d->isUnique = isUnique;
    }
}

/*!
    For a multivalued multiplicity, this attribute specifies whether the values in an instantiation of this element are sequentially ordered.
 */
bool QMultiplicityElement::isOrdered() const
{
    // This is a read-write attribute

    Q_D(const QMultiplicityElement);
    return d->isOrdered;
}

void QMultiplicityElement::setOrdered(bool isOrdered)
{
    // This is a read-write attribute

    Q_D(QMultiplicityElement);
    if (d->isOrdered != isOrdered) {
        d->isOrdered = isOrdered;
    }
}

/*!
    Specifies the lower bound of the multiplicity interval.
 */
qint32 QMultiplicityElement::lower() const
{
    // This is a read-write derived attribute

    qWarning("QMultiplicityElement::lower: to be implemented (this is a derived attribute)");

    return qint32(); // change here to your derived return
}

void QMultiplicityElement::setLower(qint32 lower)
{
    // This is a read-write derived attribute

    qWarning("QMultiplicityElement::setLower: to be implemented (this is a derived attribute)");
    Q_UNUSED(lower);

    if (false) { // change to your derived change criteria
        // change to your derived code
    }
}

// ---------------------------------------------------------------
// ASSOCIATION ENDS FROM QMultiplicityElement
// ---------------------------------------------------------------

/*!
    The specification of the upper bound for this multiplicity.
 */
QValueSpecification *QMultiplicityElement::upperValue() const
{
    // This is a read-write association end

    Q_D(const QMultiplicityElement);
    return d->upperValue;
}

void QMultiplicityElement::setUpperValue(QValueSpecification *upperValue)
{
    // This is a read-write association end

    Q_D(QMultiplicityElement);
    if (d->upperValue != upperValue) {
        // Adjust subsetted property(ies)
        (qmofobject_cast<QElementPrivate *>(d))->removeOwnedElement(qmofobject_cast<QElement *>(d->upperValue));

        d->upperValue = upperValue;

        // Adjust subsetted property(ies)
        if (upperValue) {
            (qmofobject_cast<QElementPrivate *>(d))->addOwnedElement(qmofobject_cast<QElement *>(upperValue));
        }
    }
}

/*!
    The specification of the lower bound for this multiplicity.
 */
QValueSpecification *QMultiplicityElement::lowerValue() const
{
    // This is a read-write association end

    Q_D(const QMultiplicityElement);
    return d->lowerValue;
}

void QMultiplicityElement::setLowerValue(QValueSpecification *lowerValue)
{
    // This is a read-write association end

    Q_D(QMultiplicityElement);
    if (d->lowerValue != lowerValue) {
        // Adjust subsetted property(ies)
        (qmofobject_cast<QElementPrivate *>(d))->removeOwnedElement(qmofobject_cast<QElement *>(d->lowerValue));

        d->lowerValue = lowerValue;

        // Adjust subsetted property(ies)
        if (lowerValue) {
            (qmofobject_cast<QElementPrivate *>(d))->addOwnedElement(qmofobject_cast<QElement *>(lowerValue));
        }
    }
}

/*!
    The operation compatibleWith takes another multiplicity as input. It checks if one multiplicity is compatible with another.
 */
bool QMultiplicityElement::compatibleWith(const QMultiplicityElement *other) const
{
    qWarning("QMultiplicityElement::compatibleWith: operation to be implemented");
    Q_UNUSED(other);

    return bool(); // change here to your derived return
}

/*!
    The query includesCardinality() checks whether the specified cardinality is valid for this multiplicity.
 */
bool QMultiplicityElement::includesCardinality(qint32 C) const
{
    qWarning("QMultiplicityElement::includesCardinality: operation to be implemented");
    Q_UNUSED(C);

    return bool(); // change here to your derived return
}

/*!
    The query includesMultiplicity() checks whether this multiplicity includes all the cardinalities allowed by the specified multiplicity.
 */
bool QMultiplicityElement::includesMultiplicity(const QMultiplicityElement *M) const
{
    qWarning("QMultiplicityElement::includesMultiplicity: operation to be implemented");
    Q_UNUSED(M);

    return bool(); // change here to your derived return
}

/*!
    The operation is determines if the upper and lower bound of the ranges are the ones given.
 */
bool QMultiplicityElement::is(qint32 lowerbound, qint32 upperbound) const
{
    qWarning("QMultiplicityElement::is: operation to be implemented");
    Q_UNUSED(lowerbound);
    Q_UNUSED(upperbound);

    return bool(); // change here to your derived return
}

/*!
    The query isMultivalued() checks whether this multiplicity has an upper bound greater than one.
 */
bool QMultiplicityElement::isMultivalued() const
{
    qWarning("QMultiplicityElement::isMultivalued: operation to be implemented");

    return bool(); // change here to your derived return
}

/*!
    The query lowerBound() returns the lower bound of the multiplicity as an integer.
 */
qint32 QMultiplicityElement::lowerBound() const
{
    qWarning("QMultiplicityElement::lowerBound: operation to be implemented");

    return qint32(); // change here to your derived return
}

/*!
    The query upperBound() returns the upper bound of the multiplicity for a bounded multiplicity as an unlimited natural.
 */
qint32 QMultiplicityElement::upperBound() const
{
    qWarning("QMultiplicityElement::upperBound: operation to be implemented");

    return qint32(); // change here to your derived return
}

#include "moc_qmultiplicityelement.cpp"

QT_END_NAMESPACE_QTUML