line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Lyskom::TextMapping; |
2
|
1
|
|
|
1
|
|
5
|
use base qw{Net::Lyskom::Object}; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
78
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Net::Lyskom::Util qw{:all}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
637
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::Lyskom::TextMapping - represents a text_mapping |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$global_no = $obj->global(4711); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
@globals = $obj->global_text_numbers; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
@locals = $obj->local_text_numbers; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Holds information on mappings between local and global text numbers for |
23
|
|
|
|
|
|
|
a conference. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 Methods |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=over |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=item ->range_begin() |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Returns the first local text number that this mapping has information on. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item ->range_end() |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Returns the first local text number that this mapping does B hold |
36
|
|
|
|
|
|
|
information on. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item ->later_texts_exist() |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Returns true if the conference has local numbers beyond those detailed |
41
|
|
|
|
|
|
|
in this mapping. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item ->global($no) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Takes a local text number and returns the corresponding global text number, |
46
|
|
|
|
|
|
|
or undef if the local number is nonexistant (or just not included in this |
47
|
|
|
|
|
|
|
mapping). |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item ->local_text_numbers() |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Returns a list of all local text numbers in this mapping, in strictly |
52
|
|
|
|
|
|
|
ascending order. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item ->global_text_numbers() |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns a list of all global text numbers in this mapping, in ascending |
57
|
|
|
|
|
|
|
B number order. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=back |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
0
|
1
|
0
|
sub range_begin {my $s = shift; return $s->{range_begin}}; |
|
0
|
|
|
|
|
0
|
|
64
|
0
|
|
|
0
|
1
|
0
|
sub range_end {my $s = shift; return $s->{range_end}}; |
|
0
|
|
|
|
|
0
|
|
65
|
0
|
|
|
0
|
1
|
0
|
sub later_texts_exist {my $s = shift; return $s->{later_texts_exist}}; |
|
0
|
|
|
|
|
0
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub global { |
68
|
1
|
|
|
1
|
1
|
3
|
my $s = shift; |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
10
|
return $s->{_l2ghash}{$_[0]}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub local_text_numbers { |
74
|
0
|
|
|
0
|
1
|
0
|
my $s = shift; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
0
|
return sort {$a <=> $b} keys %{$s->{_l2ghash}}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub global_text_numbers { |
80
|
0
|
|
|
0
|
1
|
0
|
my $s = shift; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
0
|
return map {$s->{_l2ghash}{$_}} sort {$a <=> $b} keys %{$s->{_l2ghash}}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub new_from_stream { |
87
|
1
|
|
|
1
|
0
|
4
|
my $s = {}; |
88
|
1
|
|
|
|
|
3
|
my $class = shift; |
89
|
1
|
|
|
|
|
2
|
my $ref = shift; |
90
|
1
|
|
|
|
|
2
|
my @pairs; |
91
|
|
|
|
|
|
|
|
92
|
1
|
50
|
|
|
|
5
|
$class = ref($class) if ref($class); |
93
|
1
|
|
|
|
|
3
|
bless $s,$class; |
94
|
|
|
|
|
|
|
|
95
|
1
|
|
|
|
|
3
|
$s->{range_begin} = shift @{$ref}; |
|
1
|
|
|
|
|
37
|
|
96
|
1
|
|
|
|
|
3
|
$s->{range_end} = shift @{$ref}; |
|
1
|
|
|
|
|
3
|
|
97
|
1
|
|
|
|
|
2
|
$s->{later_texts_exist} = shift @{$ref}; |
|
1
|
|
|
|
|
3
|
|
98
|
|
|
|
|
|
|
|
99
|
1
|
50
|
|
|
|
2
|
if (shift @{$ref}) { |
|
1
|
|
|
|
|
4
|
|
100
|
|
|
|
|
|
|
# true, so it's a TextList |
101
|
1
|
|
|
|
|
2
|
my $local_no = shift @{$ref}; |
|
1
|
|
|
|
|
3
|
|
102
|
1
|
|
|
1
|
|
13
|
my @texts = parse_array_stream(sub{shift @{$_[0]}},$ref); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
103
|
1
|
|
|
|
|
5
|
foreach (@texts) { |
104
|
1
|
50
|
|
|
|
6
|
push @pairs,[$local_no,$_] if $_; |
105
|
1
|
|
|
|
|
4
|
$local_no++; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
} else { |
108
|
|
|
|
|
|
|
# false, so it's an ARRAY of TextNumberPair |
109
|
0
|
|
|
0
|
|
0
|
@pairs = parse_array_stream(sub{[shift @{$_[0]},shift @{$_[0]}]},$ref); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
1
|
|
|
|
|
3
|
foreach (@pairs) { |
113
|
1
|
|
|
|
|
65
|
$s->{_l2ghash}{$_->[0]} = $_->[1] |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
1
|
|
|
|
|
12
|
return $s; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |