line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Farly::Value::Integer;
|
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
15357
|
use 5.008008;
|
|
17
|
|
|
|
|
52
|
|
|
17
|
|
|
|
|
865
|
|
4
|
17
|
|
|
17
|
|
85
|
use strict;
|
|
17
|
|
|
|
|
49
|
|
|
17
|
|
|
|
|
506
|
|
5
|
17
|
|
|
17
|
|
218
|
use warnings;
|
|
17
|
|
|
|
|
36
|
|
|
17
|
|
|
|
|
632
|
|
6
|
17
|
|
|
17
|
|
88
|
use Carp;
|
|
17
|
|
|
|
|
36
|
|
|
17
|
|
|
|
|
10810
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.26';
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new {
|
11
|
122
|
|
|
122
|
1
|
8488
|
my ( $class, $number ) = @_;
|
12
|
|
|
|
|
|
|
|
13
|
122
|
100
|
|
|
|
647
|
confess "integer required"
|
14
|
|
|
|
|
|
|
unless defined($number);
|
15
|
|
|
|
|
|
|
|
16
|
121
|
|
|
|
|
563
|
$number =~ s/^\s+|\s+$//g;
|
17
|
|
|
|
|
|
|
|
18
|
121
|
100
|
|
|
|
1032
|
confess "not an integer"
|
19
|
|
|
|
|
|
|
unless ( $number =~ /^\d+$/ );
|
20
|
|
|
|
|
|
|
|
21
|
120
|
|
|
|
|
584
|
return bless( \$number, $class );
|
22
|
|
|
|
|
|
|
}
|
23
|
|
|
|
|
|
|
|
24
|
392
|
|
|
392
|
1
|
394
|
sub number { return ${ $_[0] } }
|
|
392
|
|
|
|
|
1274
|
|
25
|
|
|
|
|
|
|
|
26
|
121
|
|
|
121
|
1
|
240
|
sub as_string { return ${ $_[0] } }
|
|
121
|
|
|
|
|
591
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub equals {
|
29
|
170
|
|
|
170
|
1
|
251
|
my ( $self, $other ) = @_;
|
30
|
|
|
|
|
|
|
|
31
|
170
|
100
|
|
|
|
881
|
if ( $other->isa('Farly::Value::Integer') ) {
|
32
|
116
|
|
|
|
|
226
|
return $self->number() == $other->number();
|
33
|
|
|
|
|
|
|
}
|
34
|
|
|
|
|
|
|
}
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub contains {
|
37
|
1
|
|
|
1
|
1
|
2
|
my ( $self, $other ) = @_;
|
38
|
1
|
|
|
|
|
3
|
return $self->equals($other);
|
39
|
|
|
|
|
|
|
}
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub intersects {
|
42
|
2
|
|
|
2
|
1
|
7
|
my ( $self, $other ) = @_;
|
43
|
2
|
|
|
|
|
7
|
return $self->equals($other);
|
44
|
|
|
|
|
|
|
}
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub compare {
|
47
|
71
|
|
|
71
|
0
|
87
|
my ( $self, $other ) = @_;
|
48
|
|
|
|
|
|
|
|
49
|
71
|
50
|
|
|
|
290
|
if ( $other->isa('Farly::Value::Integer') ) {
|
50
|
71
|
|
|
|
|
126
|
return $self->number() <=> $other->number();
|
51
|
|
|
|
|
|
|
}
|
52
|
|
|
|
|
|
|
}
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub gt {
|
55
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $other ) = @_;
|
56
|
|
|
|
|
|
|
|
57
|
2
|
50
|
|
|
|
11
|
if ( $other->isa('Farly::Value::Integer') ) {
|
58
|
2
|
|
|
|
|
5
|
return $self->number() > $other->number();
|
59
|
|
|
|
|
|
|
}
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub lt {
|
63
|
1
|
|
|
1
|
1
|
3
|
my ( $self, $other ) = @_;
|
64
|
|
|
|
|
|
|
|
65
|
1
|
50
|
|
|
|
7
|
if ( $other->isa('Farly::Value::Integer') ) {
|
66
|
1
|
|
|
|
|
3
|
return $self->number() < $other->number();
|
67
|
|
|
|
|
|
|
}
|
68
|
|
|
|
|
|
|
}
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub incr {
|
71
|
1
|
|
|
1
|
1
|
5
|
${ $_[0] }++;
|
|
1
|
|
|
|
|
4
|
|
72
|
|
|
|
|
|
|
}
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub decr {
|
75
|
1
|
|
|
1
|
1
|
2
|
${ $_[0] }--;
|
|
1
|
|
|
|
|
3
|
|
76
|
|
|
|
|
|
|
}
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1;
|
79
|
|
|
|
|
|
|
__END__
|