File Coverage

blib/lib/AI/Categorizer/ObjectSet.pm
Criterion Covered Total %
statement 16 17 94.1
branch 2 2 100.0
condition n/a
subroutine 7 8 87.5
pod 0 7 0.0
total 25 34 73.5


line stmt bran cond sub pod time code
1             package AI::Categorizer::ObjectSet;
2 11     11   47 use strict;
  11         20  
  11         2217  
3              
4             sub new {
5 132     132 0 225 my $pkg = shift;
6 132         344 my $self = bless {}, $pkg;
7 132 100       488 $self->insert(@_) if @_;
8 132         420 return $self;
9             }
10              
11             sub members {
12 198     198 0 284 return values %{$_[0]};
  198         824  
13             }
14              
15             sub size {
16 9     9 0 14 return scalar keys %{$_[0]};
  9         50  
17             }
18              
19             sub insert {
20 187     187 0 216 my $self = shift;
21 187         294 foreach my $element (@_) {
22             #warn "types are ", @_;
23 188         511 $self->{ $element->name } = $element;
24             }
25             }
26              
27 7     7 0 31 sub retrieve { $_[0]->{$_[1]} }
28              
29 16     16 0 44 sub includes { exists $_[0]->{ $_[1]->name } }
30 0     0 0   sub includes_name { exists $_[0]->{ $_[1] } }
31              
32             1;