line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Farly::Transport::Object;
|
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
269
|
use 5.008008;
|
|
17
|
|
|
|
|
50
|
|
|
17
|
|
|
|
|
814
|
|
4
|
17
|
|
|
17
|
|
84
|
use strict;
|
|
17
|
|
|
|
|
28
|
|
|
17
|
|
|
|
|
523
|
|
5
|
17
|
|
|
17
|
|
77
|
use warnings;
|
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
8900
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.26';
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub size {
|
10
|
0
|
|
|
0
|
1
|
0
|
return $_[0]->last - $_[0]->first;
|
11
|
|
|
|
|
|
|
}
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub equals {
|
14
|
163
|
|
|
163
|
1
|
318
|
my ( $self, $other ) = @_;
|
15
|
|
|
|
|
|
|
|
16
|
163
|
100
|
|
|
|
988
|
if ( $other->isa('Farly::Transport::Object') ) {
|
17
|
|
|
|
|
|
|
|
18
|
63
|
|
100
|
|
|
217
|
return $self->first == $other->first
|
19
|
|
|
|
|
|
|
&& $self->last == $other->last;
|
20
|
|
|
|
|
|
|
}
|
21
|
|
|
|
|
|
|
}
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub contains {
|
24
|
54
|
|
|
54
|
1
|
66
|
my ( $self, $other ) = @_;
|
25
|
|
|
|
|
|
|
|
26
|
54
|
50
|
|
|
|
204
|
if ( $other->isa('Farly::Transport::Object') ) {
|
27
|
|
|
|
|
|
|
|
28
|
54
|
|
100
|
|
|
122
|
return $self->first <= $other->first
|
29
|
|
|
|
|
|
|
&& $self->last >= $other->last;
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
}
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub intersects {
|
34
|
7
|
|
|
7
|
1
|
12
|
my ( $self, $other ) = @_;
|
35
|
|
|
|
|
|
|
|
36
|
7
|
50
|
|
|
|
36
|
if ( $other->isa('Farly::Transport::Object') ) {
|
37
|
|
|
|
|
|
|
|
38
|
7
|
|
33
|
|
|
18
|
return ( $self->first <= $other->first && $other->first <= $self->last )
|
39
|
|
|
|
|
|
|
|| ( $self->first <= $other->last && $other->last <= $self->last )
|
40
|
|
|
|
|
|
|
|| ( $other->first <= $self->first && $self->first <= $other->last );
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
}
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub gt {
|
45
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $other ) = @_;
|
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
0
|
if ( $other->isa('Farly::Transport::Object') ) {
|
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
return $self->first > $other->last;
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
}
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub lt {
|
54
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $other ) = @_;
|
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
0
|
if ( $other->isa('Farly::Transport::Object') ) {
|
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
return $self->last < $other->first;
|
59
|
|
|
|
|
|
|
}
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub adjacent {
|
63
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $other ) = @_;
|
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
0
|
if ( $other->isa('Farly::Transport::Object') ) {
|
66
|
|
|
|
|
|
|
|
67
|
0
|
|
0
|
|
|
0
|
return $self->size() == $other->size()
|
68
|
|
|
|
|
|
|
&& ( $self->last + 1 ) == $other->first;
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
}
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub compare {
|
73
|
25
|
|
|
25
|
0
|
62
|
my ( $self, $other ) = @_;
|
74
|
|
|
|
|
|
|
|
75
|
25
|
50
|
|
|
|
106
|
if ( $other->isa('Farly::Transport::Object') ) {
|
76
|
|
|
|
|
|
|
|
77
|
25
|
|
100
|
|
|
60
|
return ( $self->first() <=> $other->first()
|
78
|
|
|
|
|
|
|
|| $other->last() <=> $self->last() );
|
79
|
|
|
|
|
|
|
}
|
80
|
|
|
|
|
|
|
}
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1;
|
83
|
|
|
|
|
|
|
__END__
|