line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::Array::Boolean; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '0.0.1'; |
4
|
|
|
|
|
|
|
@ISA = ( 'Tie::Array' ); |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
40548
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
136
|
|
7
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
51
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1627
|
use Tie::Array; |
|
2
|
|
|
|
|
2507
|
|
|
2
|
|
|
|
|
753
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub TIEARRAY { |
12
|
1
|
|
|
1
|
|
14
|
my $class = shift; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
5
|
my $self = { |
15
|
|
|
|
|
|
|
bits => '', |
16
|
|
|
|
|
|
|
size => 0, |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
6
|
return bless $self, $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub STORE { |
23
|
126
|
|
|
126
|
|
1665
|
my $self = shift; |
24
|
126
|
|
|
|
|
127
|
my $index = shift; |
25
|
126
|
|
|
|
|
151
|
my $value = !! shift; |
26
|
|
|
|
|
|
|
|
27
|
126
|
100
|
|
|
|
236
|
$self->STORESIZE( 1+$index ) if 1+$index > $self->FETCHSIZE(); |
28
|
|
|
|
|
|
|
|
29
|
126
|
|
|
|
|
341
|
vec( $self->{bits}, $index, 1 ) = $value; |
30
|
|
|
|
|
|
|
|
31
|
126
|
|
|
|
|
373
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub FETCH { |
35
|
216
|
|
|
216
|
|
1396
|
my $self = shift; |
36
|
216
|
|
|
|
|
239
|
my $index = shift; |
37
|
|
|
|
|
|
|
|
38
|
216
|
100
|
|
|
|
392
|
return undef if 1+$index > $self->FETCHSIZE(); |
39
|
215
|
|
|
|
|
851
|
return vec( $self->{bits}, $index, 1 ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub FETCHSIZE { |
43
|
527
|
|
|
527
|
|
19673
|
my $self = shift; |
44
|
|
|
|
|
|
|
|
45
|
527
|
|
|
|
|
2053
|
return $self->{size}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub STORESIZE { |
49
|
60
|
|
|
60
|
|
857
|
my $self = shift; |
50
|
60
|
|
|
|
|
69
|
my $size = shift; |
51
|
|
|
|
|
|
|
|
52
|
60
|
100
|
|
|
|
149
|
if ( $size < $self->{size} ) { |
53
|
27
|
|
|
|
|
74
|
substr( $self->{bits}, int( $size / 8 ) + 1 ) = ''; |
54
|
27
|
|
|
|
|
336
|
vec( $self->{bits}, $_, 1 ) = 0 for $size .. $size + 8; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
60
|
|
|
|
|
90
|
$self->{size} = $size; |
58
|
|
|
|
|
|
|
|
59
|
60
|
|
|
|
|
130
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub DELETE { |
63
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
64
|
3
|
|
|
|
|
5
|
my $index = shift; |
65
|
|
|
|
|
|
|
|
66
|
3
|
100
|
|
|
|
7
|
if ( $index == $self->FETCHSIZE() - 1 ) { |
67
|
2
|
|
|
|
|
5
|
$self->STORESIZE( $index ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
else { |
70
|
1
|
|
|
|
|
5
|
$self->STORE( $index, 0 ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
3
|
|
|
|
|
8
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub EXISTS { |
77
|
1
|
|
|
1
|
|
4
|
my $self = shift; |
78
|
1
|
|
|
|
|
23
|
my $index = shift; |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
5
|
return $index < $self->FETCHSIZE(); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub get_truth_count { |
84
|
12
|
|
|
12
|
1
|
18
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
12
|
|
|
|
|
95
|
return unpack '%32b*', $self->{bits}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
90
|
|
|
|
|
|
|
__END__ |