umbrello 2.32.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

assocrules.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2002-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef ASSOCRULES_H
12 #define ASSOCRULES_H
13
14 #include "umlobject.h"
15 #include "widgetbase.h"
16
17 class UMLWidget;
18
25 class AssocRules
26 {
27 public:
28
29 AssocRules();
30 ~AssocRules();
31
32 static bool allowAssociation(Uml::AssociationType::Enum assocType, UMLWidget * widget);
33 static bool allowAssociation(Uml::AssociationType::Enum assocType,
34 UMLWidget * widgetA, UMLWidget * widgetB);
35
36 static bool allowRole(Uml::AssociationType::Enum assocType);
37
38 static bool allowMultiplicity(Uml::AssociationType::Enum assocType, WidgetBase::WidgetType widgetType);
39
40 static bool allowSelf(Uml::AssociationType::Enum assocType, WidgetBase::WidgetType widgetType);
41
42 static Uml::AssociationType::Enum isGeneralisationOrRealisation(UMLWidget* widgetA, UMLWidget* widgetB);
43
44 typedef enum {All, Java} Language;
45 typedef enum {Any, UML1, UML2 } Level;
46
47 private:
48 class Assoc_Rule {
49 public:
50 bool isValid() const;
51 Language language;
52 Uml::AssociationType::Enum assoc_type;
53 WidgetBase::WidgetType widgetA_type;
54 WidgetBase::WidgetType widgetB_type;
55 bool role;
56 bool multiplicity;
57 bool bidirectional;
58 bool self;
59 Level level;
60 };
61
62 static Assoc_Rule m_AssocRules[];
63 static int m_nNumRules;
64 };
65
66 #endif
AssocRules::Any
@ Any
Definition: assocrules.h:45
UMLApp::currentView
UMLView * currentView() const
Definition: uml.cpp:3166
AssocRules::Assoc_Rule::self
bool self
association to self
Definition: assocrules.h:58
WidgetBase::wt_Signal
@ wt_Signal
Definition: widgetbase.h:137
WidgetBase::wt_ObjectNode
@ wt_ObjectNode
Definition: widgetbase.h:139
AssociationWidget
This class represents an association inside a diagram. Bugs and comments to umbrello-devel@kde....
Definition: associationwidget.h:52
AssocRules::allowMultiplicity
static bool allowMultiplicity(Uml::AssociationType::Enum assocType, WidgetBase::WidgetType widgetType)
Definition: assocrules.cpp:345
statewidget.h
WidgetBase::wt_Category
@ wt_Category
Definition: widgetbase.h:141
umlview.h
activitywidget.h
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:41
AssocRules::AssocRules
AssocRules()
Definition: assocrules.cpp:36
Uml::AssociationType::Containment
@ Containment
Definition: basictypes.h:116
WidgetBase::isInterfaceWidget
bool isInterfaceWidget()
Definition: widgetbase.h:255
WidgetBase::isPackageWidget
bool isPackageWidget()
Definition: widgetbase.h:261
WidgetBase::wt_Instance
@ wt_Instance
Definition: widgetbase.h:143
WidgetBase::wt_Package
@ wt_Package
Definition: widgetbase.h:121
ActivityWidget::Final
@ Final
Definition: activitywidget.h:43
Uml::AssociationType::Activity
@ Activity
Definition: basictypes.h:122
AssocRules::allowAssociation
static bool allowAssociation(Uml::AssociationType::Enum assocType, UMLWidget *widget)
Definition: assocrules.cpp:51
Uml::ProgrammingLanguage::Java
@ Java
Definition: basictypes.h:278
StateWidget
A graphical version of a UML State.
Definition: statewidget.h:39
ActivityWidget
A graphical version of a UML Activity.
Definition: activitywidget.h:34
UMLListViewItem
Items used by UMLListView.
Definition: umllistviewitem.h:40
Uml::AssociationType::State
@ State
Definition: basictypes.h:121
AssocRules::UML1
@ UML1
Definition: assocrules.h:45
Uml::RoleType::A
@ A
Definition: basictypes.h:239
WidgetBase::asStateWidget
StateWidget * asStateWidget()
Definition: widgetbase.cpp:1492
Uml::AssociationType::Coll_Message_Synchronous
@ Coll_Message_Synchronous
Definition: basictypes.h:127
WidgetBase::wt_Artifact
@ wt_Artifact
Definition: widgetbase.h:130
Uml::AssociationType::Category2Parent
@ Category2Parent
Definition: basictypes.h:124
WidgetBase::wt_UseCase
@ wt_UseCase
Definition: widgetbase.h:115
Settings::OptionState::generalState
GeneralState generalState
Definition: optionstate.h:326
WidgetBase::asActivityWidget
ActivityWidget * asActivityWidget()
Definition: widgetbase.cpp:1465
AssocRules::Language
Language
Definition: assocrules.h:44
Uml::AssociationType::UniAssociation
@ UniAssociation
Definition: basictypes.h:119
Uml::AssociationType::Relationship
@ Relationship
Definition: basictypes.h:126
WidgetBase::asForkJoinWidget
ForkJoinWidget * asForkJoinWidget()
Definition: widgetbase.cpp:1478
UMLObject::isAbstract
bool isAbstract() const
Definition: umlobject.cpp:348
WidgetBase::wt_Component
@ wt_Component
Definition: widgetbase.h:129
Uml::AssociationType::Association_Self
@ Association_Self
Definition: basictypes.h:111
WidgetBase::wt_ForkJoin
@ wt_ForkJoin
Definition: widgetbase.h:133
WidgetBase::wt_Note
@ wt_Note
Definition: widgetbase.h:123
Uml::AssociationType::Anchor
@ Anchor
Definition: basictypes.h:120
Settings::optionState
OptionState & optionState()
Definition: optionstate.cpp:362
AssociationWidget::associationType
Uml::AssociationType::Enum associationType() const
Definition: associationwidget.cpp:1401
StateWidget::End
@ End
Definition: statewidget.h:48
Uml::AssociationType::Child2Category
@ Child2Category
Definition: basictypes.h:125
AssocRules::m_nNumRules
static int m_nNumRules
The number of rules known about.
Definition: assocrules.h:63
Uml::AssociationType::Aggregation
@ Aggregation
Definition: basictypes.h:108
WidgetBase::wt_Actor
@ wt_Actor
Definition: widgetbase.h:114
AssociationWidgetList
QList< QPointer< AssociationWidget > > AssociationWidgetList
Definition: associationwidgetlist.h:19
WidgetBase::umlObject
UMLObject * umlObject() const
Definition: widgetbase.cpp:182
WidgetBase::wt_Pin
@ wt_Pin
Definition: widgetbase.h:138
UMLView
Definition: umlview.h:35
WidgetBase::wt_Port
@ wt_Port
Definition: widgetbase.h:142
UMLApp::listView
UMLListView * listView() const
Definition: uml.cpp:1074
ActivityWidget::End
@ End
Definition: activitywidget.h:42
umlwidget.h
uWarning
#define uWarning()
Definition: debug_utils.h:124
Uml::AssociationType::Association
@ Association
Definition: basictypes.h:110
AssocRules::Assoc_Rule::isValid
bool isValid() const
< Structure to help determine association rules.
Definition: assocrules.cpp:537
WidgetBase::isClassWidget
bool isClassWidget()
Definition: widgetbase.h:247
WidgetBase::wt_Class
@ wt_Class
Definition: widgetbase.h:116
AssocRules::Assoc_Rule::level
Level level
UML level.
Definition: assocrules.h:59
Settings::GeneralState::uml2
bool uml2
Definition: optionstate.h:70
AssocRules::All
@ All
Definition: assocrules.h:44
Uml::RoleType::B
@ B
Definition: basictypes.h:240
Uml::AssociationType::Enum
Enum
Definition: basictypes.h:106
ActivityWidget::Normal
@ Normal
Definition: activitywidget.h:41
Uml::AssociationType::Generalization
@ Generalization
Definition: basictypes.h:107
umllistview.h
AssocRules::Assoc_Rule::role
bool role
role text
Definition: assocrules.h:55
AssocRules::Assoc_Rule::language
Language language
language rule applies to
Definition: assocrules.h:51
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:278
UMLWidget::associationWidgetList
AssociationWidgetList & associationWidgetList() const
Definition: umlwidget.cpp:1284
AssocRules::~AssocRules
~AssocRules()
Definition: assocrules.cpp:43
WidgetBase::wt_Message
@ wt_Message
Definition: widgetbase.h:125
AssocRules::Assoc_Rule::widgetA_type
WidgetBase::WidgetType widgetA_type
type of role A widget
Definition: assocrules.h:53
StateWidget::Initial
@ Initial
Definition: statewidget.h:46
associationwidget.h
Uml::AssociationType::Coll_Message_Asynchronous
@ Coll_Message_Asynchronous
Definition: basictypes.h:112
AssocRules::Assoc_Rule::multiplicity
bool multiplicity
multiplicity text on association
Definition: assocrules.h:56
AssocRules::Assoc_Rule::assoc_type
Uml::AssociationType::Enum assoc_type
association type
Definition: assocrules.h:52
ActivityWidget::Branch
@ Branch
Definition: activitywidget.h:44
widgetbase.h
AssocRules::allowRole
static bool allowRole(Uml::AssociationType::Enum assocType)
Definition: assocrules.cpp:329
AssocRules::Assoc_Rule
Definition: assocrules.h:48
ActivityWidget::Initial
@ Initial
Definition: activitywidget.h:40
WidgetBase::wt_State
@ wt_State
Definition: widgetbase.h:127
umlscene.h
WidgetBase::wt_Interface
@ wt_Interface
Definition: widgetbase.h:117
AssocRules::Java
@ Java
Definition: assocrules.h:44
uml.h
StateWidget::stateType
StateType stateType() const
Definition: statewidget.cpp:393
signalwidget.h
debug_utils.h
WidgetBase::wt_Object
@ wt_Object
Definition: widgetbase.h:122
WidgetBase::wt_Entity
@ wt_Entity
Definition: widgetbase.h:120
AssocRules::allowSelf
static bool allowSelf(Uml::AssociationType::Enum assocType, WidgetBase::WidgetType widgetType)
Definition: assocrules.cpp:361
WidgetBase::WidgetType
WidgetType
Definition: widgetbase.h:111
WidgetBase::wt_Datatype
@ wt_Datatype
Definition: widgetbase.h:118
assocrules.h
AssocRules::UML2
@ UML2
Definition: assocrules.h:45
WidgetBase::wt_Activity
@ wt_Activity
Definition: widgetbase.h:128
umlobject.h
AssocRules
Definition: assocrules.h:26
associationwidgetlist.h
AssocRules::Assoc_Rule::bidirectional
bool bidirectional
can have an association of same type going between widget each way
Definition: assocrules.h:57
Uml::AssociationType::Composition
@ Composition
Definition: basictypes.h:117
UMLView::umlScene
UMLScene * umlScene() const
Definition: umlview.cpp:56
UMLListView::findUMLObject
UMLListViewItem * findUMLObject(const UMLObject *p) const
Definition: umllistview.cpp:1322
AssocRules::m_AssocRules
static Assoc_Rule m_AssocRules[]
Container that holds all the rules.
Definition: assocrules.h:62
ActivityWidget::activityType
ActivityType activityType() const
Definition: activitywidget.cpp:58
Uml::AssociationType::Dependency
@ Dependency
Definition: basictypes.h:109
UMLApp::activeLanguage
Uml::ProgrammingLanguage::Enum activeLanguage() const
Definition: uml.cpp:2523
AssocRules::isGeneralisationOrRealisation
static Uml::AssociationType::Enum isGeneralisationOrRealisation(UMLWidget *widgetA, UMLWidget *widgetB)
Definition: assocrules.cpp:379
AssocRules::Assoc_Rule::widgetB_type
WidgetBase::WidgetType widgetB_type
type of role B widget
Definition: assocrules.h:54
WidgetBase::baseType
WidgetType baseType() const
Definition: widgetbase.cpp:115
UMLScene::isComponentDiagram
bool isComponentDiagram()
Definition: umlscene.h:322
WidgetBase::wt_Enum
@ wt_Enum
Definition: widgetbase.h:119
AssocRules::Level
Level
Definition: assocrules.h:45
Uml::AssociationType::Realization
@ Realization
Definition: basictypes.h:118
WidgetBase::wt_Node
@ wt_Node
Definition: widgetbase.h:131
StateWidget::Normal
@ Normal
Definition: statewidget.h:47
Uml::AssociationType::Exception
@ Exception
Definition: basictypes.h:123
forkjoinwidget.h
AssociationWidget::widgetForRole
UMLWidget * widgetForRole(Uml::RoleType::Enum role) const
Definition: associationwidget.cpp:1232