Line data Source code
1 : /* File: data_guidelines.inl; Copyright and License: see below */
2 :
3 : #include "u8/u8_trace.h"
4 : #include "u8/u8_log.h"
5 : #include <assert.h>
6 :
7 0 : static inline void data_guidelines_init ( data_guidelines_t *this_ )
8 : {
9 0 : (*this_).dummy = 0; /* prevent warnings on uninitialized usage */
10 0 : }
11 :
12 0 : static inline void data_guidelines_destroy ( data_guidelines_t *this_ )
13 : {
14 0 : }
15 :
16 : /* ================================ DIAGRAM ================================ */
17 :
18 : static inline bool data_guidelines_diagram_is_scenario ( const data_guidelines_t *this_, data_diagram_type_t diagram_type )
19 : {
20 : bool result;
21 : result = (( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
22 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
23 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
24 : || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
25 : return result;
26 : }
27 :
28 : /* ================================ CLASSIFIER ================================ */
29 :
30 : /* ================================ FEATURE ================================ */
31 :
32 : static inline bool data_guidelines_feature_is_scenario_cond ( const data_guidelines_t *this_, data_feature_type_t feature_type )
33 : {
34 : bool result;
35 : result = ( feature_type == DATA_FEATURE_TYPE_LIFELINE );
36 : return result;
37 : }
38 :
39 : static inline bool data_guidelines_diagram_shows_uncond_features ( const data_guidelines_t *this_, data_diagram_type_t diagram_type )
40 : {
41 : bool hide;
42 : hide = (( diagram_type == DATA_DIAGRAM_TYPE_LIST )
43 : || ( diagram_type == DATA_DIAGRAM_TYPE_BOX_DIAGRAM )
44 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
45 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
46 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
47 : || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
48 : return ( ! hide );
49 : }
50 :
51 : static inline bool data_guidelines_diagram_shows_scenario_features ( const data_guidelines_t *this_, data_diagram_type_t diagram_type )
52 : {
53 : bool show;
54 : show = (( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
55 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
56 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
57 : || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
58 : return show;
59 : }
60 :
61 : static inline bool data_guidelines_vis_classifier_has_feature ( const data_guidelines_t *this_,
62 : const data_visible_classifier_t *vis_classifier,
63 : const data_feature_t *feature )
64 : {
65 : assert( vis_classifier != NULL );
66 : assert( feature != NULL );
67 : const bool valid = data_visible_classifier_is_valid ( vis_classifier ) && data_feature_is_valid ( feature );
68 : const data_classifier_t *clasfy = data_visible_classifier_get_classifier_const ( vis_classifier );
69 : const data_diagramelement_t *diagele = data_visible_classifier_get_diagramelement_const ( vis_classifier );
70 : assert( clasfy != NULL );
71 : assert( diagele != NULL );
72 : const bool belongs = ( data_feature_get_classifier_row( feature ) == data_classifier_get_row( clasfy ) );
73 : const bool scenario = data_guidelines_feature_is_scenario_cond( this_, data_feature_get_main_type( feature ) );
74 : const bool focused = ( data_diagramelement_get_focused_feature_row( diagele ) == data_feature_get_row( feature ) );
75 : return valid && belongs && ( ( ! scenario ) || ( scenario && focused ) );
76 : }
77 :
78 0 : static inline bool data_guidelines_classifier_has_scenario_semantics ( const data_guidelines_t *this_,
79 : data_diagram_type_t diagram_type,
80 : data_classifier_type_t classifier_type )
81 : {
82 0 : const bool lifeline_has_no_semantics
83 : = ( classifier_type == DATA_CLASSIFIER_TYPE_REQUIREMENT )
84 0 : || ( classifier_type == DATA_CLASSIFIER_TYPE_COMMENT )
85 0 : || ( classifier_type == DATA_CLASSIFIER_TYPE_IMAGE )
86 0 : || ( classifier_type == DATA_CLASSIFIER_TYPE_STEREOTYPE )
87 0 : || (( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
88 0 : && (( classifier_type == DATA_CLASSIFIER_TYPE_INTERACTION )
89 0 : || ( classifier_type == DATA_CLASSIFIER_TYPE_INTERACTION_USE )));
90 0 : return ( ! lifeline_has_no_semantics);
91 : }
92 :
93 0 : static inline bool data_guidelines_feature_value_is_stereotype ( const data_guidelines_t *this_, data_feature_type_t feature_type )
94 : {
95 : bool has_value;
96 0 : has_value = (( feature_type == DATA_FEATURE_TYPE_PROPERTY )
97 0 : || ( feature_type == DATA_FEATURE_TYPE_OPERATION )
98 0 : || ( feature_type == DATA_FEATURE_TYPE_TAGGED_VALUE ));
99 0 : return ( ! has_value );
100 : }
101 :
102 : /* ================================ RELATIONSHIP ================================ */
103 :
104 : static inline bool data_guidelines_relationship_is_scenario_cond ( const data_guidelines_t *this_,
105 : data_feature_type_t from_feature_type,
106 : data_feature_type_t to_feature_type
107 : )
108 : {
109 : bool result;
110 : result = ( from_feature_type == DATA_FEATURE_TYPE_LIFELINE )
111 : || ( to_feature_type == DATA_FEATURE_TYPE_LIFELINE );
112 : return result;
113 : }
114 :
115 : static inline bool data_guidelines_diagram_shows_uncond_relationships ( const data_guidelines_t *this_, data_diagram_type_t diagram_type )
116 : {
117 : bool hide;
118 : hide = (( diagram_type == DATA_DIAGRAM_TYPE_LIST )
119 : || ( diagram_type == DATA_DIAGRAM_TYPE_BOX_DIAGRAM )
120 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
121 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
122 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
123 : || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
124 : return ( ! hide );
125 : }
126 :
127 : static inline bool data_guidelines_diagram_shows_scenario_relationships ( const data_guidelines_t *this_, data_diagram_type_t diagram_type )
128 : {
129 : bool show;
130 : show = (( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
131 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
132 : || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
133 : || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
134 : return show;
135 : }
136 :
137 :
138 : /*
139 : Copyright 2017-2026 Andreas Warnke
140 :
141 : Licensed under the Apache License, Version 2.0 (the "License");
142 : you may not use this file except in compliance with the License.
143 : You may obtain a copy of the License at
144 :
145 : http://www.apache.org/licenses/LICENSE-2.0
146 :
147 : Unless required by applicable law or agreed to in writing, software
148 : distributed under the License is distributed on an "AS IS" BASIS,
149 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
150 : See the License for the specific language governing permissions and
151 : limitations under the License.
152 : */
|