summaryrefslogtreecommitdiffstats
path: root/src/uml/qumlclassifier.cpp
blob: 94de2289d74a396a3d9758318587de2b00eaf290 (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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
/****************************************************************************
**
** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtUml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, 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, Digia gives you certain additional
** rights.  These rights are described in the Digia 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.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qumlclassifier.h"

#include <QtUml/QUmlClassifierTemplateParameter>
#include <QtUml/QUmlCollaborationUse>
#include <QtUml/QUmlComment>
#include <QtUml/QUmlConstraint>
#include <QtUml/QUmlDependency>
#include <QtUml/QUmlElement>
#include <QtUml/QUmlElementImport>
#include <QtUml/QUmlFeature>
#include <QtUml/QUmlGeneralization>
#include <QtUml/QUmlGeneralizationSet>
#include <QtUml/QUmlNamedElement>
#include <QtUml/QUmlPackage>
#include <QtUml/QUmlPackageableElement>
#include <QtUml/QUmlPackageImport>
#include <QtUml/QUmlParameterableElement>
#include <QtUml/QUmlProperty>
#include <QtUml/QUmlRedefinableTemplateSignature>
#include <QtUml/QUmlStringExpression>
#include <QtUml/QUmlSubstitution>
#include <QtUml/QUmlTemplateBinding>
#include <QtUml/QUmlTemplateParameter>
#include <QtUml/QUmlTemplateSignature>
#include <QtUml/QUmlUseCase>

QT_BEGIN_NAMESPACE

/*!
    \class QUmlClassifier

    \inmodule QtUml

    \brief A classifier is a classification of instances - it describes a set of instances that have features in common. A classifier can specify a generalization hierarchy by referencing its general classifiers.A classifier has the capability to own use cases. Although the owning classifier typically represents the subject to which the owned use cases apply, this is not necessarily the case. In principle, the same use case can be applied to multiple subjects, as identified by the subject association role of a use case.Classifier is defined to be a kind of templateable element so that a classifier can be parameterized. It is also defined to be a kind of parameterable element so that a classifier can be a formal template parameter.A classifier has the capability to own collaboration uses. These collaboration uses link a collaboration with the classifier to give a description of the workings of the classifier.

    \b {QUmlClassifier is an abstract class.}
 */

/*!
    Creates a new QUmlClassifier.
*/
QUmlClassifier::QUmlClassifier() :
    _isAbstract(false),
    _isFinalSpecialization(false),
    _ownedTemplateSignature(0),
    _representation(0),
    _templateParameter(0)
{
}

/*!
    Destroys the QUmlClassifier.
 */
QUmlClassifier::~QUmlClassifier()
{
    QModelingElement::deleteQModelingObject();
}

/*!
    Returns a deep-copied clone of the QUmlClassifier.
*/
QModelingElement *QUmlClassifier::clone() const
{
    QUmlClassifier *c = new QUmlClassifier;
    foreach (QUmlComment *element, ownedComments())
        c->addOwnedComment(dynamic_cast<QUmlComment *>(element->clone()));
    c->setName(name());
    if (nameExpression())
        c->setNameExpression(dynamic_cast<QUmlStringExpression *>(nameExpression()->clone()));
    foreach (QUmlElementImport *element, elementImports())
        c->addElementImport(dynamic_cast<QUmlElementImport *>(element->clone()));
    foreach (QUmlConstraint *element, ownedRules())
        c->addOwnedRule(dynamic_cast<QUmlConstraint *>(element->clone()));
    foreach (QUmlPackageImport *element, packageImports())
        c->addPackageImport(dynamic_cast<QUmlPackageImport *>(element->clone()));
    c->setVisibility(visibility());
    c->setLeaf(isLeaf());
    foreach (QUmlTemplateBinding *element, templateBindings())
        c->addTemplateBinding(dynamic_cast<QUmlTemplateBinding *>(element->clone()));
    foreach (QUmlCollaborationUse *element, collaborationUses())
        c->addCollaborationUse(dynamic_cast<QUmlCollaborationUse *>(element->clone()));
    foreach (QUmlGeneralization *element, generalizations())
        c->addGeneralization(dynamic_cast<QUmlGeneralization *>(element->clone()));
    c->setAbstract(isAbstract());
    c->setFinalSpecialization(isFinalSpecialization());
    if (ownedTemplateSignature())
        c->setOwnedTemplateSignature(dynamic_cast<QUmlRedefinableTemplateSignature *>(ownedTemplateSignature()->clone()));
    foreach (QUmlUseCase *element, ownedUseCases())
        c->addOwnedUseCase(dynamic_cast<QUmlUseCase *>(element->clone()));
    foreach (QUmlSubstitution *element, substitutions())
        c->addSubstitution(dynamic_cast<QUmlSubstitution *>(element->clone()));
    return c;
}

// OWNED ATTRIBUTES

/*!
    Refers to all of the Properties that are direct (i.e. not inherited or imported) attributes of the classifier.

    \b {This is a read-only derived union property.}

    \b {Subsetted property(ies):} QUmlClassifier::features(), .
 */
const QSet<QUmlProperty *> QUmlClassifier::attributes() const
{
    // This is a read-only derived union association end

    return _attributes;
}

/*!
    Adds \a attribute to attributes.

    \sa attributes(), removeAttribute()
 */
void QUmlClassifier::addAttribute(QUmlProperty *attribute)
{
    // This is a read-only derived union association end

    if (!_attributes.contains(attribute)) {
        _attributes.insert(attribute);
        if (attribute && attribute->asQModelingObject() && this->asQModelingObject())
            QObject::connect(attribute->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removeAttribute(QObject *)));

        // Adjust subsetted properties
        addFeature(attribute);
    }
}

/*!
    Removes \a attribute from attributes.

    \sa attributes(), addAttribute()
 */
void QUmlClassifier::removeAttribute(QUmlProperty *attribute)
{
    // This is a read-only derived union association end

    if (_attributes.contains(attribute)) {
        _attributes.remove(attribute);

        // Adjust subsetted properties
        removeFeature(attribute);
    }
}

/*!
    References the collaboration uses owned by the classifier.

    \sa addCollaborationUse(), removeCollaborationUse()

    \b {Subsetted property(ies):} QUmlElement::ownedElements().
 */
const QSet<QUmlCollaborationUse *> QUmlClassifier::collaborationUses() const
{
    // This is a read-write association end

    return _collaborationUses;
}

/*!
    Adds \a collaborationUse to collaborationUses.

    \sa collaborationUses(), removeCollaborationUse()
 */
void QUmlClassifier::addCollaborationUse(QUmlCollaborationUse *collaborationUse)
{
    // This is a read-write association end

    if (!_collaborationUses.contains(collaborationUse)) {
        _collaborationUses.insert(collaborationUse);
        if (collaborationUse && collaborationUse->asQModelingObject() && this->asQModelingObject())
            QObject::connect(collaborationUse->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removeCollaborationUse(QObject *)));
        collaborationUse->asQModelingObject()->setParent(this->asQModelingObject());

        // Adjust subsetted properties
        addOwnedElement(collaborationUse);
    }
}

/*!
    Removes \a collaborationUse from collaborationUses.

    \sa collaborationUses(), addCollaborationUse()
 */
void QUmlClassifier::removeCollaborationUse(QUmlCollaborationUse *collaborationUse)
{
    // This is a read-write association end

    if (_collaborationUses.contains(collaborationUse)) {
        _collaborationUses.remove(collaborationUse);
        if (collaborationUse->asQModelingObject())
            collaborationUse->asQModelingObject()->setParent(0);

        // Adjust subsetted properties
        removeOwnedElement(collaborationUse);
    }
}

/*!
    Specifies each feature defined in the classifier.Note that there may be members of the Classifier that are of the type Feature but are not included in this association, e.g. inherited features.

    \b {This is a read-only derived union property.}

    \b {Subsetted property(ies):} QUmlNamespace::members().

    \b {Opposite property(ies):} QUmlFeature::featuringClassifiers().
 */
const QSet<QUmlFeature *> QUmlClassifier::features() const
{
    // This is a read-only derived union association end

    return _features;
}

/*!
    Adds \a feature to features.

    \sa features(), removeFeature()
 */
void QUmlClassifier::addFeature(QUmlFeature *feature)
{
    // This is a read-only derived union association end

    if (!_features.contains(feature)) {
        _features.insert(feature);
        if (feature && feature->asQModelingObject() && this->asQModelingObject())
            QObject::connect(feature->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removeFeature(QObject *)));

        // Adjust subsetted properties
        addMember(feature);

        // Adjust opposite properties
        if (feature) {
            feature->addFeaturingClassifier(this);
        }
    }
}

/*!
    Removes \a feature from features.

    \sa features(), addFeature()
 */
void QUmlClassifier::removeFeature(QUmlFeature *feature)
{
    // This is a read-only derived union association end

    if (_features.contains(feature)) {
        _features.remove(feature);

        // Adjust subsetted properties
        removeMember(feature);

        // Adjust opposite properties
        if (feature) {
            feature->removeFeaturingClassifier(this);
        }
    }
}

/*!
    Specifies the general Classifiers for this Classifier.References the general classifier in the Generalization relationship.

    \sa addGeneral(), removeGeneral()

    \b {This is a derived property.}
 */
const QSet<QUmlClassifier *> QUmlClassifier::generals() const
{
    // This is a read-write derived association end

    qWarning("QUmlClassifier::generals(): to be implemented (this is a derived association end)");

    return QSet<QUmlClassifier *>();
}

/*!
    Adds \a general to generals.

    \sa generals(), removeGeneral()
 */
void QUmlClassifier::addGeneral(QUmlClassifier *general)
{
    // This is a read-write derived association end

    qWarning("QUmlClassifier::addGeneral(): to be implemented (this is a derived association end)");
    Q_UNUSED(general);

    if (false /* <derivedexclusion-criteria> */) {
        // <derived-code>
    }
}

/*!
    Removes \a general from generals.

    \sa generals(), addGeneral()
 */
void QUmlClassifier::removeGeneral(QUmlClassifier *general)
{
    // This is a read-write derived association end

    qWarning("QUmlClassifier::removeGeneral(): to be implemented (this is a derived association end)");
    Q_UNUSED(general);

    if (false /* <derivedexclusion-criteria> */) {
        // <derived-code>
    }
}

/*!
    Specifies the Generalization relationships for this Classifier. These Generalizations navigaten to more general classifiers in the generalization hierarchy.

    \sa addGeneralization(), removeGeneralization()

    \b {Subsetted property(ies):} QUmlElement::ownedElements().

    \b {Opposite property(ies):} QUmlGeneralization::specific().
 */
const QSet<QUmlGeneralization *> QUmlClassifier::generalizations() const
{
    // This is a read-write association end

    return _generalizations;
}

/*!
    Adds \a generalization to generalizations.

    \sa generalizations(), removeGeneralization()
 */
void QUmlClassifier::addGeneralization(QUmlGeneralization *generalization)
{
    // This is a read-write association end

    if (!_generalizations.contains(generalization)) {
        _generalizations.insert(generalization);
        if (generalization && generalization->asQModelingObject() && this->asQModelingObject())
            QObject::connect(generalization->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removeGeneralization(QObject *)));
        generalization->asQModelingObject()->setParent(this->asQModelingObject());

        // Adjust subsetted properties
        addOwnedElement(generalization);

        // Adjust opposite properties
        if (generalization) {
            generalization->setSpecific(this);
        }
    }
}

/*!
    Removes \a generalization from generalizations.

    \sa generalizations(), addGeneralization()
 */
void QUmlClassifier::removeGeneralization(QUmlGeneralization *generalization)
{
    // This is a read-write association end

    if (_generalizations.contains(generalization)) {
        _generalizations.remove(generalization);
        if (generalization->asQModelingObject())
            generalization->asQModelingObject()->setParent(0);

        // Adjust subsetted properties
        removeOwnedElement(generalization);

        // Adjust opposite properties
        if (generalization) {
            generalization->setSpecific(0);
        }
    }
}

/*!
    Specifies all elements inherited by this classifier from the general classifiers.

    \b {This is a read-only derived property.}

    \b {Subsetted property(ies):} QUmlNamespace::members().
 */
const QSet<QUmlNamedElement *> QUmlClassifier::inheritedMembers() const
{
    // This is a read-only derived association end

    qWarning("QUmlClassifier::inheritedMembers(): to be implemented (this is a derived association end)");

    return QSet<QUmlNamedElement *>();
}

/*!
    Adds \a inheritedMember to inheritedMembers.

    \sa inheritedMembers(), removeInheritedMember()
 */
void QUmlClassifier::addInheritedMember(QUmlNamedElement *inheritedMember)
{
    // This is a read-only derived association end

    qWarning("QUmlClassifier::addInheritedMember(): to be implemented (this is a derived association end)");
    Q_UNUSED(inheritedMember);

    if (false /* <derivedexclusion-criteria> */) {
        // <derived-code>

        // Adjust subsetted properties
        addMember(inheritedMember);
    }
}

/*!
    Removes \a inheritedMember from inheritedMembers.

    \sa inheritedMembers(), addInheritedMember()
 */
void QUmlClassifier::removeInheritedMember(QUmlNamedElement *inheritedMember)
{
    // This is a read-only derived association end

    qWarning("QUmlClassifier::removeInheritedMember(): to be implemented (this is a derived association end)");
    Q_UNUSED(inheritedMember);

    if (false /* <derivedexclusion-criteria> */) {
        // <derived-code>

        // Adjust subsetted properties
        removeMember(inheritedMember);
    }
}

/*!
    If true, the Classifier does not provide a complete declaration and can typically not be instantiated. An abstract classifier is intended to be used by other classifiers e.g. as the target of general metarelationships or generalization relationships.
 */
bool QUmlClassifier::isAbstract() const
{
    // This is a read-write property

    return _isAbstract;
}

/*!
    Adjusts isAbstract to \a isAbstract.
 */
void QUmlClassifier::setAbstract(bool isAbstract)
{
    // This is a read-write property

    if (_isAbstract != isAbstract) {
        _isAbstract = isAbstract;
        _qModelingObject->modifiedResettableProperties() << QStringLiteral("isAbstract");
    }
}

/*!
    If true, the Classifier cannot be specialized by generalization. Note that this property is preserved through package merge operations; that is, the capability to specialize a Classifier (i.e., isFinalSpecialization =false) must be preserved in the resulting Classifier of a package merge operation where a Classifier with isFinalSpecialization =false is merged with a matching Classifier with isFinalSpecialization =true: the resulting Classifier will have isFinalSpecialization =false.
 */
bool QUmlClassifier::isFinalSpecialization() const
{
    // This is a read-write property

    return _isFinalSpecialization;
}

/*!
    Adjusts isFinalSpecialization to \a isFinalSpecialization.
 */
void QUmlClassifier::setFinalSpecialization(bool isFinalSpecialization)
{
    // This is a read-write property

    if (_isFinalSpecialization != isFinalSpecialization) {
        _isFinalSpecialization = isFinalSpecialization;
        _qModelingObject->modifiedResettableProperties() << QStringLiteral("isFinalSpecialization");
    }
}

/*!
    The optional template signature specifying the formal template parameters.

    \b {Subsetted property(ies):} .

    \b {Redefined property(ies):} QUmlTemplateableElement::ownedTemplateSignature().

    \b {Opposite property(ies):} QUmlRedefinableTemplateSignature::classifier().
 */
QUmlRedefinableTemplateSignature *QUmlClassifier::ownedTemplateSignature() const
{
    // This is a read-write association end

    return _ownedTemplateSignature;
}

/*!
    Adjusts ownedTemplateSignature to \a ownedTemplateSignature.
 */
void QUmlClassifier::setOwnedTemplateSignature(QUmlRedefinableTemplateSignature *ownedTemplateSignature)
{
    // This is a read-write association end

    if (_ownedTemplateSignature != ownedTemplateSignature) {
        _ownedTemplateSignature = ownedTemplateSignature;
        if (ownedTemplateSignature && ownedTemplateSignature->asQModelingObject() && this->asQModelingObject())
            QObject::connect(ownedTemplateSignature->asQModelingObject(), SIGNAL(destroyed()), this->asQModelingObject(), SLOT(setOwnedTemplateSignature()));
        ownedTemplateSignature->asQModelingObject()->setParent(this->asQModelingObject());

        // Adjust redefined properties
        QUmlTemplateableElement::setOwnedTemplateSignature(ownedTemplateSignature);
    }
}

/*!
    References the use cases owned by this classifier.

    \sa addOwnedUseCase(), removeOwnedUseCase()

    \b {Subsetted property(ies):} QUmlNamespace::ownedMembers().
 */
const QSet<QUmlUseCase *> QUmlClassifier::ownedUseCases() const
{
    // This is a read-write association end

    return _ownedUseCases;
}

/*!
    Adds \a ownedUseCase to ownedUseCases.

    \sa ownedUseCases(), removeOwnedUseCase()
 */
