| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: Common Methods for Operating on Integers |
|
2
|
|
|
|
|
|
|
package Bubblegum::Object::Integer; |
|
3
|
|
|
|
|
|
|
|
|
4
|
36
|
|
|
36
|
|
19153
|
use 5.10.0; |
|
|
36
|
|
|
|
|
108
|
|
|
|
36
|
|
|
|
|
1503
|
|
|
5
|
36
|
|
|
36
|
|
163
|
use namespace::autoclean; |
|
|
36
|
|
|
|
|
60
|
|
|
|
36
|
|
|
|
|
237
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
36
|
|
|
36
|
|
2330
|
use Bubblegum::Class 'with'; |
|
|
36
|
|
|
|
|
61
|
|
|
|
36
|
|
|
|
|
187
|
|
|
8
|
36
|
|
|
36
|
|
25823
|
use Bubblegum::Constraints -isas, -types; |
|
|
36
|
|
|
|
|
93
|
|
|
|
36
|
|
|
|
|
430
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Bubblegum::Object::Role::Defined'; |
|
11
|
|
|
|
|
|
|
with 'Bubblegum::Object::Role::Comparison'; |
|
12
|
|
|
|
|
|
|
with 'Bubblegum::Object::Role::Value'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @ISA = (); # non-object |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.45'; # VERSION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub downto { |
|
19
|
1
|
|
|
1
|
1
|
2290
|
my $self = CORE::shift; |
|
20
|
1
|
|
|
|
|
6
|
my $other = type_number CORE::shift; |
|
21
|
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
411
|
return [CORE::reverse $other..$self]; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub eq { |
|
26
|
3
|
|
|
3
|
1
|
2660
|
my $self = CORE::shift; |
|
27
|
3
|
|
|
|
|
9
|
my $other = type_number CORE::shift; |
|
28
|
|
|
|
|
|
|
|
|
29
|
3
|
100
|
|
|
|
103
|
return $self == $other ? 1 : 0; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub eqtv { |
|
33
|
2
|
|
|
2
|
1
|
2448
|
my $self = CORE::shift; |
|
34
|
2
|
|
|
|
|
4
|
my $other = CORE::shift; |
|
35
|
|
|
|
|
|
|
|
|
36
|
2
|
50
|
|
|
|
5
|
return 0 if !CORE::defined $other; |
|
37
|
2
|
100
|
66
|
|
|
13
|
return ($self->type eq $other->type && $self == $other) ? 1 : 0; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub format { |
|
41
|
1
|
|
|
1
|
1
|
2473
|
my $self = CORE::shift; |
|
42
|
1
|
|
|
|
|
4
|
my $format = type_string CORE::shift; |
|
43
|
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
323
|
return CORE::sprintf $format, $self; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub gt { |
|
48
|
2
|
|
|
2
|
1
|
2429
|
my $self = CORE::shift; |
|
49
|
2
|
|
|
|
|
7
|
my $other = type_number CORE::shift; |
|
50
|
|
|
|
|
|
|
|
|
51
|
2
|
100
|
|
|
|
69
|
return $self > $other ? 1 : 0; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub gte { |
|
55
|
3
|
|
|
3
|
1
|
2461
|
my $self = CORE::shift; |
|
56
|
3
|
|
|
|
|
10
|
my $other = type_number CORE::shift; |
|
57
|
|
|
|
|
|
|
|
|
58
|
3
|
100
|
|
|
|
101
|
return $self >= $other ? 1 : 0; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub lt { |
|
62
|
2
|
|
|
2
|
1
|
2472
|
my $self = CORE::shift; |
|
63
|
2
|
|
|
|
|
8
|
my $other = type_number CORE::shift; |
|
64
|
|
|
|
|
|
|
|
|
65
|
2
|
100
|
|
|
|
69
|
return $self < $other ? 1 : 0; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub lte { |
|
69
|
3
|
|
|
3
|
1
|
2452
|
my $self = CORE::shift; |
|
70
|
3
|
|
|
|
|
11
|
my $other = type_number CORE::shift; |
|
71
|
|
|
|
|
|
|
|
|
72
|
3
|
100
|
|
|
|
100
|
return $self <= $other ? 1 : 0; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub ne { |
|
76
|
2
|
|
|
2
|
1
|
2471
|
my $self = CORE::shift; |
|
77
|
2
|
|
|
|
|
7
|
my $other = type_number CORE::shift; |
|
78
|
|
|
|
|
|
|
|
|
79
|
2
|
100
|
|
|
|
71
|
return $self != $other ? 1 : 0; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub to { |
|
83
|
2
|
|
|
2
|
1
|
2496
|
my $self = CORE::shift; |
|
84
|
2
|
|
|
|
|
7
|
my $range = type_number CORE::shift; |
|
85
|
|
|
|
|
|
|
|
|
86
|
2
|
100
|
|
|
|
73
|
return [$self..$range] if $self <= $range; |
|
87
|
1
|
|
|
|
|
7
|
return [CORE::reverse($range..$self)]; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub upto { |
|
91
|
1
|
|
|
1
|
1
|
2747
|
my $self = CORE::shift; |
|
92
|
1
|
|
|
|
|
4
|
my $other = type_number CORE::shift; |
|
93
|
|
|
|
|
|
|
|
|
94
|
1
|
|
|
|
|
39
|
return [$self..$other]; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |