line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RecordStream::Aggregator::UniqArray; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = "4.0.24"; |
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
3478
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
159
|
|
6
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
143
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
30
|
use App::RecordStream::Aggregator; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
110
|
|
9
|
6
|
|
|
6
|
|
29
|
use App::RecordStream::DomainLanguage::Registry; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
159
|
|
10
|
6
|
|
|
6
|
|
35
|
use App::RecordStream::DomainLanguage::Valuation::KeySpec; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
153
|
|
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
39
|
use base qw(App::RecordStream::Aggregator::Aggregation); |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
2051
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
1
|
|
|
1
|
0
|
5
|
my $class = shift; |
16
|
1
|
|
|
|
|
4
|
my $field = shift; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
5
|
return new_from_valuation($class, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field)); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new_from_valuation { |
22
|
10
|
|
|
10
|
0
|
17
|
my $class = shift; |
23
|
10
|
|
|
|
|
16
|
my $valuation = shift; |
24
|
|
|
|
|
|
|
|
25
|
10
|
|
|
|
|
22
|
my $this = |
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
'valuation' => $valuation, |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
10
|
|
|
|
|
18
|
bless $this, $class; |
31
|
|
|
|
|
|
|
|
32
|
10
|
|
|
|
|
24
|
return $this; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub squish { |
36
|
4
|
|
|
4
|
0
|
13
|
my ($this, $cookie) = @_; |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
38
|
return [ sort keys %$cookie ]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub long_usage { |
42
|
0
|
|
|
0
|
0
|
0
|
return <
|
43
|
|
|
|
|
|
|
Usage: uarray, |
44
|
|
|
|
|
|
|
Collect unique values from specified field into an array. |
45
|
|
|
|
|
|
|
EOF |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub short_usage { |
49
|
0
|
|
|
0
|
0
|
0
|
return "collect unique values from provided field into an array"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub argct { |
53
|
0
|
|
|
0
|
0
|
0
|
return 1; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub initial { |
57
|
4
|
|
|
4
|
0
|
12
|
return {}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub combine { |
61
|
16
|
|
|
16
|
0
|
34
|
my ($this, $cookie, $record) = @_; |
62
|
|
|
|
|
|
|
|
63
|
16
|
|
|
|
|
55
|
my $value = $this->{'valuation'}->evaluate_record($record); |
64
|
|
|
|
|
|
|
|
65
|
16
|
|
|
|
|
48
|
$cookie->{$value} = 1; |
66
|
|
|
|
|
|
|
|
67
|
16
|
|
|
|
|
87
|
return $cookie; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
App::RecordStream::Aggregator->register_implementation('uarray', __PACKAGE__); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'uarray', 'VALUATION'); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |