| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Algorithm::SpatialIndex::Strategy; | 
| 2 | 9 |  |  | 9 |  | 482 | use 5.008001; | 
|  | 9 |  |  |  |  | 30 |  | 
|  | 9 |  |  |  |  | 352 |  | 
| 3 | 9 |  |  | 9 |  | 50 | use strict; | 
|  | 9 |  |  |  |  | 16 |  | 
|  | 9 |  |  |  |  | 390 |  | 
| 4 | 9 |  |  | 9 |  | 44 | use warnings; | 
|  | 9 |  |  |  |  | 17 |  | 
|  | 9 |  |  |  |  | 223 |  | 
| 5 | 9 |  |  | 9 |  | 46 | use Carp qw(croak); | 
|  | 9 |  |  |  |  | 17 |  | 
|  | 9 |  |  |  |  | 427 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 9 |  |  | 9 |  | 5829 | use Algorithm::SpatialIndex::Storage; | 
|  | 9 |  |  |  |  | 19 |  | 
|  | 9 |  |  |  |  | 395 |  | 
| 8 | 9 |  |  | 9 |  | 86 | use Scalar::Util 'weaken'; | 
|  | 9 |  |  |  |  | 15 |  | 
|  | 9 |  |  |  |  | 873 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | use Class::XSAccessor { | 
| 11 | 9 |  |  |  |  | 54 | getters => [qw( | 
| 12 |  |  |  |  |  |  | index | 
| 13 |  |  |  |  |  |  | storage | 
| 14 |  |  |  |  |  |  | bucket_size | 
| 15 |  |  |  |  |  |  | )], | 
| 16 | 9 |  |  | 9 |  | 49 | }; | 
|  | 9 |  |  |  |  | 16 |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | sub new { | 
| 19 | 3 |  |  | 3 | 1 | 10 | my $class = shift; | 
| 20 | 3 |  |  |  |  | 25 | my %opt = @_; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 3 |  |  |  |  | 29 | my $self = bless { | 
| 23 |  |  |  |  |  |  | bucket_size => 100, | 
| 24 |  |  |  |  |  |  | %opt, | 
| 25 |  |  |  |  |  |  | } => $class; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 3 |  |  |  |  | 51 | weaken($self->{index}); | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 3 | 50 |  |  |  | 52 | $self->init() if $self->can('init'); | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 3 |  |  |  |  | 27 | return $self; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub _super_init_storage { | 
| 35 | 3 |  |  | 3 |  | 7 | my $self = shift; | 
| 36 | 3 | 50 |  |  |  | 28 | $self->init_storage if $self->can('init_storage'); | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub _set_storage { | 
| 40 | 3 |  |  | 3 |  | 7 | my $self = shift; | 
| 41 | 3 |  |  |  |  | 6 | my $storage = shift; | 
| 42 | 3 |  |  |  |  | 8 | $self->{storage} = $storage; | 
| 43 | 3 |  |  |  |  | 14 | Scalar::Util::weaken($self->{storage}); | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | sub no_of_subnodes { | 
| 47 | 0 |  |  | 0 | 1 |  | croak("no_of_subnodes needs to be implemented in a subclass"); | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | sub no_of_dimensions { | 
| 51 | 0 |  |  | 0 | 1 |  | croak("no_of_dimensions needs to be implemented in a subclass"); | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | sub coord_types { | 
| 55 | 0 |  |  | 0 | 1 |  | croak("coord_types needs to be implemented in a subclass"); | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | sub item_coord_types { | 
| 59 | 0 |  |  | 0 | 1 |  | croak("item_coord_types needs to be implemented in a subclass"); | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | sub insert { | 
| 63 | 0 |  |  | 0 | 1 |  | croak("insert needs to be implemented in a subclass"); | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | sub find_node_for { | 
| 67 | 0 |  |  | 0 | 1 |  | croak("find_node_for needs to be implemented in a subclass"); | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | sub find_nodes_for { | 
| 71 | 0 |  |  | 0 | 1 |  | croak("find_nodes_for needs to be implemented in a subclass"); | 
| 72 |  |  |  |  |  |  | } | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | sub filter_items_in_rect { | 
| 75 | 0 |  |  | 0 | 1 |  | croak("filter_items_in_rect needs to be implemented in a subclass"); | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | 1; | 
| 79 |  |  |  |  |  |  | __END__ |