line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
15171
|
use strict; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
242
|
|
2
|
8
|
|
|
8
|
|
30
|
use warnings; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
324
|
|
3
|
|
|
|
|
|
|
package Math::Shape::Range; |
4
|
|
|
|
|
|
|
$Math::Shape::Range::VERSION = '0.13'; |
5
|
8
|
|
|
8
|
|
113
|
use 5.008; |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
253
|
|
6
|
8
|
|
|
8
|
|
33
|
use Carp; |
|
8
|
|
|
|
|
7
|
|
|
8
|
|
|
|
|
421
|
|
7
|
8
|
|
|
8
|
|
353
|
use Math::Shape::Utils; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
455
|
|
8
|
8
|
|
|
8
|
|
36
|
use List::Util qw/min max/; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
2516
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: a range object which has min and max values |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
184
|
50
|
|
184
|
1
|
270
|
croak 'incorrect number of args' unless @_ == 3; |
16
|
184
|
|
|
|
|
180
|
my ($class, $min, $max) = @_; |
17
|
184
|
|
|
|
|
591
|
bless { min => $min, max => $max }, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub sort |
22
|
|
|
|
|
|
|
{ |
23
|
94
|
|
|
94
|
1
|
90
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
94
|
100
|
|
|
|
184
|
if ($self->{min} > $self->{max}) |
26
|
|
|
|
|
|
|
{ |
27
|
49
|
|
|
|
|
90
|
Math::Shape::Range->new( |
28
|
|
|
|
|
|
|
$self->{max}, |
29
|
|
|
|
|
|
|
$self->{min}, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else { |
33
|
45
|
|
|
|
|
119
|
$self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub is_overlapping |
39
|
|
|
|
|
|
|
{ |
40
|
42
|
50
|
|
42
|
1
|
129
|
croak 'Must provide another Math::Shape::Range object as argument' unless $_[1]->isa('Math::Shape::Range'); |
41
|
42
|
|
|
|
|
127
|
overlap($_[0]->{min}, $_[0]->{max}, $_[1]->{min}, $_[1]->{max}); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub hull |
46
|
|
|
|
|
|
|
{ |
47
|
26
|
50
|
|
26
|
1
|
80
|
croak 'Must provide another Math::Shape::Range object as argument' unless $_[1]->isa('Math::Shape::Range'); |
48
|
26
|
|
|
|
|
28
|
my ($self, $other_range) = @_; |
49
|
|
|
|
|
|
|
|
50
|
26
|
|
|
|
|
81
|
my $min = min $self->{min}, $other_range->{min}; |
51
|
26
|
|
|
|
|
44
|
my $max = max $self->{max}, $other_range->{max}; |
52
|
|
|
|
|
|
|
|
53
|
26
|
|
|
|
|
51
|
Math::Shape::Range->new($min, $max); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |