line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ruby::Collections::OrderedHash; |
2
|
3
|
|
|
3
|
|
16
|
use Tie::Hash; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
127
|
|
3
|
|
|
|
|
|
|
our @ISA = 'Tie::StdHash'; |
4
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
97
|
|
5
|
3
|
|
|
3
|
|
35
|
use v5.10; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
160
|
|
6
|
3
|
|
|
3
|
|
16
|
use FindBin; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
180
|
|
7
|
3
|
|
|
3
|
|
15
|
use lib "$FindBin::Bin/../../../lib"; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
25
|
|
8
|
3
|
|
|
3
|
|
472
|
use Ruby::Collections; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
2164
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %keys_table; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub TIEHASH { |
13
|
153
|
|
|
153
|
|
227
|
my $class = shift; |
14
|
|
|
|
|
|
|
|
15
|
153
|
|
|
|
|
194
|
my %hash; |
16
|
|
|
|
|
|
|
|
17
|
153
|
|
|
|
|
703
|
bless \%hash, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub STORE { |
21
|
341
|
|
|
341
|
|
648
|
my ( $self, $key, $val ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
341
|
100
|
|
|
|
862
|
if ( exists $self->{ p_obj($key) } ) { |
24
|
3
|
|
|
|
|
10
|
$self->{ p_obj($key) } = $val; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
338
|
100
|
|
|
|
904
|
if ( defined $keys_table{$self} ) { |
28
|
263
|
|
|
|
|
886
|
$keys_table{$self}->push( p_obj($key) ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
75
|
|
|
|
|
207
|
$keys_table{$self} = ra; |
32
|
75
|
|
|
|
|
433
|
$keys_table{$self}->push( p_obj($key) ); |
33
|
|
|
|
|
|
|
} |
34
|
338
|
|
|
|
|
1329
|
$self->{ p_obj($key) } = $val; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
341
|
|
|
|
|
2138
|
return $val; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub FETCH { |
41
|
308
|
|
|
308
|
|
555
|
my ( $self, $key ) = @_; |
42
|
|
|
|
|
|
|
|
43
|
308
|
|
|
|
|
964
|
return $self->{ p_obj($key) }; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub FIRSTKEY { |
47
|
132
|
|
|
132
|
|
206
|
my ($self) = @_; |
48
|
|
|
|
|
|
|
|
49
|
132
|
100
|
|
|
|
421
|
if ( defined $keys_table{$self} ) { |
50
|
128
|
|
|
|
|
605
|
return $keys_table{$self}->first; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
4
|
|
|
|
|
32
|
return undef; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub NEXTKEY { |
57
|
282
|
|
|
282
|
|
1115
|
my ( $self, $lastkey ) = @_; |
58
|
|
|
|
|
|
|
|
59
|
282
|
50
|
|
|
|
855
|
if ( defined $keys_table{$self} ) { |
60
|
282
|
|
|
|
|
1073
|
my $last_index = $keys_table{$self}->index($lastkey); |
61
|
282
|
|
|
|
|
1665
|
return $keys_table{$self}->at( $last_index + 1 ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
return undef; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub EXISTS { |
68
|
0
|
|
|
0
|
|
0
|
my ( $self, $key ) = @_; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
0
|
return defined $self->{ p_obj($key) }; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub DELETE { |
74
|
9
|
|
|
9
|
|
20
|
my ( $self, $key ) = @_; |
75
|
|
|
|
|
|
|
|
76
|
9
|
100
|
|
|
|
26
|
if ( exists $self->{$key} ) { |
77
|
8
|
|
|
|
|
43
|
$keys_table{$self}->delete($key); |
78
|
8
|
|
|
|
|
21
|
my $ret = $self->{$key}; |
79
|
8
|
|
|
|
|
33
|
$self->{$key} = undef; |
80
|
8
|
|
|
|
|
53
|
return $ret; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
6
|
return undef; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub CLEAR { |
87
|
158
|
|
|
158
|
|
997
|
my ($self) = @_; |
88
|
|
|
|
|
|
|
|
89
|
158
|
|
|
|
|
283
|
%$self = (); |
90
|
158
|
100
|
|
|
|
621
|
if ( defined $keys_table{$self} ) { |
91
|
77
|
|
|
|
|
338
|
$keys_table{$self}->clear; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
158
|
|
|
|
|
656
|
return $self; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
__END__; |