line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::PORE::Node::Queue;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use Text::PORE::Node;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
528
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
@Text::PORE::Node::Queue::ISA = qw(Text::PORE::Node);
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new {
|
9
|
26
|
|
|
26
|
0
|
45
|
my ($type) = shift;
|
10
|
26
|
|
|
|
|
145
|
my ($lineno) = shift;
|
11
|
|
|
|
|
|
|
|
12
|
26
|
|
|
|
|
48
|
my (@nodes) = @_;
|
13
|
26
|
|
|
|
|
40
|
my ($self) = { };
|
14
|
|
|
|
|
|
|
|
15
|
26
|
|
33
|
|
|
135
|
bless $self, ref($type) || $type;
|
16
|
|
|
|
|
|
|
|
17
|
26
|
|
|
|
|
162
|
$self = $self->SUPER::new($lineno);
|
18
|
|
|
|
|
|
|
|
19
|
26
|
|
|
|
|
79
|
$self->enqueue(@nodes);
|
20
|
26
|
|
|
|
|
63
|
$self->reset();
|
21
|
|
|
|
|
|
|
|
22
|
26
|
|
|
|
|
152
|
$self;
|
23
|
|
|
|
|
|
|
}
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub enqueue {
|
26
|
132
|
|
|
132
|
0
|
7565
|
my $self = shift;
|
27
|
|
|
|
|
|
|
|
28
|
132
|
|
|
|
|
256
|
my @nodes = @_;
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# TODO - should check grep($_->isa(Node), @nodes);
|
31
|
132
|
|
|
|
|
150
|
push(@{$self->{'nodes'}}, @nodes);
|
|
132
|
|
|
|
|
490
|
|
32
|
|
|
|
|
|
|
}
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub dequeue {
|
35
|
0
|
|
|
0
|
0
|
0
|
my $self = shift;
|
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
$self->reset();
|
38
|
0
|
|
|
|
|
0
|
shift(@{$self->{'nodes'}});
|
|
0
|
|
|
|
|
0
|
|
39
|
|
|
|
|
|
|
}
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub next {
|
42
|
180
|
|
|
180
|
0
|
218
|
my $self = shift;
|
43
|
|
|
|
|
|
|
|
44
|
180
|
|
|
|
|
310
|
my $pos = \$self->{'pos'};
|
45
|
180
|
|
|
|
|
237
|
my $nodes = $self->{'nodes'};
|
46
|
|
|
|
|
|
|
|
47
|
180
|
50
|
|
|
|
669
|
($$pos > @$nodes) ? ($self->reset()) : $$nodes[$$pos++] ;
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub reset {
|
51
|
58
|
|
|
58
|
0
|
73
|
my $self = shift;
|
52
|
|
|
|
|
|
|
|
53
|
58
|
|
|
|
|
114
|
$self->{'pos'} = 0;
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub length {
|
57
|
0
|
|
|
0
|
0
|
0
|
my $self = shift;
|
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
0
|
scalar(@{$self->{'nodes'}});
|
|
0
|
|
|
|
|
0
|
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub traverse {
|
63
|
32
|
|
|
32
|
0
|
42
|
my $self = shift;
|
64
|
32
|
|
|
|
|
36
|
my $globals = shift;
|
65
|
|
|
|
|
|
|
|
66
|
32
|
|
|
|
|
36
|
my $obj;
|
67
|
|
|
|
|
|
|
my $return;
|
68
|
|
|
|
|
|
|
|
69
|
32
|
|
|
|
|
63
|
$self->reset();
|
70
|
|
|
|
|
|
|
|
71
|
32
|
50
|
|
|
|
84
|
$self->output("[Queue:" . $self->{'lineno'} . "]") if $self->getDebug();
|
72
|
|
|
|
|
|
|
|
73
|
32
|
|
|
|
|
100
|
while ($obj = $self->next()) {
|
74
|
148
|
50
|
|
|
|
358
|
$self->output("[Queue item:" . $self->{'lineno'} . "]")
|
75
|
|
|
|
|
|
|
if $self->getDebug();
|
76
|
148
|
|
|
|
|
396
|
$self->error($obj->traverse($globals));
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
32
|
|
|
|
|
89
|
return $self->errorDump();
|
80
|
|
|
|
|
|
|
}
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1;
|