line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
16469
|
use strict; |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
237
|
|
2
|
8
|
|
|
8
|
|
27
|
use warnings; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
319
|
|
3
|
|
|
|
|
|
|
package Math::Shape::Range; |
4
|
|
|
|
|
|
|
$Math::Shape::Range::VERSION = '0.14'; |
5
|
8
|
|
|
8
|
|
109
|
use 5.008; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
219
|
|
6
|
8
|
|
|
8
|
|
28
|
use Carp; |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
389
|
|
7
|
8
|
|
|
8
|
|
386
|
use Math::Shape::Utils; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
471
|
|
8
|
8
|
|
|
8
|
|
219
|
use List::Util qw/min max/; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
2367
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: a range object which has min and max values |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
184
|
50
|
|
184
|
1
|
257
|
croak 'incorrect number of args' unless @_ == 3; |
16
|
184
|
|
|
|
|
177
|
my ($class, $min, $max) = @_; |
17
|
184
|
|
|
|
|
562
|
bless { min => $min, max => $max }, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub sort |
22
|
|
|
|
|
|
|
{ |
23
|
94
|
|
|
94
|
1
|
121
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
94
|
100
|
|
|
|
199
|
if ($self->{min} > $self->{max}) |
26
|
|
|
|
|
|
|
{ |
27
|
49
|
|
|
|
|
79
|
Math::Shape::Range->new( |
28
|
|
|
|
|
|
|
$self->{max}, |
29
|
|
|
|
|
|
|
$self->{min}, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else { |
33
|
45
|
|
|
|
|
106
|
$self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub is_overlapping |
39
|
|
|
|
|
|
|
{ |
40
|
42
|
50
|
|
42
|
1
|
114
|
croak 'Must provide another Math::Shape::Range object as argument' unless $_[1]->isa('Math::Shape::Range'); |
41
|
42
|
|
|
|
|
116
|
overlap($_[0]->{min}, $_[0]->{max}, $_[1]->{min}, $_[1]->{max}); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub hull |
46
|
|
|
|
|
|
|
{ |
47
|
26
|
50
|
|
26
|
1
|
79
|
croak 'Must provide another Math::Shape::Range object as argument' unless $_[1]->isa('Math::Shape::Range'); |
48
|
26
|
|
|
|
|
27
|
my ($self, $other_range) = @_; |
49
|
|
|
|
|
|
|
|
50
|
26
|
|
|
|
|
75
|
my $min = min $self->{min}, $other_range->{min}; |
51
|
26
|
|
|
|
|
53
|
my $max = max $self->{max}, $other_range->{max}; |
52
|
|
|
|
|
|
|
|
53
|
26
|
|
|
|
|
46
|
Math::Shape::Range->new($min, $max); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |