in objectModel/Python/cdm/objectmodel/cdm_attribute_resolution_guidance_def.py [0:0]
    def _combine_resolution_guidance(self, add_in: 'CdmAttributeResolutionGuidanceDefinition') -> 'CdmAttributeResolutionGuidanceDefinition':
        start_with = self
        if not add_in:
            return start_with
        if not start_with:
            return add_in
        result = CdmAttributeResolutionGuidanceDefinition(self.ctx)
        # can remove and then un-remove later
        if start_with.remove_attribute:
            if add_in.remove_attribute is None or add_in.remove_attribute:
                result.remove_attribute = True
        else:
            if add_in.remove_attribute is not None and add_in.remove_attribute:
                result.remove_attribute = True
        # copy and combine if needed
        if add_in.imposed_directives:
            if start_with.imposed_directives:
                result.imposed_directives = start_with.imposed_directives[:]
            else:
                result.imposed_directives = []
            result.imposed_directives += add_in.imposed_directives
        else:
            result.imposed_directives = start_with.imposed_directives
        if add_in.removed_directives:
            if start_with.removed_directives:
                result.removed_directives = start_with.removed_directives[:]
            else:
                result.removed_directives = []
            result.removed_directives += add_in.removed_directives
        else:
            result.removed_directives = start_with.removed_directives
        result.add_supporting_attribute = start_with.add_supporting_attribute
        if add_in.add_supporting_attribute:
            result.add_supporting_attribute = add_in.add_supporting_attribute
        result.cardinality = start_with.cardinality
        if add_in.cardinality:
            result.cardinality = add_in.cardinality
        result.rename_format = start_with.rename_format
        if add_in.rename_format:
            result.rename_format = add_in.rename_format
        # for these sub objects, ok to just use the same objects unless something is combined. assumption is that these are static during the resolution
        if add_in.expansion:
            if start_with.expansion:
                result.expansion = CdmAttributeResolutionGuidance_Expansion()
                result.expansion.starting_ordinal = start_with.expansion.starting_ordinal
                if add_in.expansion.starting_ordinal is not None:
                    result.expansion.starting_ordinal = add_in.expansion.starting_ordinal
                result.expansion.maximum_expansion = start_with.expansion.maximum_expansion
                if add_in.expansion.maximum_expansion is not None:
                    result.expansion.maximum_expansion = add_in.expansion.maximum_expansion
                result.expansion.count_attribute = start_with.expansion.count_attribute
                if add_in.expansion.count_attribute is not None:
                    result.expansion.count_attribute = add_in.expansion.count_attribute
            else:
                result.expansion = add_in.expansion
        else:
            result.expansion = start_with.expansion
        if add_in.entity_by_reference:
            if start_with.entity_by_reference:
                result.entity_by_reference = CdmAttributeResolutionGuidance_EntityByReference()
                result.entity_by_reference.always_include_foreign_key = start_with.entity_by_reference.always_include_foreign_key
                if add_in.entity_by_reference.always_include_foreign_key is not None:
                    result.entity_by_reference.always_include_foreign_key = add_in.entity_by_reference.always_include_foreign_key
                result.entity_by_reference.reference_only_after_depth = start_with.entity_by_reference.reference_only_after_depth
                if add_in.entity_by_reference.reference_only_after_depth is not None:
                    result.entity_by_reference.reference_only_after_depth = add_in.entity_by_reference.reference_only_after_depth
                result.entity_by_reference.foreign_key_attribute = start_with.entity_by_reference.foreign_key_attribute
                if add_in.entity_by_reference.foreign_key_attribute is not None:
                    result.entity_by_reference.foreign_key_attribute = add_in.entity_by_reference.foreign_key_attribute
                result.entity_by_reference.allow_reference = start_with.entity_by_reference.allow_reference
                if add_in.entity_by_reference.allow_reference is not None:
                    result.entity_by_reference.allow_reference = add_in.entity_by_reference.allow_reference
            else:
                result.entity_by_reference = add_in.entity_by_reference
        else:
            result.entity_by_reference = start_with.entity_by_reference
        if add_in.selects_sub_attribute:
            if start_with.selects_sub_attribute:
                result.selects_sub_attribute = CdmAttributeResolutionGuidance_SelectsSubAttribute()
                result.selects_sub_attribute.selected_type_attribute = start_with.selects_sub_attribute.selected_type_attribute
                if add_in.selects_sub_attribute.selected_type_attribute is not None:
                    result.selects_sub_attribute.selected_type_attribute = add_in.selects_sub_attribute.selected_type_attribute
                result.selects_sub_attribute.selects = start_with.selects_sub_attribute.selects
                if add_in.selects_sub_attribute.selects is not None:
                    result.selects_sub_attribute.selects = add_in.selects_sub_attribute.selects
                if start_with.selects_sub_attribute.selects_some_take_names or add_in.selects_sub_attribute.selects_some_take_names:
                    result.selects_sub_attribute.selects_some_take_names = []
                    if start_with.selects_sub_attribute.selects_some_take_names is not None:
                        result.selects_sub_attribute.selects_some_take_names.extend(start_with.selects_sub_attribute.selects_some_take_names)
                    if add_in.selects_sub_attribute.selects_some_take_names is not None:
                        result.selects_sub_attribute.selects_some_take_names.extend(add_in.selects_sub_attribute.selects_some_take_names)
                if start_with.selects_sub_attribute.selects_some_avoid_names or add_in.selects_sub_attribute.selects_some_avoid_names:
                    result.selects_sub_attribute.selects_some_avoid_names = []
                    if start_with.selects_sub_attribute.selects_some_avoid_names is not None:
                        result.selects_sub_attribute.selects_some_avoid_names.extend(start_with.selects_sub_attribute.selects_some_avoid_names)
                    if add_in.selects_sub_attribute.selects_some_avoid_names is not None:
                        result.selects_sub_attribute.selects_some_avoid_names.extend(add_in.selects_sub_attribute.selects_some_avoid_names)
            else:
                result.selects_sub_attribute = add_in.selects_sub_attribute
        else:
            result.selects_sub_attribute = start_with.selects_sub_attribute
        return result