Construction/Role/PointSet.pm

filter: Statementstmt 100% 24 / 24 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 92.1% 35 / 38 CC 5 SCAR 7.8
CC
5
Cov
96%
has_point
4.0
register_point
2.0
BEGIN
1.0
CRAP 2.2
« Construction/Line.pm ↑ Summary Construction/Derivate.pm »
1 package Math::Geometry::Construction::Role::PointSet;
2 13 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 13 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 13 ▶use Math::Geometry::Construction::Types qw(HashRefOfPoint Extension);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 13 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 C<Math::Geometry::Construction::Role::PointSet> - point set objects
12  
13 =head1 VERSION
14  
15 Version 0.020
16  
17 =cut
18  
19 13 our $VERSION = '0.020';
20  
21  
22 ###########################################################################
23 # #
24 # Accessors #
25 # #
26 ###########################################################################
27  
28 has 'points' => (isa => HashRefOfPoint,
29 is => 'bare',
30 traits => ['Hash'],
31 115 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
32 13 handles => {points => 'values',
33 _pointset_point => 'accessor'});
34  
35 has 'extend' => (isa => Extension,
36 coerce => 1,
37 is => 'rw',
38 113 ▶ default => sub { [0, 0] });
Subroutine __ANON__: called CC=1 SCAR=0.0
39  
40 259 ▶sub register_point {
Subroutine register_point: called CC=2 SCAR=6.9
Pod undocumented
41 259 my ($self, @args) = @_;
42  
43 259 foreach(@args) { $self->_pointset_point($_->id, $_) }
44 }
45  
46 95 ▶sub has_point {
Subroutine has_point: called CC=4 SCAR=13.9
Pod undocumented
47 95 my ($self, @args) = @_;
48  
49 95 foreach(@args) {
50 139 ▶ return 0 if(!$self->_pointset_point(blessed($_) ? $_->id : $_));
Branch: 2 branches
BranchTrueFalseTotal
unless $self->_pointset_point(builtin::blessed($_) ? $_->id : $_) 56 83 139
builtin::blessed($_) ? : 139 0 139
51 }
52 39 return 1;
53 }
54  
55 13 1;
56  
57  
58 __END__
« Construction/Line.pm ↑ Summary Construction/Derivate.pm »