void QUmlClassifier::addOwnedUseCase(QUmlUseCase *ownedUseCase)
{
    // This is a read-write association end

    if (!_ownedUseCases.contains(ownedUseCase)) {
        _ownedUseCases.insert(ownedUseCase);
        if (ownedUseCase && ownedUseCase->asQModelingObject() && this->asQModelingObject())
            QObject::connect(ownedUseCase->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removeOwnedUseCase(QObject *)));
        ownedUseCase->asQModelingObject()->setParent(this->asQModelingObject());

        // Adjust subsetted properties
        addOwnedMember(ownedUseCase);
    }
}

/*!
    Removes \a ownedUseCase from ownedUseCases.

    \sa ownedUseCases(), addOwnedUseCase()
 */
void QUmlClassifier::removeOwnedUseCase(QUmlUseCase *ownedUseCase)
{
    // This is a read-write association end

    if (_ownedUseCases.contains(ownedUseCase)) {
        _ownedUseCases.remove(ownedUseCase);
        if (ownedUseCase->asQModelingObject())
            ownedUseCase->asQModelingObject()->setParent(0);

        // Adjust subsetted properties
        removeOwnedMember(ownedUseCase);
    }
}

/*!
    Designates the GeneralizationSet of which the associated Classifier is a power type.

    \sa addPowertypeExtent(), removePowertypeExtent()

    \b {Opposite property(ies):} QUmlGeneralizationSet::powertype().
 */
const QSet<QUmlGeneralizationSet *> QUmlClassifier::powertypeExtents() const
{
    // This is a read-write association end

    return _powertypeExtents;
}

/*!
    Adds \a powertypeExtent to powertypeExtents.

    \sa powertypeExtents(), removePowertypeExtent()
 */
void QUmlClassifier::addPowertypeExtent(QUmlGeneralizationSet *powertypeExtent)
{
    // This is a read-write association end

    if (!_powertypeExtents.contains(powertypeExtent)) {
        _powertypeExtents.insert(powertypeExtent);
        if (powertypeExtent && powertypeExtent->asQModelingObject() && this->asQModelingObject())
            QObject::connect(powertypeExtent->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removePowertypeExtent(QObject *)));

        // Adjust opposite properties
        if (powertypeExtent) {
            powertypeExtent->setPowertype(this);
        }
    }
}

/*!
    Removes \a powertypeExtent from powertypeExtents.

    \sa powertypeExtents(), addPowertypeExtent()
 */
void QUmlClassifier::removePowertypeExtent(QUmlGeneralizationSet *powertypeExtent)
{
    // This is a read-write association end

    if (_powertypeExtents.contains(powertypeExtent)) {
        _powertypeExtents.remove(powertypeExtent);

        // Adjust opposite properties
        if (powertypeExtent) {
            powertypeExtent->setPowertype(0);
        }
    }
}

/*!
    References the Classifiers that are redefined by this Classifier.

    \sa addRedefinedClassifier(), removeRedefinedClassifier()

    \b {Subsetted property(ies):} QUmlRedefinableElement::redefinedElements().
 */
const QSet<QUmlClassifier *> QUmlClassifier::redefinedClassifiers() const
{
    // This is a read-write association end

    return _redefinedClassifiers;
}

/*!
    Adds \a redefinedClassifier to redefinedClassifiers.

    \sa redefinedClassifiers(), removeRedefinedClassifier()
 */
void QUmlClassifier::addRedefinedClassifier(QUmlClassifier *redefinedClassifier)
{
    // This is a read-write association end

    if (!_redefinedClassifiers.contains(redefinedClassifier)) {
        _redefinedClassifiers.insert(redefinedClassifier);
        if (redefinedClassifier && redefinedClassifier->asQModelingObject() && this->asQModelingObject())
            QObject::connect(redefinedClassifier->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removeRedefinedClassifier(QObject *)));

        // Adjust subsetted properties
        addRedefinedElement(redefinedClassifier);
    }
}

/*!
    Removes \a redefinedClassifier from redefinedClassifiers.

    \sa redefinedClassifiers(), addRedefinedClassifier()
 */
void QUmlClassifier::removeRedefinedClassifier(QUmlClassifier *redefinedClassifier)
{
    // This is a read-write association end

    if (_redefinedClassifiers.contains(redefinedClassifier)) {
        _redefinedClassifiers.remove(redefinedClassifier);

        // Adjust subsetted properties
        removeRedefinedElement(redefinedClassifier);
    }
}

/*!
    References a collaboration use which indicates the collaboration that represents this classifier.

    \b {Subsetted property(ies):} QUmlClassifier::collaborationUses().
 */
QUmlCollaborationUse *QUmlClassifier::representation() const
{
    // This is a read-write association end

    return _representation;
}

/*!
    Adjusts representation to \a representation.
 */
void QUmlClassifier::setRepresentation(QUmlCollaborationUse *representation)
{
    // This is a read-write association end

    if (_representation != representation) {
        // Adjust subsetted properties
        removeCollaborationUse(_representation);

        _representation = representation;
        if (representation && representation->asQModelingObject() && this->asQModelingObject())
            QObject::connect(representation->asQModelingObject(), SIGNAL(destroyed()), this->asQModelingObject(), SLOT(setRepresentation()));

        // Adjust subsetted properties
        if (representation) {
            addCollaborationUse(representation);
        }
    }
}

/*!
    References the substitutions that are owned by this Classifier.

    \sa addSubstitution(), removeSubstitution()

    \b {Subsetted property(ies):} QUmlElement::ownedElements(), QUmlNamedElement::clientDependencies().

    \b {Opposite property(ies):} QUmlSubstitution::substitutingClassifier().
 */
const QSet<QUmlSubstitution *> QUmlClassifier::substitutions() const
{
    // This is a read-write association end

    return _substitutions;
}

/*!
    Adds \a substitution to substitutions.

    \sa substitutions(), removeSubstitution()
 */
void QUmlClassifier::addSubstitution(QUmlSubstitution *substitution)
{
    // This is a read-write association end

    if (!_substitutions.contains(substitution)) {
        _substitutions.insert(substitution);
        if (substitution && substitution->asQModelingObject() && this->asQModelingObject())
            QObject::connect(substitution->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removeSubstitution(QObject *)));
        substitution->asQModelingObject()->setParent(this->asQModelingObject());

        // Adjust subsetted properties
        addOwnedElement(substitution);
        addClientDependency(substitution);

        // Adjust opposite properties
        if (substitution) {
            substitution->setSubstitutingClassifier(this);
        }
    }
}

/*!
    Removes \a substitution from substitutions.

    \sa substitutions(), addSubstitution()
 */
void QUmlClassifier::removeSubstitution(QUmlSubstitution *substitution)
{
    // This is a read-write association end

    if (_substitutions.contains(substitution)) {
        _substitutions.remove(substitution);
        if (substitution->asQModelingObject())
            substitution->asQModelingObject()->setParent(0);

        // Adjust subsetted properties
        removeOwnedElement(substitution);
        removeClientDependency(substitution);

        // Adjust opposite properties
        if (substitution) {
            substitution->setSubstitutingClassifier(0);
        }
    }
}

/*!
    The template parameter that exposes this element as a formal parameter.

    \b {Redefined property(ies):} QUmlParameterableElement::templateParameter().

    \b {Opposite property(ies):} QUmlClassifierTemplateParameter::parameteredElement().
 */
QUmlClassifierTemplateParameter *QUmlClassifier::templateParameter() const
{
    // This is a read-write association end

    return _templateParameter;
}

/*!
    Adjusts templateParameter to \a templateParameter.
 */
void QUmlClassifier::setTemplateParameter(QUmlClassifierTemplateParameter *templateParameter)
{
    // This is a read-write association end

    if (_templateParameter != templateParameter) {
        _templateParameter = templateParameter;
        if (templateParameter && templateParameter->asQModelingObject() && this->asQModelingObject())
            QObject::connect(templateParameter->asQModelingObject(), SIGNAL(destroyed()), this->asQModelingObject(), SLOT(setTemplateParameter()));

        // Adjust redefined properties
        QUmlParameterableElement::setTemplateParameter(templateParameter);
    }
}

/*!
    The set of use cases for which this Classifier is the subject.

    \sa addUseCase(), removeUseCase()

    \b {Opposite property(ies):} QUmlUseCase::subjects().
 */
const QSet<QUmlUseCase *> QUmlClassifier::useCases() const
{
    // This is a read-write association end

    return _useCases;
}

/*!
    Adds \a useCase to useCases.

    \sa useCases(), removeUseCase()
 */
void QUmlClassifier::addUseCase(QUmlUseCase *useCase)
{
    // This is a read-write association end

    if (!_useCases.contains(useCase)) {
        _useCases.insert(useCase);
        if (useCase && useCase->asQModelingObject() && this->asQModelingObject())
            QObject::connect(useCase->asQModelingObject(), SIGNAL(destroyed(QObject*)), this->asQModelingObject(), SLOT(removeUseCase(QObject *)));

        // Adjust opposite properties
        if (useCase) {
            useCase->addSubject(this);
        }
    }
}

/*!
    Removes \a useCase from useCases.

    \sa useCases(), addUseCase()
 */
void QUmlClassifier::removeUseCase(QUmlUseCase *useCase)
{
    // This is a read-write association end

    if (_useCases.contains(useCase)) {
        _useCases.remove(useCase);

        // Adjust opposite properties
        if (useCase) {
            useCase->removeSubject(this);
        }
    }
}

// OPERATIONS

/*!
    The query allFeatures() gives all of the features in the namespace of the classifier. In general, through mechanisms such as inheritance, this will be a larger set than feature.
 */
QSet<QUmlFeature *> QUmlClassifier::allFeatures() const
{
    qWarning("QUmlClassifier::allFeatures(): to be implemented (operation)");

    return QSet<QUmlFeature *> ();
}

/*!
    The query allParents() gives all of the direct and indirect ancestors of a generalized Classifier.
 */
QSet<QUmlClassifier *> QUmlClassifier::allParents() const
{
    qWarning("QUmlClassifier::allParents(): to be implemented (operation)");

    return QSet<QUmlClassifier *> ();
}

/*!
    The query conformsTo() gives true for a classifier that defines a type that conforms to another. This is used, for example, in the specification of signature conformance for operations.
 */
bool QUmlClassifier::conformsTo(QUmlClassifier *other) const
{
    qWarning("QUmlClassifier::conformsTo(): to be implemented (operation)");

    Q_UNUSED(other);
    return bool ();
}

/*!
    The query hasVisibilityOf() determines whether a named element is visible in the classifier. By default all are visible. It is only called when the argument is something owned by a parent.
 */
bool QUmlClassifier::hasVisibilityOf(QUmlNamedElement *n) const
{
    qWarning("QUmlClassifier::hasVisibilityOf(): to be implemented (operation)");

    Q_UNUSED(n);
    return bool ();
}

/*!
    The inherit operation is overridden to exclude redefined properties.The query inherit() defines how to inherit a set of elements. Here the operation is defined to inherit them all. It is intended to be redefined in circumstances where inheritance is affected by redefinition.
 */
QSet<QUmlNamedElement *> QUmlClassifier::inherit(QSet<QUmlNamedElement *> inhs) const
{
    qWarning("QUmlClassifier::inherit(): to be implemented (operation)");

    Q_UNUSED(inhs);
    return QSet<QUmlNamedElement *> ();
}

/*!
    The query inheritableMembers() gives all of the members of a classifier that may be inherited in one of its descendants, subject to whatever visibility restrictions apply.
 */
QSet<QUmlNamedElement *> QUmlClassifier::inheritableMembers(QUmlClassifier *c) const
{
    qWarning("QUmlClassifier::inheritableMembers(): to be implemented (operation)");

    Q_UNUSED(c);
    return QSet<QUmlNamedElement *> ();
}

/*!
    The query isTemplate() returns whether this templateable element is actually a template.
 */
bool QUmlClassifier::isTemplate() const
{
    qWarning("QUmlClassifier::isTemplate(): to be implemented (operation)");

    return bool ();
}

/*!
    The query maySpecializeType() determines whether this classifier may have a generalization relationship to classifiers of the specified type. By default a classifier may specialize classifiers of the same or a more general type. It is intended to be redefined by classifiers that have different specialization constraints.
 */
bool QUmlClassifier::maySpecializeType(QUmlClassifier *c) const
{
    qWarning("QUmlClassifier::maySpecializeType(): to be implemented (operation)");

    Q_UNUSED(c);
    return bool ();
}

/*!
    The query parents() gives all of the immediate ancestors of a generalized Classifier.
 */
QSet<QUmlClassifier *> QUmlClassifier::parents() const
{
    qWarning("QUmlClassifier::parents(): to be implemented (operation)");

    return QSet<QUmlClassifier *> ();
}

QT_END_NAMESPACE