| 1 | package Data::Shared::Registry; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 40 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 40 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 40 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 40 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 40 | our @CARP_NOT = qw(Data::Shared Data::Shared::Adapter::Map | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | Data::Shared::Adapter::Set Data::Shared::Adapter::Indexed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | Data::Shared::Adapter::Sketch); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # ASCII digits only: \d accepts Unicode digits that the backend can numify to 0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 40 | my $INDEX_SHAPE = qr/\A-?[0-9]+\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 343 | ▶ | sub _index_shape_ok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_index_shape_ok: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 343 | ▶ | return defined $_[0] && $_[0] =~ $INDEX_SHAPE ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $_[0] and $_[0] =~ /$INDEX_SHAPE/
MC/DC100%2/2
defined $_[0] and $_[0] =~ /$INDEX_SHAPE/
defined $_[0]
$_[0] =~ /$INDEX_SHAPE/
Truth table100%3/3
A and B
A= defined $_[0]B= $_[0] =~ /$INDEX_SHAPE/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # Adapters validate key_int for every verb except the boolean exists probe. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 43170 | ▶ | sub _assert_index { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_assert_index: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 43170 | my ($key, $idx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 43170 | ▶ | Carp::croak("Data::Shared: $key: index must be an integer, not '" . (defined $idx ? $idx : 'undef') . "'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $idx and $idx =~ /$INDEX_SHAPE/
MC/DC50%1/2
defined $idx and $idx =~ /$INDEX_SHAPE/
defined $idx
$idx =~ /$INDEX_SHAPE/
Truth table66%2/3
A and B
A= defined $idxB= $idx =~ /$INDEX_SHAPE/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | unless defined $idx && $idx =~ $INDEX_SHAPE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 42860 | return $idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # Set-like leaves store no value: set means add, and the value is dropped. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 63 | ▶ | my $ADD_KEY = sub { my ($h, $k, $v) = @_; return $h->add($k) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 30 | ▶ | my $SET_ZERO = sub { my ($h, $i) = @_; return $h->set($i, 0) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 8 | ▶ | my $ESTIMATE_EXISTS = sub { my ($h, $k) = @_; return $h->estimate($k) > 0 ? 1 : 0 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 69 | ▶ | my $CAPACITY_EXISTS = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 69 | my ($h, $idx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 69 | ▶ | return 0 unless _index_shape_ok($idx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 46 | ▶ | return 0 if $idx < 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 44 | ▶ | return $idx < $h->capacity ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 40 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # An omitted delta uses the backend default; explicit undef is a missing argument. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 391 | ▶ | sub _assert_delta { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_assert_delta: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 391 | my ($key, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 391 | ▶ | Carp::croak("Data::Shared: $key: incr delta must be a number, not undef") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args and not defined $args[0]
MC/DC100%2/2
@args and not defined $args[0]
@args
not defined $args[0]
Truth table100%3/3
A and not(B)
A= @argsB= not defined $args[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | if @args && !defined $args[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 366 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # add() requires a delta and incr() accepts none. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 80 | ▶ | sub _incr_or_add { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_incr_or_add: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 80 | my ($family) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 72 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 72 | my ($h, $i, @delta) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 72 | ▶ | return $h->add($i, $delta[0]) if @delta && $h->can('add'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@delta and $h->can("add")
MC/DC100%2/2
@delta and $h->can("add")
@delta
$h->can("add")
Truth table100%3/3
A and B
A= @deltaB= $h->can("add")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 41 | ▶ | return $h->incr($i) if !@delta && $h->can('incr'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @delta and $h->can("incr")
MC/DC100%2/2
not @delta and $h->can("incr")
not @delta
$h->can("incr")
Truth table100%3/3
not(A) and B
A= not @deltaB= $h->can("incr")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 3 | ▶ | Carp::croak("Data::Shared: $family: " . ref($h) . " does not support 'incr'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | . (@delta ? ' with a delta' : ' without a delta') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | . ' (use shared_call for operations outside the generic verbs)'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # Graph's unsigned node-index ceiling; out-of-range native probes croak. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 40 | my $GRAPH_INDEX_MAX = 0xFFFFFFFF; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 40 | ▶ | sub _nonneg_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_nonneg_exists: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 40 | my ($method) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 12 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 12 | my ($h, $idx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 12 | ▶ | return 0 unless _index_shape_ok($idx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 10 | ▶ | return 0 if $idx < 0 || $idx > $GRAPH_INDEX_MAX; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$idx < 0 or $idx > $GRAPH_INDEX_MAX
MC/DC100%2/2
$idx < 0 or $idx > $GRAPH_INDEX_MAX
$idx < 0
$idx > $GRAPH_INDEX_MAX
Truth table100%3/3
A or B
A= $idx < 0B= $idx > $GRAPH_INDEX_MAX
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 7 | ▶ | return $h->$method($idx) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 40 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # The backend's native existence test croaks outside capacity. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 80 | ▶ | sub _bounded_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bounded_exists: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 80 | my ($method) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 14 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 14 | my ($h, $idx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 14 | ▶ | return 0 unless _index_shape_ok($idx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 12 | ▶ | return 0 if $idx < 0 || $idx >= $h->capacity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$idx < 0 or $idx >= $h->capacity
MC/DC100%2/2
$idx < 0 or $idx >= $h->capacity
$idx < 0
$idx >= $h->capacity
Truth table100%3/3
A or B
A= $idx < 0B= $idx >= $h->capacity
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 7 | ▶ | return $h->$method($idx) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 80 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # No `verbs` table means no generic verbs: every operation on that family goes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # through shared_call. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | our %REGISTRY = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | bitset => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | dist => 'Data-BitSet-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | class => 'Data::BitSet::Shared', path_class => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | key_int => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | get => 'test', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | exists => _bounded_exists('test'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # Explicit undef is a value; an omitted value must not clear the bit. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 11 | ▶ | set => sub { my ($h, $idx, $v) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 11 | ▶ | Carp::croak("Data::Shared: bitset set needs a value (1 to set, 0 to clear)") if @_ < 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 10 | ▶ | return $v ? $h->set($idx) : $h->clear($idx) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | delete => 'clear', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | bloomfilter => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | dist => 'Data-BloomFilter-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | class => 'Data::BloomFilter::Shared', path_class => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | get => 'contains', exists => 'contains', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | set => $ADD_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | buffer => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | dist => 'Data-Buffer-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | class => 'Data::Buffer::Shared::I64', path_class => 'map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | key_int => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 440 | variants => { map { $_ => { class => "Data::Buffer::Shared::$_" } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | qw(I8 I16 I32 I64 U8 U16 U32 U64 F32 F64 Str) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | get => 'get', set => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | exists => $CAPACITY_EXISTS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | delete => $SET_ZERO, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | incr => _incr_or_add('buffer'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | countingbloomfilter => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | dist => 'Data-CountingBloomFilter-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | class => 'Data::CountingBloomFilter::Shared', path_class => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | get => 'count_of', exists => 'contains', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | set => $ADD_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | delete => 'remove', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | countminsketch => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | dist => 'Data-CountMinSketch-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | class => 'Data::CountMinSketch::Shared', path_class => 'sketch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | get => 'estimate', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | exists => $ESTIMATE_EXISTS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 5 | ▶ | set => sub { my ($h, $k, $v) = @_; return $h->add($k, defined $v ? $v : 1) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | cuckoofilter => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | dist => 'Data-CuckooFilter-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | class => 'Data::CuckooFilter::Shared', path_class => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | get => 'count_of', exists => 'contains', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | set => $ADD_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | delete => 'remove', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ddsketch => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | dist => 'Data-DDSketch-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | class => 'Data::DDSketch::Shared', path_class => 'sketch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | deque => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | dist => 'Data-Deque-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | class => 'Data::Deque::Shared::Int', load => 'Data::Deque::Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | path_class => 'queue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | variants => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | Int => { class => 'Data::Deque::Shared::Int' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | Str => { class => 'Data::Deque::Shared::Str' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | push => 'push_back', pop => 'pop_front', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | disjointset => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | dist => 'Data-DisjointSet-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | class => 'Data::DisjointSet::Shared', path_class => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | key_int => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | get => 'find', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | exists => $CAPACITY_EXISTS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # DisjointSet numifies an omitted peer to 0 and cannot undo a merge. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 5 | ▶ | set => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 5 | my ($h, $m, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 5 | ▶ | Carp::croak("Data::Shared: disjointset set needs a second member to union with") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | unless _index_shape_ok($other); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 4 | return $h->union($m, $other); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | fenwick => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | dist => 'Data-Fenwick-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | class => 'Data::Fenwick::Shared', path_class => 'indexed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | key_int => 1, dims => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | get => 'point', set => 'set', incr => 'update', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 5 | ▶ | exists => sub { my ($h, $p) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 5 | ▶ | return (_index_shape_ok($p) && $p >= 1 && $p <= $h->size) ? 1 : 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
_index_shape_ok($p) and $p >= 1 and $p <= $h->size
_index_shape_ok($p) and $p >= 1
MC/DC66%2/3
_index_shape_ok($p) and $p >= 1 and $p <= $h->size
_index_shape_ok($p)
$p >= 1
$p <= $h->size
Truth table75%3/4
A and B and C
A= _index_shape_ok($p)B= $p >= 1C= $p <= $h->size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | delete => $SET_ZERO, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | fenwick2d => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | dist => 'Data-Fenwick2D-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | class => 'Data::Fenwick2D::Shared', path_class => 'indexed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | key_int => 1, dims => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | verbs => { get => 'point', set => 'set', incr => 'update' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | graph => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | dist => 'Data-Graph-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | class => 'Data::Graph::Shared', path_class => 'indexed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | key_int => 1, dims => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # Graph get croaks for absent nodes; has_node supplies a safe probe. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | verbs => { get => 'node_data', delete => 'remove_node', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | exists => _nonneg_exists('has_node') }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | hashmap => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | dist => 'Data-HashMap-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | class => 'Data::HashMap::Shared::II', path_class => 'map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | key_int => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 400 | ▶ | variants => { map { $_ => { class => "Data::HashMap::Shared::$_", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | key_int => /\AI/ ? 1 : 0 } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | qw(I16 I16S I32 I32S II IS SI SI16 SI32 SS) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | get => 'get', set => 'put', delete => 'remove', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | exists => 'exists', incr => 'incr', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | heap => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | dist => 'Data-Heap-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | class => 'Data::Heap::Shared', path_class => 'queue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | push => 'push', pop => 'pop', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | hiertimingwheel => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | dist => 'Data-HierTimingWheel-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | class => 'Data::HierTimingWheel::Shared', path_class => 'sync', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | histogram => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | dist => 'Data-Histogram-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | class => 'Data::Histogram::Shared', path_class => 'sketch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | hyperloglog => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | dist => 'Data-HyperLogLog-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | class => 'Data::HyperLogLog::Shared', path_class => 'sketch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | intern => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | dist => 'Data-Intern-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | class => 'Data::Intern::Shared', path_class => 'map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | get => 'id_of', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 4 | ▶ | set => sub { my ($h, $k, $v) = @_; return $h->intern($k) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | exists => 'exists', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | intervaltree => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | dist => 'Data-IntervalTree-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | class => 'Data::IntervalTree::Shared', path_class => 'indexed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | kdtree => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | dist => 'Data-KDTree-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | class => 'Data::KDTree::Shared', path_class => 'indexed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | log => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | dist => 'Data-Log-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | class => 'Data::Log::Shared', path_class => 'queue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | push => 'append', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | minhash => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | dist => 'Data-MinHash-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | class => 'Data::MinHash::Shared', path_class => 'sketch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ndarray => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | dist => 'Data-NDArray-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | class => 'Data::NDArray::Shared', path_class => 'indexed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | key_int => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | verbs => { get => 'get', set => 'set' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | perfecthash => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | dist => 'Data-PerfectHash-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | class => 'Data::PerfectHash::Shared', path_class => 'map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | ctor => 'handle_only', immutable => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | # Read from the built file: a replayed mount need not carry the build spec. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 25 | ▶ | key_int_from => sub { $_[0]->type eq 'int' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | verbs => { get => 'has', exists => 'has' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | pool => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | dist => 'Data-Pool-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | class => 'Data::Pool::Shared', load => 'Data::Pool::Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | path_class => 'map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | key_int => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | variants => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | I64 => { class => 'Data::Pool::Shared::I64' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | I32 => { class => 'Data::Pool::Shared::I32' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | F64 => { class => 'Data::Pool::Shared::F64' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | Str => { class => 'Data::Pool::Shared::Str' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | get => 'get', set => 'set', delete => 'free', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | exists => _bounded_exists('is_allocated'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | incr => _incr_or_add('pool'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | pubsub => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | dist => 'Data-PubSub-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | class => 'Data::PubSub::Shared::Int', path_class => 'queue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 160 | variants => { map { $_ => { class => "Data::PubSub::Shared::$_" } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | qw(Int Int32 Int16 Str) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | push => 'publish', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | queue => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | dist => 'Data-Queue-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | class => 'Data::Queue::Shared::Int', path_class => 'queue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 160 | variants => { map { $_ => { class => "Data::Queue::Shared::$_" } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | qw(Int Int32 Int16 Str) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | push => 'push', pop => 'pop', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | radixtree => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | dist => 'Data-RadixTree-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | class => 'Data::RadixTree::Shared', path_class => 'map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | key_join => '/', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | get => 'lookup', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 8 | ▶ | set => sub { my ($h, $k, $v) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 8 | ▶ | Carp::croak("Data::Shared: radixtree set needs a value") if @_ < 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 7 | return $h->insert($k, $v) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | delete => 'delete', exists => 'exists', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | reqrep => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | dist => 'Data-ReqRep-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | class => 'Data::ReqRep::Shared', path_class => 'sync', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | variants => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | Int => { class => 'Data::ReqRep::Shared::Int' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | reservoir => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | dist => 'Data-Reservoir-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | class => 'Data::Reservoir::Shared', path_class => 'sketch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | variants => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | weighted => { class => 'Data::Reservoir::Shared', ctor => 'new_weighted' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | ringbuffer => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | dist => 'Data-RingBuffer-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | class => 'Data::RingBuffer::Shared::Int', load => 'Data::RingBuffer::Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | path_class => 'queue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | variants => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | Int => { class => 'Data::RingBuffer::Shared::Int' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | F64 => { class => 'Data::RingBuffer::Shared::F64' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # The queue adapter checks no index, so this one checks its own. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 5 | ▶ | get => sub { my ($h, @rest) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 5 | ▶ | return $h->latest unless @rest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 3 | return $h->read_seq(_assert_index('ringbuffer', $rest[0])) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | push => 'write', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | roaringbitmap => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | dist => 'Data-RoaringBitmap-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | class => 'Data::RoaringBitmap::Shared', path_class => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | key_int => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | get => 'contains', exists => 'contains', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | set => $ADD_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | delete => 'remove', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | segmenttree => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | dist => 'Data-SegmentTree-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | class => 'Data::SegmentTree::Shared', path_class => 'indexed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | key_int => 1, dims => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # A point read; a range needs shared_call. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 4 | ▶ | get => sub { my ($h, $i) = @_; return $h->sum($i, $i) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | set => 'set', incr => 'add', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | # Shape-checked: a non-numeric index would numify to 0, which is in range. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 4 | ▶ | exists => sub { my ($h, $p) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 4 | ▶ | return (_index_shape_ok($p) && $p >= 0 && $p < $h->size) ? 1 : 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
_index_shape_ok($p) and $p >= 0 and $p < $h->size
_index_shape_ok($p) and $p >= 0
MC/DC66%2/3
_index_shape_ok($p) and $p >= 0 and $p < $h->size
_index_shape_ok($p)
$p >= 0
$p < $h->size
Truth table75%3/4
A and B and C
A= _index_shape_ok($p)B= $p >= 0C= $p < $h->size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | delete => $SET_ZERO, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | sortedset => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | dist => 'Data-SortedSet-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | class => 'Data::SortedSet::Shared', path_class => 'set', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | key_int => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | variants => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | Strings => { class => 'Data::SortedSet::Shared::Strings', key_int => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | get => 'score', exists => 'exists', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 47 | ▶ | set => sub { my ($h, $m, $score) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 47 | ▶ | Carp::croak("Data::Shared: sortedset set needs a score") if @_ < 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 46 | return $h->add($m, $score) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | delete => 'remove', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | # SortedSet::Strings accepts an omitted delta and may intern a ghost member. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 6 | ▶ | incr => sub { my ($h, $m, @delta) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 6 | ▶ | Carp::croak('Data::Shared: sortedset incr needs a delta') unless @delta; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 2 | return $h->incr($m, $delta[0]) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | spatialhash => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | dist => 'Data-SpatialHash-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | class => 'Data::SpatialHash::Shared', path_class => 'indexed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | stack => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | dist => 'Data-Stack-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | class => 'Data::Stack::Shared::Int', load => 'Data::Stack::Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | path_class => 'queue', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | variants => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | Int => { class => 'Data::Stack::Shared::Int' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | Str => { class => 'Data::Stack::Shared::Str' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | push => 'push', pop => 'pop', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | sync => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | dist => 'Data-Sync-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | class => 'Data::Sync::Shared::Semaphore', path_class => 'sync', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 40 | variants => { map { $_ => { class => "Data::Sync::Shared::$_" } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | qw(Semaphore Barrier RWLock Condvar Once) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | timingwheel => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | dist => 'Data-TimingWheel-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | class => 'Data::TimingWheel::Shared', path_class => 'sync', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | topk => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | dist => 'Data-TopK-Shared', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | class => 'Data::TopK::Shared', path_class => 'sketch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | variants => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | decayed => { class => 'Data::TopK::Shared', ctor => 'new_decayed' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | verbs => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | get => 'estimate', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | exists => $ESTIMATE_EXISTS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | set => $ADD_KEY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 40 | my %MIN_VERSION = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | bitset => '0.08', bloomfilter => '0.07', buffer => '0.09', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | countingbloomfilter => '0.05', countminsketch => '0.06', cuckoofilter => '0.06', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | ddsketch => '0.05', deque => '0.11', disjointset => '0.06', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | fenwick => '0.06', fenwick2d => '0.05', graph => '0.08', hashmap => '0.23', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | heap => '0.10', hiertimingwheel => '0.05', histogram => '0.06', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | hyperloglog => '0.06', intern => '0.06', intervaltree => '0.05', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | kdtree => '0.05', log => '0.08', minhash => '0.06', ndarray => '0.06', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | perfecthash => '0.05', pool => '0.10', pubsub => '0.11', queue => '0.10', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | radixtree => '0.06', reqrep => '0.09', reservoir => '0.06', ringbuffer => '0.07', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | roaringbitmap => '0.06', segmenttree => '0.07', sortedset => '0.07', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | spatialhash => '0.06', stack => '0.09', sync => '0.10', timingwheel => '0.05', topk => '0.07', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 40 | my %NATIVE_READONLY = map { $_ => 1 } qw(bitset bloomfilter countingbloomfilter countminsketch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | cuckoofilter ddsketch fenwick fenwick2d graph hashmap histogram hyperloglog intern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | intervaltree kdtree minhash ndarray radixtree roaringbitmap sortedset spatialhash); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 40 | for my $key (keys %REGISTRY) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 1560 | $REGISTRY{$key}{key} = $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 1560 | $REGISTRY{$key}{min_version} = $MIN_VERSION{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 1560 | ▶ | $REGISTRY{$key}{freeze} = $NATIVE_READONLY{$key} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | # SortedSet::Strings has neither freeze nor new_readonly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 40 | $REGISTRY{sortedset}{variants}{Strings}{freeze} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | # The family entry, with the variant's key_int where it differs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 14051 | ▶ | sub _variant_entry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_variant_entry: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 14051 | my ($e, $v) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 14051 | ▶ | return $e unless exists $v->{key_int} && ($v->{key_int} // 0) != ($e->{key_int} // 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition71%5/7
exists $v->{"key_int"} and ($v->{"key_int"} // 0) != ($e->{"key_int"} // 0)
$v->{"key_int"} // 0
$e->{"key_int"} // 0
MC/DC50%1/2
exists $v->{"key_int"} and ($v->{"key_int"} // 0) != ($e->{"key_int"} // 0)
exists $v->{"key_int"}
$v->{"key_int"}
MC/DC0%0/1
$e->{"key_int"} // 0
$e->{"key_int"}
Truth table66%2/3
A and B
A= exists $v->{"key_int"}B= $v->{"key_int"}
Truth table50%1/2
A
A= $e->{"key_int"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 9273 | return { %$e, key_int => $v->{key_int} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 3 | ▶ | sub registry { return \%REGISTRY } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registry: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 5 | ▶ | sub keys_list { my @k = sort keys %REGISTRY; return @k } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keys_list: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 1 | ▶ | sub entry_for_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
entry_for_key: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 1 | my ($key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 1 | return $REGISTRY{ lc $key }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 92 | ▶ | sub entry_for_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
entry_for_class: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 92 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 92 | for my $e (values %REGISTRY) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 3039 | ▶ | return $e if $e->{class} eq $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 3022 | ▶ | if (my $vs = $e->{variants}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 1002 | for my $v (values %$vs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 3745 | ▶ | return _variant_entry($e, $v) if $v->{class} eq $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 64 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # convention is how a family takes its backing path; read it, never re-derive it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 16536 | ▶ | sub resolve_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_spec: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 16536 | ▶ | my $resolved = _resolve_spec(@_) or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | $resolved->{convention} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | $resolved->{class} eq 'Data::SortedSet::Shared::Strings' ? 'options' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 16529 | ▶ | : ($resolved->{entry} && ($resolved->{entry}{ctor} // '') eq 'handle_only') ? 'handle' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%5/5
$resolved->{"entry"} and ($resolved->{"entry"}{"ctor"} // "") eq "handle_only"
$resolved->{"entry"}{"ctor"} // ""
MC/DC100%2/2
$resolved->{"entry"} and ($resolved->{"entry"}{"ctor"} // "") eq "handle_only"
$resolved->{"entry"}
$resolved->{"entry"}{"ctor"}
Truth table100%3/3
A and B
A= $resolved->{"entry"}B= $resolved->{"entry"}{"ctor"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | : 'leading'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 16529 | return $resolved; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 16536 | ▶ | sub _resolve_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve_spec: called CC=31 SCAR=35.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 16536 | my ($spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 16536 | ▶ | return undef unless defined $spec && !ref $spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $spec and not ref $spec
MC/DC50%1/2
defined $spec and not ref $spec
defined $spec
not ref $spec
Truth table66%2/3
A and not(B)
A= defined $specB= not ref $spec
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 16535 | ▶ | if (my $e = $REGISTRY{ lc $spec }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | return { entry => $e, class => $e->{class}, load => ($e->{load} // $e->{class}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 2430 | ▶ | ctor => ($e->{ctor} // 'new'), variant => undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
$e->{"load"} // $e->{"class"}
$e->{"ctor"} // "new"
MC/DC0%0/2
$e->{"load"} // $e->{"class"}
$e->{"load"}
$e->{"class"}
MC/DC100%1/1
$e->{"ctor"} // "new"
$e->{"ctor"}
Truth table66%2/3
A // B
A= $e->{"load"}B= $e->{"class"}
Truth table100%2/2
A
A= $e->{"ctor"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 14105 | ▶ | if ($spec =~ /^([^:]+):(.+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 14100 | my ($k, $vname) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 14100 | ▶ | if (my $e = $REGISTRY{ lc $k }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 14042 | ▶ | if (my $vs = $e->{variants}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 14042 | for my $vn (keys %$vs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 78604 | ▶ | if (lc $vn eq lc $vname) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 14040 | my $v = $vs->{$vn}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | return { entry => _variant_entry($e, $v), class => $v->{class}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | load => ($v->{load} // $e->{load} // $v->{class}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 14040 | ▶ | ctor => ($v->{ctor} // $e->{ctor} // 'new'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition72%8/11
($v->{"load"} // $e->{"load"}) // $v->{"class"}
$v->{"load"} // $e->{"load"}
($v->{"ctor"} // $e->{"ctor"}) // "new"
$v->{"ctor"} // $e->{"ctor"}
MC/DC0%0/3
($v->{"load"} // $e->{"load"}) // $v->{"class"}
$v->{"load"}
$e->{"load"}
$v->{"class"}
MC/DC50%1/2
($v->{"ctor"} // $e->{"ctor"}) // "new"
$v->{"ctor"}
$e->{"ctor"}
Truth table50%2/4
A // B // C
A= $v->{"load"}B= $e->{"load"}C= $v->{"class"}
Truth table66%2/3
A // B
A= $v->{"ctor"}B= $e->{"ctor"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | variant => lc $vn }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 2 | ▶ | if (lc $vname eq 'default') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | return { entry => $e, class => $e->{class}, load => ($e->{load} // $e->{class}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 1 | ▶ | ctor => ($e->{ctor} // 'new'), variant => undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$e->{"load"} // $e->{"class"}
$e->{"ctor"} // "new"
MC/DC0%0/2
$e->{"load"} // $e->{"class"}
$e->{"load"}
$e->{"class"}
MC/DC0%0/1
$e->{"ctor"} // "new"
$e->{"ctor"}
Truth table33%1/3
A // B
A= $e->{"load"}B= $e->{"class"}
Truth table50%1/2
A
A= $e->{"ctor"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 64 | ▶ | if (my $e = entry_for_class($spec)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 11 | ▶ | my $ctor = $e->{ctor} // 'new'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$e->{"ctor"} // "new"
MC/DC0%0/1
$e->{"ctor"} // "new"
$e->{"ctor"}
Truth table50%1/2
A
A= $e->{"ctor"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 11 | ▶ | my $load = $e->{load} // $spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$e->{"load"} // $spec
MC/DC0%0/2
$e->{"load"} // $spec
$e->{"load"}
$spec
Truth table66%2/3
A // B
A= $e->{"load"}B= $spec
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 11 | my $vname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 11 | ▶ | if (my $vs = $e->{variants}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 10 | for my $vn (sort keys %$vs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 40 | ▶ | if ($vs->{$vn}{class} eq $spec) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | next if $e->{class} eq $spec && defined $vs->{$vn}{ctor} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 10 | ▶ | && $vs->{$vn}{ctor} ne $ctor; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$e->{"class"} eq $spec and defined $vs->{$vn}{"ctor"} and $vs->{$vn}{"ctor"} ne $ctor
$e->{"class"} eq $spec and defined $vs->{$vn}{"ctor"}
MC/DC66%2/3
$e->{"class"} eq $spec and defined $vs->{$vn}{"ctor"} and $vs->{$vn}{"ctor"} ne $ctor
$e->{"class"} eq $spec
defined $vs->{$vn}{"ctor"}
$vs->{$vn}{"ctor"} ne $ctor
Truth table75%3/4
A and B and C
A= $e->{"class"} eq $specB= defined $vs->{$vn}{"ctor"}C= $vs->{$vn}{"ctor"} ne $ctor
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 8 | $vname = $vn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 8 | ▶ | $ctor = $vs->{$vn}{ctor} // $ctor; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$vs->{$vn}{"ctor"} // $ctor
MC/DC0%0/2
$vs->{$vn}{"ctor"} // $ctor
$vs->{$vn}{"ctor"}
$ctor
Truth table33%1/3
A // B
A= $vs->{$vn}{"ctor"}B= $ctor
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 8 | ▶ | $load = $vs->{$vn}{load} // $load; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$vs->{$vn}{"load"} // $load
MC/DC0%0/2
$vs->{$vn}{"load"} // $load
$vs->{$vn}{"load"}
$load
Truth table33%1/3
A // B
A= $vs->{$vn}{"load"}B= $load
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 8 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 11 | ▶ | return { entry => $e, class => $spec, load => $load, ctor => $ctor, variant => defined $vname ? lc $vname : undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 53 | ▶ | if ($spec =~ /^Data::/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 47 | return { entry => undef, class => $spec, load => $spec, ctor => 'new', variant => undef }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 6 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 40 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||