| 1 | 2 | ▶ | use 5.008; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Data::Timeline; | ||||||||||||||||||||
| 6 | 2 | our $VERSION = '1.100860'; | |||||||||||||||||||
| 7 | # ABSTRACT: Time line represented as an object | ||||||||||||||||||||
| 8 | 2 | ▶ | use parent qw(Class::Accessor::Complex Class::Accessor::Constructor); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 2 | __PACKAGE__ | |||||||||||||||||||
| 10 | ->mk_constructor | ||||||||||||||||||||
| 11 | ->mk_array_accessors(qw(entries)); | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 0 | ▶ | sub merge_timeline { | ||||||||||||||||||
|
Subroutine
merge_timeline: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 14 | 0 | my ($self, $timeline) = @_; | |||||||||||||||||||
| 15 | 0 | $self->entries(sort { $a->timestamp <=> $b->timestamp } | |||||||||||||||||||
| 16 | ($self->entries, $timeline->entries)); | ||||||||||||||||||||
| 17 | 0 | $self; # for chaining | |||||||||||||||||||
| 18 | } | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 0 | ▶ | sub filter_timeline_by_type { | ||||||||||||||||||
|
Subroutine
filter_timeline_by_type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 21 | 0 | my ($self, $type) = @_; | |||||||||||||||||||
| 22 | 0 | Data::Timeline->new(entries => grep { $_->type eq $type } $self->entries); | |||||||||||||||||||
| 23 | } | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 0 | ▶ | sub filter_timeline_by_date { | ||||||||||||||||||
|
Subroutine
filter_timeline_by_date: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 26 | 0 | my ($self, $from, $to) = @_; | |||||||||||||||||||
| 27 | Data::Timeline->new( | ||||||||||||||||||||
| 28 | 0 | ▶ | entries => grep { ($from <= $_->timestamp) && ($_->timestamp <= $to) } | ||||||||||||||||||
|
Condition0%0/3
$from <= $_->timestamp && $_->timestamp <= $to
MC/DC0%0/2
$from <= $_->timestamp && $_->timestamp <= $to
$from <= $_->timestamp
$_->timestamp <= $to
Truth table0%0/3
A && B
A= $from <= $_->timestampB= $_->timestamp <= $to
| |||||||||||||||||||||
| 29 | $self->entries); | ||||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | 2 | 1; | |||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||