« blib/lib/App/RecordStream/Aggregator/RecordForMaximum.pm
↑ Summary
blib/lib/App/RecordStream/Operation/topn.pm »
| 1 | package App::RecordStream::Aggregator::RecordForMinimum; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | our $VERSION = "4.0.23"; | |||||||||
| 4 | |||||||||||
| 5 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 6 | ▶ | use App::RecordStream::Aggregator::MapReduce; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 6 | ▶ | use App::RecordStream::DomainLanguage::Registry; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 6 | ▶ | use App::RecordStream::DomainLanguage::Valuation::KeySpec; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 6 | ▶ | use base 'App::RecordStream::Aggregator::MapReduce'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | sub new | ||||||||||
| 15 | { | ||||||||||
| 16 | 0 | ▶ | my $class = shift; | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | 0 | my $field = shift; | |||||||||
| 18 | |||||||||||
| 19 | 0 | return new_from_valuation($class, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field)); | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | sub new_from_valuation | ||||||||||
| 23 | { | ||||||||||
| 24 | 0 | ▶ | my $class = shift; | ||||||||
|
Subroutine
new_from_valuation: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 25 | 0 | my ($valuation) = @_; | |||||||||
| 26 | |||||||||||
| 27 | 0 | my $this = | |||||||||
| 28 | { | ||||||||||
| 29 | 'valuation' => $valuation, | ||||||||||
| 30 | }; | ||||||||||
| 31 | 0 | bless $this, $class; | |||||||||
| 32 | |||||||||||
| 33 | 0 | return $this; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub map | ||||||||||
| 37 | { | ||||||||||
| 38 | 0 | ▶ | my ($this, $record) = @_; | ||||||||
|
Subroutine
map: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 39 | |||||||||||
| 40 | 0 | my $value = $this->{'valuation'}->evaluate_record($record); | |||||||||
| 41 | |||||||||||
| 42 | 0 | return [$value, $record]; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | sub reduce | ||||||||||
| 46 | { | ||||||||||
| 47 | 0 | ▶ | my ($this, $cookie1, $cookie2) = @_; | ||||||||
|
Subroutine
reduce: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 48 | |||||||||||
| 49 | 0 | my ($v1, $r1) = @$cookie1; | |||||||||
| 50 | 0 | my ($v2, $r2) = @$cookie2; | |||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | if($v1 < $v2) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | { | ||||||||||
| 54 | 0 | return $cookie1; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 0 | return $cookie2; | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | sub squish | ||||||||||
| 61 | { | ||||||||||
| 62 | 0 | ▶ | my ($this, $cookie) = @_; | ||||||||
|
Subroutine
squish: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 63 | |||||||||||
| 64 | 0 | my ($v, $r) = @$cookie; | |||||||||
| 65 | |||||||||||
| 66 | 0 | return $r; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | sub argct | ||||||||||
| 70 | { | ||||||||||
| 71 | 0 | ▶ | return 1; | ||||||||
|
Subroutine
argct: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | sub short_usage | ||||||||||
| 75 | { | ||||||||||
| 76 | 1 | ▶ | return "returns the record corresponding to the minimum value for a field"; | ||||||||
|
Subroutine
short_usage: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | sub long_usage | ||||||||||
| 80 | { | ||||||||||
| 81 | 0 | ▶ | return <<EOF; | ||||||||
|
Subroutine
long_usage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 82 | Usage: recformin,<field> | ||||||||||
| 83 | The record corresponding to the minimum value of specified field. | ||||||||||
| 84 | EOF | ||||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | 6 | App::RecordStream::Aggregator->register_implementation('recformin', __PACKAGE__); | |||||||||
| 88 | 6 | App::RecordStream::Aggregator->register_implementation('recforminimum', __PACKAGE__); | |||||||||
| 89 | 6 | App::RecordStream::Aggregator->register_implementation('recordformin', __PACKAGE__); | |||||||||
| 90 | 6 | App::RecordStream::Aggregator->register_implementation('recordforminimum', __PACKAGE__); | |||||||||
| 91 | |||||||||||
| 92 | 6 | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'recformin', 'VALUATION'); | |||||||||
| 93 | 6 | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'recforminimum', 'VALUATION'); | |||||||||
| 94 | 6 | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'recordformin', 'VALUATION'); | |||||||||
| 95 | 6 | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'recordforminimum', 'VALUATION'); | |||||||||
| 96 | |||||||||||
| 97 | 6 | 1; | |||||||||