line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
GenOO::RegionCollection::Factory::RegionArray - Factory for creating a RegionCollection from array of regions |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Creates GenOO::RegionCollection from a array of L<Region> objects |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Preferably use it through the generic GenOO::RegionCollection::Factory |
12
|
|
|
|
|
|
|
my $factory = GenOO::RegionCollection::Factory->new('RegionArray', |
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
array => \@array_with_regions |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
An instance of this class is a concrete factory for the creation of a |
21
|
|
|
|
|
|
|
L<GenOO::RegionCollection> from an array of L<Region> objects. It offers the method |
22
|
|
|
|
|
|
|
"read_collection" (as the consumed role requires) which returns the actual |
23
|
|
|
|
|
|
|
L<GenOO::RegionCollection> object in the form of |
24
|
|
|
|
|
|
|
L<GenOO::RegionCollection::Type::DoubleHashArray>. The latter is the implementation |
25
|
|
|
|
|
|
|
of the L<GenOO::RegionCollection> class based on the complex data structure |
26
|
|
|
|
|
|
|
L<GenOO::Data::Structure::DoubleHashArray>. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 EXAMPLES |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Create a concrete factory |
31
|
|
|
|
|
|
|
my $factory_implementation = GenOO::RegionCollection::Factory->new('RegionArray', |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
array => \@array_with_regions |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Return the actual GenOO::RegionCollection object |
38
|
|
|
|
|
|
|
my $collection = $factory_implementation->read_collection; |
39
|
|
|
|
|
|
|
print ref($collection) # GenOO::RegionCollection::Type::DoubleHashArray |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Let the code begin... |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
package GenOO::RegionCollection::Factory::RegionArray; |
46
|
|
|
|
|
|
|
$GenOO::RegionCollection::Factory::RegionArray::VERSION = '1.5.2'; |
47
|
1
|
|
|
1
|
|
4325
|
use Moose; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
27
|
|
48
|
1
|
|
|
1
|
|
10632
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
1
|
|
222
|
use GenOO::RegionCollection::Type::DoubleHashArray; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
180
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has 'array' => (is => 'ArrayRef', is => 'ro'); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
with 'GenOO::RegionCollection::Factory::Requires'; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
####################################################################### |
57
|
|
|
|
|
|
|
######################## Interface Methods ######################## |
58
|
|
|
|
|
|
|
####################################################################### |
59
|
|
|
|
|
|
|
sub read_collection { |
60
|
16
|
|
|
16
|
0
|
158864
|
my ($self) = @_; |
61
|
|
|
|
|
|
|
|
62
|
16
|
|
|
|
|
1181
|
my $collection = GenOO::RegionCollection::Type::DoubleHashArray->new; |
63
|
|
|
|
|
|
|
|
64
|
16
|
|
|
|
|
123
|
foreach my $record ( @{$self->array} ) { |
|
16
|
|
|
|
|
801
|
|
65
|
786
|
|
|
|
|
2305
|
$collection->add_record($record); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
16
|
|
|
|
|
405
|
return $collection; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |