LCOV - code coverage report
Current view: top level - data/include - data_rules.inl (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.70.2_covts Lines: 100.0 % 58 58
Test Date: 2026-05-03 11:56:31 Functions: 100.0 % 10 10

            Line data    Source code
       1              : /* File: data_rules.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          201 : static inline void data_rules_init ( data_rules_t *this_ )
       8              : {
       9          201 :     (*this_).dummy = 0;  /* prevent warnings on uninitialized usage */
      10          201 : }
      11              : 
      12          201 : static inline void data_rules_destroy ( data_rules_t *this_ )
      13              : {
      14          201 : }
      15              : 
      16              : /* ================================ DIAGRAM ================================ */
      17              : 
      18           79 : static inline bool data_rules_diagram_is_scenario ( const data_rules_t *this_, data_diagram_type_t diagram_type )
      19              : {
      20              :     bool result;
      21           79 :     result = (( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
      22           58 :              || ( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
      23           58 :              || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
      24          137 :              || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
      25           79 :     return result;
      26              : }
      27              : 
      28              : /* ================================ CLASSIFIER ================================ */
      29              : 
      30              : /* ================================ FEATURE ================================ */
      31              : 
      32        33590 : static inline bool data_rules_feature_is_scenario_cond ( const data_rules_t *this_, data_feature_type_t feature_type )
      33              : {
      34              :     bool result;
      35        33590 :     result = ( feature_type == DATA_FEATURE_TYPE_LIFELINE );
      36        33590 :     return result;
      37              : }
      38              : 
      39          377 : static inline bool data_rules_diagram_shows_uncond_features ( const data_rules_t *this_, data_diagram_type_t diagram_type )
      40              : {
      41              :     bool hide;
      42          377 :     hide = (( diagram_type == DATA_DIAGRAM_TYPE_LIST )
      43          377 :            || ( diagram_type == DATA_DIAGRAM_TYPE_BOX_DIAGRAM )
      44          363 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
      45          361 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
      46          338 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
      47          754 :            || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
      48          377 :     return ( ! hide );
      49              : }
      50              : 
      51           10 : static inline bool data_rules_diagram_shows_scenario_features ( const data_rules_t *this_, data_diagram_type_t diagram_type )
      52              : {
      53              :     bool show;
      54           10 :     show = (( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
      55            7 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
      56            7 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
      57           17 :            || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
      58           10 :     return show;
      59              : }
      60              : 
      61        33243 : static inline bool data_rules_vis_classifier_has_feature ( const data_rules_t *this_,
      62              :                                                            const data_visible_classifier_t *vis_classifier,
      63              :                                                            const data_feature_t *feature )
      64              : {
      65        33243 :     assert( vis_classifier != NULL );
      66        33243 :     assert( feature != NULL );
      67        33243 :     const bool valid = data_visible_classifier_is_valid ( vis_classifier ) && data_feature_is_valid ( feature );
      68        33243 :     const data_classifier_t *clasfy = data_visible_classifier_get_classifier_const ( vis_classifier );
      69        33243 :     const data_diagramelement_t *diagele = data_visible_classifier_get_diagramelement_const ( vis_classifier );
      70        33243 :     assert( clasfy != NULL );
      71        33243 :     assert( diagele != NULL );
      72        33243 :     const bool belongs = ( data_feature_get_classifier_row( feature ) == data_classifier_get_row( clasfy ) );
      73        33243 :     const bool scenario = data_rules_feature_is_scenario_cond( this_, data_feature_get_main_type( feature ) );
      74        33243 :     const bool focused = ( data_diagramelement_get_focused_feature_row( diagele ) == data_feature_get_row( feature ) );
      75        33243 :     return valid && belongs && ( ( ! scenario ) || ( scenario && focused ) );
      76              : }
      77              : 
      78              : /* ================================ RELATIONSHIP ================================ */
      79              : 
      80          434 : static inline bool data_rules_relationship_is_scenario_cond ( const data_rules_t *this_,
      81              :                                                               data_feature_type_t from_feature_type,
      82              :                                                               data_feature_type_t to_feature_type
      83              :                                                             )
      84              : {
      85              :     bool result;
      86          434 :     result = ( from_feature_type == DATA_FEATURE_TYPE_LIFELINE )
      87          434 :              || ( to_feature_type == DATA_FEATURE_TYPE_LIFELINE );
      88          434 :     return result;
      89              : }
      90              : 
      91          464 : static inline bool data_rules_diagram_shows_uncond_relationships ( const data_rules_t *this_, data_diagram_type_t diagram_type )
      92              : {
      93              :     bool hide;
      94          464 :     hide = (( diagram_type == DATA_DIAGRAM_TYPE_LIST )
      95          464 :            || ( diagram_type == DATA_DIAGRAM_TYPE_BOX_DIAGRAM )
      96          453 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
      97          449 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
      98          444 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
      99          928 :            || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
     100          464 :     return ( ! hide );
     101              : }
     102              : 
     103           47 : static inline bool data_rules_diagram_shows_scenario_relationships ( const data_rules_t *this_, data_diagram_type_t diagram_type )
     104              : {
     105              :     bool show;
     106           47 :     show = (( diagram_type == DATA_DIAGRAM_TYPE_UML_COMMUNICATION_DIAGRAM )
     107           44 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_SEQUENCE_DIAGRAM )
     108           43 :            || ( diagram_type == DATA_DIAGRAM_TYPE_UML_TIMING_DIAGRAM )
     109           91 :            || ( diagram_type == DATA_DIAGRAM_TYPE_INTERACTION_OVERVIEW_DIAGRAM ));
     110           47 :     return show;
     111              : }
     112              : 
     113              : 
     114              : /*
     115              : Copyright 2017-2026 Andreas Warnke
     116              : 
     117              : Licensed under the Apache License, Version 2.0 (the "License");
     118              : you may not use this file except in compliance with the License.
     119              : You may obtain a copy of the License at
     120              : 
     121              :     http://www.apache.org/licenses/LICENSE-2.0
     122              : 
     123              : Unless required by applicable law or agreed to in writing, software
     124              : distributed under the License is distributed on an "AS IS" BASIS,
     125              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     126              : See the License for the specific language governing permissions and
     127              : limitations under the License.
     128              : */
        

Generated by: LCOV version 2.0-1