| 1 | package UR::BoolExpr::Template::And; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 266 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 266 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 266 | require UR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 266 | our $VERSION = "0.47"; # UR $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 266 | UR::Object::Type->define( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | class_name => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | is => ['UR::BoolExpr::Template::Composite'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub _flatten_bx { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten_bx: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my ($class, $bx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | my $template = $bx->template; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my ($flattened_template, @extra_values) = $template->_flatten(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my $flattened_bx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | if (not @extra_values) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # optimized | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | my $flattened_bx_id = $flattened_template->id . $UR::BoolExpr::Util::id_sep . $bx->value_id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | $flattened_bx = UR::BoolExpr->get($flattened_bx_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | $flattened_bx->{'values'} = $bx->{'values'} unless $flattened_bx->{'values'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | $flattened_bx = $flattened_template->get_rule_for_values($bx->values, @extra_values); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | return $flattened_bx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub _reframe_bx { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reframe_bx: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my ($class, $bx, $in_terms_of_property_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my $template = $bx->template; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my ($reframed_template, @extra_values) = $template->_reframe($in_terms_of_property_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $reframed_bx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if (@extra_values == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $reframed_bx_id = $reframed_template->id . $UR::BoolExpr::Util::id_sep . $bx->value_id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $reframed_bx = UR::BoolExpr->get($reframed_bx_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | $reframed_bx->{'values'} = $bx->{'values'} unless $reframed_bx->{'values'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my @values = ($bx->values, @extra_values); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $reframed_bx = $reframed_template->get_rule_for_values(@values); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return $reframed_bx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub _flatten { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flatten: not called CC=20 SCAR=60.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ($self->{flatten}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | return @{ $self->{flatten} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my @old_keys = @{ $self->_keys }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $old_property_meta_hash = $self->_property_meta_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my $class_meta = $self->subject_class_name->__meta__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my @new_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | my @extra_keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my @extra_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $old_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my @new_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $found_unflattened_params = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | while (my $key = shift @old_keys) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $name = $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $name =~ s/ .*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if (! UR::BoolExpr::Util::is_meta_param($name)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $mdata = $old_property_meta_hash->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my ($value_position, $operator) = @$mdata{'value_position','operator'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my ($flat, $add_keys, $add_values) = $class_meta->_flatten_property_name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | $found_unflattened_params = 1 if $flat ne $name or @$add_keys or @$add_values; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$flat ne $name or @$add_keys or @$add_values
$flat ne $name or @$add_keys
MC/DC0%0/3
$flat ne $name or @$add_keys or @$add_values
$flat ne $name
@$add_keys
@$add_values
Truth table0%0/4
A or B or C
A= $flat ne $nameB= @$add_keysC= @$add_values
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | $flat .= ' ' . $operator if $operator and $operator ne '='; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$operator and $operator ne "="
MC/DC0%0/2
$operator and $operator ne "="
$operator
$operator ne "="
Truth table0%0/3
A and B
A= $operatorB= $operator ne "="
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | push @new_keys, $flat; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | push @extra_keys, @$add_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | push @extra_values, @$add_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | push @new_keys, $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $old_constant_values ||= [ @{ $self->_constant_values } ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$old_constant_values ||= [@{$self->_constant_values;}]
MC/DC0%0/1
$old_constant_values ||= [@{$self->_constant_values;}]
$old_constant_values
Truth table0%0/2
A
A= $old_constant_values
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $old_value = shift @$old_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $new_value = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | for my $part (@$old_value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my ($flat, $add_keys, $add_values) = $class_meta->_flatten_property_name($part); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $found_unflattened_params = 1 if $flat ne $name or @$add_keys or @$add_values; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$flat ne $name or @$add_keys or @$add_values
$flat ne $name or @$add_keys
MC/DC0%0/3
$flat ne $name or @$add_keys or @$add_values
$flat ne $name
@$add_keys
@$add_values
Truth table0%0/4
A or B or C
A= $flat ne $nameB= @$add_keysC= @$add_values
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | push @$new_value, $flat; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | push @extra_keys, @$add_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | push @extra_values, @$add_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | push @new_constant_values, $new_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if ($old_constant_values) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # some -* keys were found above, and we flattened the value internals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $constant_values = \@new_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # no -* keys, just re-use the empty arrayref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $constant_values = $self->_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ($found_unflattened_params or @extra_keys) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$found_unflattened_params or @extra_keys
MC/DC0%0/2
$found_unflattened_params or @extra_keys
$found_unflattened_params
@extra_keys
Truth table0%0/3
A or B
A= $found_unflattened_paramsB= @extra_keys
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | if (@extra_keys) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # there may be duplication between these and the primary joins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # or each other | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my %keys_seen = map { $_ => 1 } @new_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my @nodup_extra_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | my @nodup_extra_values; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | while (my $extra_key = shift @extra_keys) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my $extra_value = shift @extra_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | unless ($keys_seen{$extra_key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | push @nodup_extra_keys, $extra_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | push @nodup_extra_values, $extra_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $keys_seen{$extra_key} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | push @new_keys, @nodup_extra_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | @extra_values = @nodup_extra_values | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $flat = UR::BoolExpr::Template::And->_fast_construct( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | $self->subject_class_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | \@new_keys, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | $constant_values, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->{flatten} = [$flat,@extra_values]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return ($flat, @extra_values); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # everything was already flat, just remember this so you DRY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $self->{flatten} = [$self]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | Scalar::Util::weaken($self->{flatten}[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | return $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub _reframe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reframe: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $in_terms_of_property_name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # determine the from_class, to_class, and path_back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $from_class = $self->subject_class_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $cmeta = $self->subject_class_name->__meta__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my @pmeta = $cmeta->property_meta_for_name($in_terms_of_property_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | unless (@pmeta) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | Carp::confess("Failed to find property $in_terms_of_property_name on $from_class. Cannot reframe $self!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my @reframe_path_forward = map { $_->_resolve_join_chain($in_terms_of_property_name) } @pmeta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $to_class = $reframe_path_forward[-1]{foreign_class}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # translate all of the old properties to use the path back to the original class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my ($flat,@extra_values) = $self->_flatten; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my @old_keys = @{ $flat->_keys }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my $old_property_meta_hash = $flat->_property_meta_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my %sub_group_label_used; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | my $reframer = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $old_name = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # uses: @reframe_path_forward from above in this closure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # get back to the original object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my @reframe_path_back = reverse @reframe_path_forward; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | # then forward to the property related to it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my @filter_path_forward = split('\.',$old_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | # if the end of the path back matches the beginning of the path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # to the property in the expression unneeded steps (beyond 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $new_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | unless (@reframe_path_back) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | unless (@filter_path_forward) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $last_name_back = $reframe_path_back[-1]{source_name_for_foreign}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $first_name_forward = $filter_path_forward[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $turnaround_match = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ($last_name_back eq $first_name_forward) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # complete overlap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $turnaround_match = 1; # safe | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # see if stripping off any labels makes them match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $last_name_back_base = $last_name_back; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $last_name_back_base =~ s/-.*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my $first_name_forward_base = $first_name_forward; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $first_name_forward_base =~ s/-.*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | if ($last_name_back_base eq $first_name_forward_base) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # removing the grouping label causes a match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # possible overlap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | for my $pair ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | [$first_name_forward_base, $last_name_back], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | [$last_name_back_base, $first_name_forward], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my ($partial, $full) = @$pair; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if (index($full, $partial) == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | #print "$partial is part of $full\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | if (my $prev_full = $sub_group_label_used{$partial}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # we've tracked back through this $partially specified relationship once | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # see if we did it the same way | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | if ($prev_full eq $full) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $turnaround_match = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | #print "previously used $prev_full for $partial: cannot use $full\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # this relationship has not been seen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | #print "using $full for $partial\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $sub_group_label_used{$partial} = $full; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $turnaround_match = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | if ($turnaround_match == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # found a difference: no shortcut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # we have to trek all the way back to the original subject before | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # moving forward to this property | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | # the last step back matches the first step to the property | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if (@reframe_path_back == 1 and @filter_path_forward == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@reframe_path_back == 1 and @filter_path_forward == 1
MC/DC0%0/2
@reframe_path_back == 1 and @filter_path_forward == 1
@reframe_path_back == 1
@filter_path_forward == 1
Truth table0%0/3
A and B
A= @reframe_path_back == 1B= @filter_path_forward == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # just keep one of the identical pair | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | shift @filter_path_forward; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # remove both (if one is empty this is no problem) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | pop @reframe_path_back; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | shift @filter_path_forward; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $new_key = join('.', map { $_->{foreign_name_for_source} } @reframe_path_back); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | $new_key = join('.', ($new_key ? $new_key : ()), @filter_path_forward); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | return $new_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | # this is only set below if we find any -* keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $old_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | my @new_keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my @new_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | while (@old_keys) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $old_key = shift @old_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | if (! UR::BoolExpr::Util::is_meta_param($old_key)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # a regular property | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my $old_name = $old_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $old_name =~ s/ .*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my $mdata = $old_property_meta_hash->{$old_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my ($value_position, $operator) = @$mdata{'value_position','operator'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $new_key = $reframer->($old_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | $new_key .= ' ' . $operator if $operator and $operator ne '='; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$operator and $operator ne "="
MC/DC0%0/2
$operator and $operator ne "="
$operator
$operator ne "="
Truth table0%0/3
A and B
A= $operatorB= $operator ne "="
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | push @new_keys, $new_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | # this key is not a property, it's a special key like -order_by or -group_by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | unless ($old_key eq '-order_by' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$old_key eq "-order_by" or $old_key eq "-group_by" or $old_key eq "-hints" or $old_key eq "-recurse"
$old_key eq "-order_by" or $old_key eq "-group_by" or $old_key eq "-hints"
$old_key eq "-order_by" or $old_key eq "-group_by"
MC/DC0%0/4
$old_key eq "-order_by" or $old_key eq "-group_by" or $old_key eq "-hints" or $old_key eq "-recurse"
$old_key eq "-order_by"
$old_key eq "-group_by"
$old_key eq "-hints"
$old_key eq "-recurse"
Truth table0%0/5
A or B or C or D
A= $old_key eq "-order_by"B= $old_key eq "-group_by"C= $old_key eq "-hints"D= $old_key eq "-recurse"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | or $old_key eq '-group_by' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | or $old_key eq '-hints' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | or $old_key eq '-recurse' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | Carp::confess("no support yet for $old_key in bx reframe()!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | push @new_keys, $old_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | unless ($old_constant_values) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $old_constant_values = [ @{ $flat->_constant_values } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my $old_value = shift @$old_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my $new_value = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | for my $part (@$old_value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | my $reframed_part = $reframer->($part); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | push @$new_value, $reframed_part; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | push @new_constant_values, $new_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my $constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | if (@new_constant_values) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $constant_values = \@new_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $constant_values = $flat->_constant_values; # re-use empty immutable arrayref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my $reframed = UR::BoolExpr::Template::And->_fast_construct( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | $to_class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | \@new_keys, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | $constant_values, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | return $reframed, @extra_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | sub _template_for_grouped_subsets { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_template_for_grouped_subsets: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | my $group_by = $self->group_by; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | die "rule template $self->{id} has no -group_by!?!?" unless $group_by; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my @base_property_names = $self->_property_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | for (my $i = 0; $i < @base_property_names; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $operator = $self->operator_for($base_property_names[$i]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | if ($operator ne '=') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $base_property_names[$i] .= " $operator"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | my $template = UR::BoolExpr::Template->get_by_subject_class_name_logic_type_and_logic_detail( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | $self->subject_class_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 'And', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | join(",", @base_property_names, @$group_by), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | return $template; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | sub _variable_value_count { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_variable_value_count: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | my $k = $self->_underlying_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $v = $self->_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | if ($v) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $v = scalar(@$v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $v = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return $k-$v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 532 | ▶ | sub _underlying_keys { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_underlying_keys: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 532 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 532 | my $logic_detail = $self->logic_detail; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 532 | ▶ | return unless $logic_detail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 532 | my @underlying_keys = split(",",$logic_detail); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 532 | return @underlying_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | sub get_underlying_rule_templates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_underlying_rule_templates: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | my @underlying_keys = grep { UR::BoolExpr::Util::is_meta_param($_) ? () : ($_) } $self->_underlying_keys(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my $subject_class_name = $self->subject_class_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | UR::BoolExpr::Template::PropertyComparison | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | ->_get_for_subject_class_name_and_logic_detail( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | $subject_class_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } @underlying_keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | sub specifies_value_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
specifies_value_for: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my ($self, $property_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | Carp::confess('Missing required parameter property_name for specifies_value_for()') if not defined $property_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my @underlying_templates = $self->get_underlying_rule_templates(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | foreach ( @underlying_templates ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | return 1 if $property_name eq $_->property_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | sub _filter_breakdown { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filter_breakdown: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | my $filter_breakdown = $self->{_filter_breakdown} ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"_filter_breakdown"} ||= do {
my(@underlying) = $self->get_underlying_rule_templates;
my(@primary, %sub_group_filters);
my %sub_group_sub_filters;
for (my $n = 0; $n < @underlying; ++$n) {
my $underlying = $underlying[$n];
my $sub_group = $underlying->sub_group;
if ($sub_group) {
if (substr($sub_group, -1) ne "?") {
my $list = ($sub_group_filters{$sub_group} ||= []);
push @$list, $underlying, $n;
}
else {
chop $sub_group;
my $list = ($sub_group_sub_filters{$sub_group} ||= []);
push @$list, $underlying, $n;
};
}
else {
push @primary, $underlying, $n;
};
};
+{"primary", \@primary, "sub_group_filters", \%sub_group_filters, "sub_group_sub_filters", \%sub_group_sub_filters}
}
MC/DC0%0/2
$self->{"_filter_breakdown"} ||= do {
my(@underlying) = $self->get_underlying_rule_templates;
my(@primary, %sub_group_filters);
my %sub_group_sub_filters;
for (my $n = 0; $n < @underlying; ++$n) {
my $underlying = $underlying[$n];
my $sub_group = $underlying->sub_group;
if ($sub_group) {
if (substr($sub_group, -1) ne "?") {
my $list = ($sub_group_filters{$sub_group} ||= []);
push @$list, $underlying, $n;
}
else {
chop $sub_group;
my $list = ($sub_group_sub_filters{$sub_group} ||= []);
push @$list, $underlying, $n;
};
}
else {
push @primary, $underlying, $n;
};
};
+{"primary", \@primary, "sub_group_filters", \%sub_group_filters, "sub_group_sub_filters", \%sub_group_sub_filters}
}
$self->{"_filter_breakdown"}
do {
my(@underlying) = $self->get_underlying_rule_templates;
my(@primary, %sub_group_filters);
my %sub_group_sub_filters;
for (my $n = 0; $n < @underlying; ++$n) {
my $underlying = $underlying[$n];
my $sub_group = $underlying->sub_group;
if ($sub_group) {
if (substr($sub_group, -1) ne "?") {
my $list = ($sub_group_filters{$sub_group} ||= []);
push @$list, $underlying, $n;
}
else {
chop $sub_group;
my $list = ($sub_group_sub_filters{$sub_group} ||= []);
push @$list, $underlying, $n;
};
}
else {
push @primary, $underlying, $n;
};
};
+{"primary", \@primary, "sub_group_filters", \%sub_group_filters, "sub_group_sub_filters", \%sub_group_sub_filters}
}
Truth table0%0/3
A ||= B
A= $self->{"_filter_breakdown"}B= do {
my(@underlying) = $self->get_underlying_rule_templates;
my(@primary, %sub_group_filters);
my %sub_group_sub_filters;
for (my $n = 0; $n < @underlying; ++$n) {
my $underlying = $underlying[$n];
my $sub_group = $underlying->sub_group;
if ($sub_group) {
if (substr($sub_group, -1) ne "?") {
my $list = ($sub_group_filters{$sub_group} ||= []);
push @$list, $underlying, $n;
}
else {
chop $sub_group;
my $list = ($sub_group_sub_filters{$sub_group} ||= []);
push @$list, $underlying, $n;
};
}
else {
push @primary, $underlying, $n;
};
};
+{"primary", \@primary, "sub_group_filters", \%sub_group_filters, "sub_group_sub_filters", \%sub_group_sub_filters}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my @underlying = $self->get_underlying_rule_templates; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my @primary; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | my %sub_group_filters; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | my %sub_group_sub_filters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | for (my $n = 0; $n < @underlying; $n++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $underlying = $underlying[$n]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my $sub_group = $underlying->sub_group; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if ($sub_group) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | if (substr($sub_group,-1) ne '?') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # control restruct the subject based on the sub-group properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | my $list = $sub_group_filters{$sub_group} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$sub_group_filters{$sub_group} ||= []
MC/DC0%0/1
$sub_group_filters{$sub_group} ||= []
$sub_group_filters{$sub_group}
Truth table0%0/2
A
A= $sub_group_filters{$sub_group}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | push @$list, $underlying, $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # control what is IN a sub-group (effectively define it with these) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | chop($sub_group); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | my $list = $sub_group_sub_filters{$sub_group} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$sub_group_sub_filters{$sub_group} ||= []
MC/DC0%0/1
$sub_group_sub_filters{$sub_group} ||= []
$sub_group_sub_filters{$sub_group}
Truth table0%0/2
A
A= $sub_group_sub_filters{$sub_group}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | push @$list, $underlying, $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | push @primary, $underlying, $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | primary => \@primary, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | sub_group_filters => \%sub_group_filters, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | sub_group_sub_filters => \%sub_group_sub_filters, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | return $filter_breakdown; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | sub evaluate_subject_and_values { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
evaluate_subject_and_values: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my $subject = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | return unless (ref($subject) && $subject->isa($self->subject_class_name)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $subject and $subject->isa($self->subject_class_name)
MC/DC0%0/2
ref $subject and $subject->isa($self->subject_class_name)
ref $subject
$subject->isa($self->subject_class_name)
Truth table0%0/3
A and B
A= ref $subjectB= $subject->isa($self->subject_class_name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $filter_breakdown = $self->_filter_breakdown; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | my ($primary,$sub_group_filters,$sub_group_sub_filters) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | = @$filter_breakdown{"primary","sub_group_filters","sub_group_sub_filters"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # flattening expresions now requires that we re-group them :( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # these effectively are subqueries where they occur | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # check the ungrouped comparisons first since they are simpler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | for (my $n = 0; $n < @$primary; $n+=2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my $underlying = $primary->[$n]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $pos = $primary->[$n+1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | my $value = $_[$pos]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | unless ($underlying->evaluate_subject_and_values($subject, $value)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # only check the complicated rules if none of the above failed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | if (%$sub_group_filters) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | #$DB::single = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | for my $sub_group (keys %$sub_group_filters) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | my $filters = $sub_group_filters->{$sub_group}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | my $sub_filters = $sub_group_sub_filters->{$sub_group}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | print "FILTERING $sub_group: " . Data::Dumper::Dumper($filters, $sub_filters); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 266 | ▶ | sub params_list_for_values { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
params_list_for_values: called CC=7 SCAR=23.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # This is the reverse of the bulk of resolve. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # It returns the params in list form, directly coercable into a hash if necessary. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | # $r = UR::BoolExpr->resolve($c1,@p1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # ($c2, @p2) = ($r->subject_class_name, $r->params_list); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 266 | my $rule_template = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 266 | my @values_sorted = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 266 | my @keys_sorted = $rule_template->_underlying_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 266 | my $constant_values = $rule_template->_constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 266 | my @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 266 | my ($v,$c) = (0,0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 266 | ▶ | for (my $k=0; $k<@keys_sorted; $k++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 532 | my $key = $keys_sorted[$k]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | #if (substr($key,0,1) eq "_") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 532 | ▶ | if (UR::BoolExpr::Util::is_meta_param($key)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $value = $constant_values->[$c]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | push @params, $key, $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $c++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 532 | my ($property, $op) = ($key =~ /^(\-*[\w\.]+)\s*(.*)$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 532 | ▶ | unless ($property) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $DB::single = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | Carp::confess("bad key '$key' in ",join(', ', @keys_sorted)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 532 | my $value = $values_sorted[$v]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 532 | ▶ | if ($op) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if ($op ne "in") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | if ($op =~ /^(.+)-(.+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $value = { operator => $1, value => $value, escape => $2 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | $value = { operator => $op, value => $value }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 532 | push @params, $property, $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 532 | $v++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 266 | return @params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 798 | ▶ | sub _fast_construct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fast_construct: called CC=116 SCAR=72.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 798 | my ($class, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | $subject_class_name, # produces subject class meta | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | $keys, # produces logic detail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | $constant_values, # produces constant value id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | $logic_detail, # optional, passed by get | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | $constant_value_id, # optional, passed by get | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | $subject_class_meta, # optional, passed by bx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 798 | my $logic_type = 'And'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 798 | ▶ | $logic_detail ||= join(",",@$keys); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$logic_detail ||= join(",", @$keys)
MC/DC0%0/2
$logic_detail ||= join(",", @$keys)
$logic_detail
join(",", @$keys)
Truth table66%2/3
A ||= B
A= $logic_detailB= join(",", @$keys)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 798 | ▶ | $constant_value_id ||= UR::BoolExpr::Util::values_to_value_id(@$constant_values); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$constant_value_id ||= UR::BoolExpr::Util::values_to_value_id(@$constant_values)
MC/DC0%0/2
$constant_value_id ||= UR::BoolExpr::Util::values_to_value_id(@$constant_values)
$constant_value_id
UR::BoolExpr::Util::values_to_value_id(@$constant_values)
Truth table66%2/3
A ||= B
A= $constant_value_idB= UR::BoolExpr::Util::values_to_value_id(@$constant_values)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 798 | my $id = join('/',$subject_class_name,$logic_type,$logic_detail,$constant_value_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 798 | my $self = $UR::Object::rule_templates->{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 798 | ▶ | return $self if $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 798 | ▶ | $subject_class_meta ||= $subject_class_name->__meta__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$subject_class_meta ||= $subject_class_name->__meta__
MC/DC0%0/2
$subject_class_meta ||= $subject_class_name->__meta__
$subject_class_meta
$subject_class_name->__meta__
Truth table33%1/3
A ||= B
A= $subject_class_metaB= $subject_class_name->__meta__
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # See what properties are id-related for the class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 798 | ▶ | my $cache = $subject_class_meta->{cache}{'UR::BoolExpr::Template::get'} ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$subject_class_meta->{"cache"}{"UR::BoolExpr::Template::get"} ||= do {
my $id_related = {};
my $id_translations = [];
my $id_pos = {};
my $id_prop_is_real;
foreach my $iclass ($subject_class_name, $subject_class_meta->ancestry_class_names) {
last if $iclass eq "UR::Object";
next unless $iclass->isa("UR::Object");
my $iclass_meta = $iclass->__meta__;
my(@id_props) = $iclass_meta->id_property_names;
next unless @id_props;
$id_prop_is_real = 1 if grep {$_ eq "id";} @id_props;
next if @id_props == 1 and $id_props[0] eq "id" and not $id_prop_is_real;
@$id_related{@id_props} = @id_props;
push @$id_translations, \@id_props;
@$id_pos{@id_props} = 0 .. $#id_props unless @id_props == 1 and $id_props[0] eq "id";
};
[$id_related, $id_translations, $id_pos]
}
MC/DC0%0/2
$subject_class_meta->{"cache"}{"UR::BoolExpr::Template::get"} ||= do {
my $id_related = {};
my $id_translations = [];
my $id_pos = {};
my $id_prop_is_real;
foreach my $iclass ($subject_class_name, $subject_class_meta->ancestry_class_names) {
last if $iclass eq "UR::Object";
next unless $iclass->isa("UR::Object");
my $iclass_meta = $iclass->__meta__;
my(@id_props) = $iclass_meta->id_property_names;
next unless @id_props;
$id_prop_is_real = 1 if grep {$_ eq "id";} @id_props;
next if @id_props == 1 and $id_props[0] eq "id" and not $id_prop_is_real;
@$id_related{@id_props} = @id_props;
push @$id_translations, \@id_props;
@$id_pos{@id_props} = 0 .. $#id_props unless @id_props == 1 and $id_props[0] eq "id";
};
[$id_related, $id_translations, $id_pos]
}
$subject_class_meta->{"cache"}{"UR::BoolExpr::Template::get"}
do {
my $id_related = {};
my $id_translations = [];
my $id_pos = {};
my $id_prop_is_real;
foreach my $iclass ($subject_class_name, $subject_class_meta->ancestry_class_names) {
last if $iclass eq "UR::Object";
next unless $iclass->isa("UR::Object");
my $iclass_meta = $iclass->__meta__;
my(@id_props) = $iclass_meta->id_property_names;
next unless @id_props;
$id_prop_is_real = 1 if grep {$_ eq "id";} @id_props;
next if @id_props == 1 and $id_props[0] eq "id" and not $id_prop_is_real;
@$id_related{@id_props} = @id_props;
push @$id_translations, \@id_props;
@$id_pos{@id_props} = 0 .. $#id_props unless @id_props == 1 and $id_props[0] eq "id";
};
[$id_related, $id_translations, $id_pos]
}
Truth table66%2/3
A ||= B
A= $subject_class_meta->{"cache"}{"UR::BoolExpr::Template::get"}B= do {
my $id_related = {};
my $id_translations = [];
my $id_pos = {};
my $id_prop_is_real;
foreach my $iclass ($subject_class_name, $subject_class_meta->ancestry_class_names) {
last if $iclass eq "UR::Object";
next unless $iclass->isa("UR::Object");
my $iclass_meta = $iclass->__meta__;
my(@id_props) = $iclass_meta->id_property_names;
next unless @id_props;
$id_prop_is_real = 1 if grep {$_ eq "id";} @id_props;
next if @id_props == 1 and $id_props[0] eq "id" and not $id_prop_is_real;
@$id_related{@id_props} = @id_props;
push @$id_translations, \@id_props;
@$id_pos{@id_props} = 0 .. $#id_props unless @id_props == 1 and $id_props[0] eq "id";
};
[$id_related, $id_translations, $id_pos]
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 532 | my $id_related = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 532 | my $id_translations = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 532 | my $id_pos = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 532 | my $id_prop_is_real; # true if there's a property called 'id' that's a real property, not from UR::Object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 532 | for my $iclass ($subject_class_name, $subject_class_meta->ancestry_class_names) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 1064 | ▶ | last if $iclass eq "UR::Object"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 532 | ▶ | next unless $iclass->isa("UR::Object"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 532 | my $iclass_meta = $iclass->__meta__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 532 | my @id_props = $iclass_meta->id_property_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 532 | ▶ | next unless @id_props; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 532 | ▶ | $id_prop_is_real = 1 if (grep { $_ eq 'id'} @id_props); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 532 | ▶ | next if @id_props == 1 and $id_props[0] eq "id" and !$id_prop_is_real; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
@id_props == 1 and $id_props[0] eq "id" and not $id_prop_is_real
@id_props == 1 and $id_props[0] eq "id"
MC/DC0%0/3
@id_props == 1 and $id_props[0] eq "id" and not $id_prop_is_real
@id_props == 1
$id_props[0] eq "id"
not $id_prop_is_real
Truth table50%2/4
A and B and not(C)
A= @id_props == 1B= $id_props[0] eq "id"C= not $id_prop_is_real
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 532 | @$id_related{@id_props} = @id_props; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 532 | push @$id_translations, \@id_props; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 532 | ▶ | @$id_pos{@id_props} = (0..$#id_props) unless @id_props == 1 and $id_props[0] eq 'id'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@id_props == 1 and $id_props[0] eq "id"
MC/DC0%0/2
@id_props == 1 and $id_props[0] eq "id"
@id_props == 1
$id_props[0] eq "id"
Truth table66%2/3
A and B
A= @id_props == 1B= $id_props[0] eq "id"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 532 | [$id_related,$id_translations,$id_pos]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 798 | my ($id_related,$id_translations,$id_pos) = @$cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 798 | my @keys = @$keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 798 | my @constant_values = @$constant_values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | # Make a hash to quick-validate the params for duplication | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 266 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 798 | my %check_for_duplicate_rules; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 798 | ▶ | for (my $n=0; $n < @keys; $n++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 1330 | ▶ | next if UR::BoolExpr::Util::is_meta_param($keys[$n]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 1330 | my $pos = index($keys[$n],' '); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1330 | ▶ | if ($pos != -1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | my $property = substr($keys[$n],0,$pos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $check_for_duplicate_rules{$property}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 1330 | $check_for_duplicate_rules{$keys[$n]}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | # each item in this list mutates the initial set of key-value pairs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 798 | my $extenders = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # add new @$extenders for class-specific characteristics | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | # add new @keys at the same time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | # flag keys as removed also at the same time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | # note the positions for each key in the "original" rule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | # by original, we mean the original plus the extensions from above | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 798 | my $id_position = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 798 | my $var_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 798 | my $const_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 798 | my $property_meta_hash = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 798 | my $property_names = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 798 | for my $key (@keys) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 1330 | ▶ | if (UR::BoolExpr::Util::is_meta_param($key)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $property_meta_hash->{$key} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | name => $key, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | value_position => $const_pos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $const_pos++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 1330 | my ($name, $op) = ($key =~ /^(.+?)\s+(.*)$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 1330 | ▶ | $name ||= $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$name ||= $key
MC/DC0%0/2
$name ||= $key
$name
$key
Truth table33%1/3
A ||= B
A= $nameB= $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 1330 | ▶ | if ($name eq 'id') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 532 | $id_position = $var_pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 1330 | $property_meta_hash->{$name} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | operator => $op, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | value_position => $var_pos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 1330 | $var_pos++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 1330 | push @$property_names, $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | # Note whether there are properties not involved in the ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | # Add value extenders for any cases of id-related properties, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | # or aliases. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 798 | my $original_key_count = @keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 798 | my $id_only = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 798 | my $partial_id = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 798 | my $key_op_hash = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 798 | ▶ | if (@$id_translations and @{$id_translations->[0]} == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$id_translations and @{$id_translations->[0];} == 1
MC/DC50%1/2
@$id_translations and @{$id_translations->[0];} == 1
@$id_translations
@{$id_translations->[0];} == 1
Truth table66%2/3
A and B
A= @$id_translationsB= @{$id_translations->[0];} == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | # single-property ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | ## use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | ## print "single property id\n". Dumper($id_translations); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 532 | my ($property, $op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | # Presume we are only getting id properties until another is found. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | # If a multi-property is partially specified, we'll zero this out too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 532 | my $values_index = -1; # -1 so we can bump it at start of loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 532 | ▶ | for (my $key_pos = 0; $key_pos < $original_key_count; $key_pos++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 798 | my $key = $keys[$key_pos]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 798 | ▶ | if (UR::BoolExpr::Util::is_meta_param($key)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | # -* are constant value keys and do not need to be changed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 798 | $values_index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 798 | my ($property, $op) = ($key =~ /^(.+?)\s+(.*)$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 798 | ▶ | $property ||= $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$property ||= $key
MC/DC0%0/2
$property ||= $key
$property
$key
Truth table33%1/3
A ||= B
A= $propertyB= $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 798 | ▶ | $op ||= ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$op ||= ""
MC/DC0%0/1
$op ||= ""
$op
Truth table50%1/2
A
A= $op
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 798 | $op =~ s/\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 798 | ▶ | $key_op_hash->{$property} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$key_op_hash->{$property} ||= {}
MC/DC100%1/1
$key_op_hash->{$property} ||= {}
$key_op_hash->{$property}
Truth table100%2/2
A
A= $key_op_hash->{$property}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 798 | $key_op_hash->{$property}{$op}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 798 | ▶ | if ($property eq "id" or $id_related->{$property}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$property eq "id" or $id_related->{$property}
MC/DC0%0/2
$property eq "id" or $id_related->{$property}
$property eq "id"
$id_related->{$property}
Truth table66%2/3
A or B
A= $property eq "id"B= $id_related->{$property}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | # Put an id key into the key list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 798 | for my $alias (["id"], @$id_translations) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 1596 | ▶ | next if $alias->[0] eq $property; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 798 | ▶ | next if $check_for_duplicate_rules{$alias->[0]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 798 | ▶ | $op ||= ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$op ||= ""
MC/DC0%0/1
$op ||= ""
$op
Truth table50%1/2
A
A= $op
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 798 | ▶ | push @keys, $alias->[0] . ($op ? " $op" : ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 798 | push @$extenders, [ [$values_index], undef, $keys[-1] ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 798 | ▶ | $key_op_hash->{$alias->[0]} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$key_op_hash{$alias->[0]} ||= {}
MC/DC100%1/1
$$key_op_hash{$alias->[0]} ||= {}
$$key_op_hash{$alias->[0]}
Truth table100%2/2
A
A= $$key_op_hash{$alias->[0]}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 798 | $key_op_hash->{$alias->[0]}{$op}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | ## print ">> extend for @$alias with op $op.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 798 | ▶ | unless ($op =~ m/^(=|eq|in|\[\]|)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | $id_only = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | elsif (! UR::BoolExpr::Util::is_meta_param($key)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | $id_only = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | ## print "non id single property $property on $subject_class\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | # multi-property ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | ## print "multi property id\n". Dumper($id_translations); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 266 | my ($property, $op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 266 | my %id_parts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 266 | my $values_index = -1; # -1 so we can bump it at start of loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 266 | my $id_op; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 266 | ▶ | for (my $key_pos = 0; $key_pos < $original_key_count; $key_pos++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 532 | my $key = $keys[$key_pos]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 532 | ▶ | if (UR::BoolExpr::Util::is_meta_param($key)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | # -* are constant value keys and do not need to be changed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 532 | $values_index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 532 | ▶ | next if UR::BoolExpr::Util::is_meta_param($key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 532 | my ($property, $op) = ($key =~ /^(.+?)\s+(.*)$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 532 | ▶ | $property ||= $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$property ||= $key
MC/DC0%0/2
$property ||= $key
$property
$key
Truth table33%1/3
A ||= B
A= $propertyB= $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 532 | ▶ | $op ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$op ||= ""
MC/DC0%0/1
$op ||= ""
$op
Truth table50%1/2
A
A= $op
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 532 | ▶ | $op =~ s/^\s+// if $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 532 | ▶ | $key_op_hash->{$property} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$key_op_hash->{$property} ||= {}
MC/DC0%0/1
$key_op_hash->{$property} ||= {}
$key_op_hash->{$property}
Truth table50%1/2
A
A= $key_op_hash->{$property}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 532 | $key_op_hash->{$property}{$op}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 532 | ▶ | if ($property eq "id") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | $id_op = $op; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | $key_op_hash->{id} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$key_op_hash->{"id"} ||= {}
MC/DC0%0/1
$key_op_hash->{"id"} ||= {}
$key_op_hash->{"id"}
Truth table0%0/2
A
A= $key_op_hash->{"id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | $key_op_hash->{id}{$op}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | # Put an id-breakdown key into the key list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | for my $alias (@$id_translations) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | my @new_keys = map { $_ . ($op ? " $op" : "") } @$alias; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | if (grep { $check_for_duplicate_rules{$_} } @$alias) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | #print "up @new_keys with @$alias\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | push @keys, @new_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | push @$extenders, [ [$values_index], "resolve_ordered_values_from_composite_id", @new_keys ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | for (@$alias) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | $key_op_hash->{$_} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$key_op_hash->{$_} ||= {}
MC/DC0%0/1
$key_op_hash->{$_} ||= {}
$key_op_hash->{$_}
Truth table0%0/2
A
A= $key_op_hash->{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | $key_op_hash->{$_}{$op}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | # print ">> extend for @$alias with op $op.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | elsif ($id_related->{$property}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 532 | ▶ | $id_op ||= $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$id_op ||= $op
MC/DC0%0/2
$id_op ||= $op
$id_op
$op
Truth table33%1/3
A ||= B
A= $id_opB= $op
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 532 | ▶ | if ($op eq "" or $op eq "eq" or $op eq "=" or $op eq 'in') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op eq "" or $op eq "eq" or $op eq "=" or $op eq "in"
$op eq "" or $op eq "eq" or $op eq "="
$op eq "" or $op eq "eq"
MC/DC0%0/4
$op eq "" or $op eq "eq" or $op eq "=" or $op eq "in"
$op eq ""
$op eq "eq"
$op eq "="
$op eq "in"
Truth table20%1/5
A or B or C or D
A= $op eq ""B= $op eq "eq"C= $op eq "="D= $op eq "in"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 532 | $id_parts{$id_pos->{$property}} = $values_index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | # We're doing some sort of gray-area comparison on an ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | # field, and though we could possibly resolve an ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | # from things like an 'in' op, it's more than we've done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | # before. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | $id_only = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | ## print "non id multi property $property on class $subject_class\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | $id_only = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 266 | ▶ | if (my $parts = (scalar(keys(%id_parts)))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | # some parts are id-related | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 266 | ▶ | if ($parts == @{$id_translations->[0]}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | # all parts are of the id are there | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 266 | ▶ | if (@$id_translations) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 266 | ▶ | if (grep { $_ eq 'id' } @keys) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | #print "found id already\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | #print "no id\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | # we have translations of that ID into underlying properties | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | #print "ADDING ID for " . join(",",keys %id_parts) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 266 | my @id_pos = sort { $a <=> $b } keys %id_parts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 266 | push @$extenders, [ [@id_parts{@id_pos}], "resolve_composite_id_from_ordered_values", 'id' ]; #TODO was this correct? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 266 | ▶ | $key_op_hash->{id} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$key_op_hash->{"id"} ||= {}
MC/DC0%0/1
$key_op_hash->{"id"} ||= {}
$key_op_hash->{"id"}
Truth table50%1/2
A
A= $key_op_hash->{"id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 266 | $key_op_hash->{id}{$id_op}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 266 | push @keys, "id"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | # not all parts of the id are there | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | ## print "partial id property $property on class $subject_class\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | $id_only = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | $partial_id = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | $id_only = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | $partial_id = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | # Determine the positions of each key in the parameter list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | # In actuality, the position of the key's value in the @values or @constant_values array, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | # depending on whether it is a -* key or not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 798 | my %key_positions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 798 | my $vpos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 798 | my $cpos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 798 | for my $key (@keys) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 2394 | ▶ | $key_positions{$key} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$key_positions{$key} ||= []
MC/DC100%1/1
$key_positions{$key} ||= []
$key_positions{$key}
Truth table100%2/2
A
A= $key_positions{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 2394 | ▶ | if (UR::BoolExpr::Util::is_meta_param($key)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | push @{ $key_positions{$key} }, $cpos++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 2394 | push @{ $key_positions{$key} }, $vpos++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | # Sort the keys, and make an arrayref which will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | # re-order the values to match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 798 | my $last_key = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 798 | ▶ | my @keys_sorted = map { $_ eq $last_key ? () : ($last_key = $_) } sort @keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 798 | my $normalized_positions_arrayref = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 798 | my $constant_value_normalized_positions = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 798 | my $recursion_desc = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 798 | my $hints = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 798 | my $order_by = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 798 | my $group_by = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 798 | my $page = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 798 | my $limit = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 798 | my $offset = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 798 | my $aggregate = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 798 | my @constant_values_sorted; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 798 | for my $key (@keys_sorted) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 1862 | my $pos_list = $key_positions{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 1862 | my $pos = pop @$pos_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 1862 | ▶ | if (UR::BoolExpr::Util::is_meta_param($key)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | push @$constant_value_normalized_positions, $pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | my $constant_value = $constant_values[$pos]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | if ($key eq '-recurse') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | $constant_value = [$constant_value] if (!ref $constant_value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | $recursion_desc = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | ▶ | elsif ($key eq '-hints' or $key eq '-hint') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key eq "-hints" or $key eq "-hint"
MC/DC0%0/2
$key eq "-hints" or $key eq "-hint"
$key eq "-hints"
$key eq "-hint"
Truth table0%0/3
A or B
A= $key eq "-hints"B= $key eq "-hint"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | $constant_value = [$constant_value] if (!ref $constant_value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | $hints = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | ▶ | elsif ($key eq '-order_by' or $key eq '-order') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key eq "-order_by" or $key eq "-order"
MC/DC0%0/2
$key eq "-order_by" or $key eq "-order"
$key eq "-order_by"
$key eq "-order"
Truth table0%0/3
A or B
A= $key eq "-order_by"B= $key eq "-order"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | ▶ | $constant_value = [$constant_value] if (!ref $constant_value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | $order_by = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | ▶ | elsif ($key eq '-group_by' or $key eq '-group') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$key eq "-group_by" or $key eq "-group"
MC/DC0%0/2
$key eq "-group_by" or $key eq "-group"
$key eq "-group_by"
$key eq "-group"
Truth table0%0/3
A or B
A= $key eq "-group_by"B= $key eq "-group"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | $constant_value = [$constant_value] if (!ref $constant_value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | $group_by = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | elsif ($key eq '-page') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | ▶ | $constant_value = [$constant_value] if (!ref $constant_value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | $page = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | elsif ($key eq '-limit') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $limit = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | elsif ($key eq '-offset') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | $offset = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | elsif ($key eq '-aggregate') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | ▶ | $constant_value = [$constant_value] if (!ref $constant_value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | $aggregate = $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | Carp::croak("Unknown special param '$key'. Expected one of: @UR::BoolExpr::Template::meta_param_names"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | push @constant_values_sorted, $constant_value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 1862 | push @$normalized_positions_arrayref, $pos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 798 | ▶ | if ($page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | ▶ | if (defined($limit) || defined($offset)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $limit or defined $offset
MC/DC0%0/2
defined $limit or defined $offset
defined $limit
defined $offset
Truth table0%0/3
A or B
A= defined $limitB= defined $offset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | Carp::croak("-page and -limit/-offset are mutually exclusive when defining a BoolExpr"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | if (ref($page) and ref($page) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $page and ref $page eq "ARRAY"
MC/DC0%0/2
ref $page and ref $page eq "ARRAY"
ref $page
ref $page eq "ARRAY"
Truth table0%0/3
A and B
A= ref $pageB= ref $page eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | ▶ | if (@$page == 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | $limit = $page->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | $offset = ($page->[0] - 1) * $limit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | } elsif (@$page) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | Carp::croak('-page must be an arrayref of two integers: -page => [$page_number, $page_size]'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | Carp::croak('-page must be an arrayref of two integers: -page => [$page_number, $page_size]'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 798 | ▶ | if (defined($hints) and ref($hints) ne 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $hints and ref $hints ne "ARRAY"
MC/DC0%0/2
defined $hints and ref $hints ne "ARRAY"
defined $hints
ref $hints ne "ARRAY"
Truth table33%1/3
A and B
A= defined $hintsB= ref $hints ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | ▶ | if (! ref($hints)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | $hints = [$hints]; # convert it to a list of one item | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | Carp::croak('-hints of a rule must be an arrayref of property names'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 798 | my $matches_all; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 798 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 798 | my $is_no_filters = (scalar(@keys_sorted) == scalar(@constant_values)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 798 | ▶ | $id_only = 0 if ($is_no_filters); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 798 | ▶ | $matches_all = ($is_no_filters && ! (defined($limit) or $offset)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%1/6
$is_no_filters && !(defined $limit || $offset)
defined $limit || $offset
MC/DC0%0/3
$is_no_filters && !(defined $limit || $offset)
$is_no_filters
defined $limit
$offset
Truth table25%1/4
A && not(B || C)
A= $is_no_filtersB= defined $limitC= $offset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | # these are used to rapidly turn a bx used for querying into one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | # suitable for object construction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 798 | my @ambiguous_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | my @ambiguous_property_names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 798 | ▶ | for (my $n=0; $n < @keys; $n++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 2394 | ▶ | next if UR::BoolExpr::Util::is_meta_param($keys[$n]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 2394 | my ($property, $op) = ($keys[$n] =~ /^(.+?)\s+(.*)$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 2394 | ▶ | $property ||= $keys[$n]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$property ||= $keys[$n]
MC/DC0%0/2
$property ||= $keys[$n]
$property
$keys[$n]
Truth table33%1/3
A ||= B
A= $propertyB= $keys[$n]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 2394 | ▶ | $op ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$op ||= ""
MC/DC0%0/1
$op ||= ""
$op
Truth table50%1/2
A
A= $op
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 2394 | ▶ | $op =~ s/^\s+// if $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 2394 | ▶ | if ($op and $op ne 'eq' and $op ne '==' and $op ne '=') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $op ne "eq" and $op ne "==" and $op ne "="
$op and $op ne "eq" and $op ne "=="
$op and $op ne "eq"
MC/DC0%0/4
$op and $op ne "eq" and $op ne "==" and $op ne "="
$op
$op ne "eq"
$op ne "=="
$op ne "="
Truth table20%1/5
A and B and C and D
A= $opB= $op ne "eq"C= $op ne "=="D= $op ne "="
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | push @ambiguous_keys, $keys[$n]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | push @ambiguous_property_names, $property; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | # Determine the rule template's ID. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | # The normalizer will store this. Below, we'll | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | # find or create the template for this ID. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 798 | ▶ | my $normalized_constant_value_id = (scalar(@constant_values_sorted) ? UR::BoolExpr::Util::values_to_value_id(@constant_values_sorted) : $constant_value_id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | my @keys_unaliased = $UR::Object::Type::bootstrapping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | ? @keys_sorted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | : map { $_->[0] = UR::BoolExpr::Util::is_meta_param($_->[0]) ? $_->[0] : $subject_class_meta->resolve_property_aliases($_->[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | join(' ',@$_); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | map { [ split(' ') ] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | @keys_sorted; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 798 | my $normalized_id = UR::BoolExpr::Template->__meta__->resolve_composite_id_from_ordered_values($subject_class_name, "And", join(",",@keys_unaliased), $normalized_constant_value_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 798 | ▶ | $self = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | subject_class_name => $subject_class_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | logic_type => $logic_type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | logic_detail => $logic_detail, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | constant_value_id => $constant_value_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | normalized_id => $normalized_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | # subclass specific | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | id_position => $id_position, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | is_id_only => $id_only, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | is_partial_id => $partial_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | is_unique => undef, # assigned on first use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | matches_all => $matches_all, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | key_op_hash => $key_op_hash, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | _property_names_arrayref => $property_names, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | _property_meta_hash => $property_meta_hash, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | recursion_desc => $recursion_desc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | hints => $hints, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | order_by => $order_by, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | group_by => $group_by, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | limit => $limit, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | offset => $offset, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | aggregate => $aggregate, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | is_normalized => ($id eq $normalized_id ? 1 : 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | normalized_positions_arrayref => $normalized_positions_arrayref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | constant_value_normalized_positions_arrayref => $constant_value_normalized_positions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | normalization_extender_arrayref => $extenders, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | num_values => scalar(@$keys), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | _keys => \@keys, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | _constant_values => $constant_values, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | _ambiguous_keys => (@ambiguous_keys ? \@ambiguous_keys : undef), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | _ambiguous_property_names => (@ambiguous_property_names ? \@ambiguous_property_names : undef), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | }, 'UR::BoolExpr::Template::And'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 798 | $UR::Object::rule_templates->{$id} = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 798 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 266 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | UR::BoolExpr::And - a rule which is true if ALL the underlying conditions are true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | UR::BoolExpr;(3) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||