line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
19490
|
use strict; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
251
|
|
2
|
8
|
|
|
8
|
|
35
|
use warnings; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
352
|
|
3
|
|
|
|
|
|
|
package Math::Shape::Range; |
4
|
|
|
|
|
|
|
$Math::Shape::Range::VERSION = '0.15'; |
5
|
8
|
|
|
8
|
|
137
|
use 5.008; |
|
8
|
|
|
|
|
22
|
|
6
|
8
|
|
|
8
|
|
41
|
use Carp; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
454
|
|
7
|
8
|
|
|
8
|
|
472
|
use Math::Shape::Utils; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
553
|
|
8
|
8
|
|
|
8
|
|
53
|
use List::Util qw/min max/; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
2962
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: a range object which has min and max values |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
184
|
50
|
|
184
|
1
|
362
|
croak 'incorrect number of args' unless @_ == 3; |
16
|
184
|
|
|
|
|
245
|
my ($class, $min, $max) = @_; |
17
|
184
|
|
|
|
|
690
|
bless { min => $min, max => $max }, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub sort |
22
|
|
|
|
|
|
|
{ |
23
|
94
|
|
|
94
|
1
|
115
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
94
|
100
|
|
|
|
209
|
if ($self->{min} > $self->{max}) |
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
Math::Shape::Range->new( |
28
|
|
|
|
|
|
|
$self->{max}, |
29
|
|
|
|
|
|
|
$self->{min}, |
30
|
49
|
|
|
|
|
95
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else { |
33
|
45
|
|
|
|
|
136
|
$self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub is_overlapping |
39
|
|
|
|
|
|
|
{ |
40
|
42
|
50
|
|
42
|
1
|
148
|
croak 'Must provide another Math::Shape::Range object as argument' unless $_[1]->isa('Math::Shape::Range'); |
41
|
42
|
|
|
|
|
147
|
overlap($_[0]->{min}, $_[0]->{max}, $_[1]->{min}, $_[1]->{max}); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub hull |
46
|
|
|
|
|
|
|
{ |
47
|
26
|
50
|
|
26
|
1
|
85
|
croak 'Must provide another Math::Shape::Range object as argument' unless $_[1]->isa('Math::Shape::Range'); |
48
|
26
|
|
|
|
|
34
|
my ($self, $other_range) = @_; |
49
|
|
|
|
|
|
|
|
50
|
26
|
|
|
|
|
91
|
my $min = min $self->{min}, $other_range->{min}; |
51
|
26
|
|
|
|
|
66
|
my $max = max $self->{max}, $other_range->{max}; |
52
|
|
|
|
|
|
|
|
53
|
26
|
|
|
|
|
68
|
Math::Shape::Range->new($min, $max); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |