| 1 | package SVG::Graph::Data::Node; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use base qw(Tree::DAG_Node); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | =head2 new | ||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | Title : new | ||||||||||||||||||||||||||||||||
| 9 | Usage : | ||||||||||||||||||||||||||||||||
| 10 | Function: | ||||||||||||||||||||||||||||||||
| 11 | Example : | ||||||||||||||||||||||||||||||||
| 12 | Returns : | ||||||||||||||||||||||||||||||||
| 13 | Args : | ||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | =cut | ||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | 22 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 19 | 22 | my($class, %args) = @_; | |||||||||||||||||||||||||||||||
| 20 | 22 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||
| 21 | 22 | $self->init(%args); | |||||||||||||||||||||||||||||||
| 22 | 22 | return $self; | |||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | =head2 init | ||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | Title : init | ||||||||||||||||||||||||||||||||
| 28 | Usage : | ||||||||||||||||||||||||||||||||
| 29 | Function: | ||||||||||||||||||||||||||||||||
| 30 | Example : | ||||||||||||||||||||||||||||||||
| 31 | Returns : | ||||||||||||||||||||||||||||||||
| 32 | Args : | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||
| 35 | =cut | ||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | 22 | ▶ | sub init { | ||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 38 | 22 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | 22 | $self->SUPER::_init; | |||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | 22 | foreach my $arg (keys %args) { | |||||||||||||||||||||||||||||||
| 43 | 63 | my $meth = $arg; | |||||||||||||||||||||||||||||||
| 44 | 63 | ▶ | if($self->can($meth)){ | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 45 | 21 | $self->$meth($args{$arg}); | |||||||||||||||||||||||||||||||
| 46 | } else { | ||||||||||||||||||||||||||||||||
| 47 | 42 | $self->_style($arg => $args{$arg}); | |||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | =head2 depth | ||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | Title : depth | ||||||||||||||||||||||||||||||||
| 56 | Usage : | ||||||||||||||||||||||||||||||||
| 57 | Function: | ||||||||||||||||||||||||||||||||
| 58 | Example : | ||||||||||||||||||||||||||||||||
| 59 | Returns : | ||||||||||||||||||||||||||||||||
| 60 | Args : | ||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | =cut | ||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | 22 | ▶ | sub depth{ | ||||||||||||||||||||||||||||||
|
Subroutine
depth: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 66 | 22 | my ($self,@args) = @_; | |||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | 22 | my $depth = $self->branch_length; | |||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 22 | my $maxdepth = 0; | |||||||||||||||||||||||||||||||
| 71 | 22 | foreach my $daughter ($self->daughters){ | |||||||||||||||||||||||||||||||
| 72 | 21 | my $ddepth = $daughter->depth; | |||||||||||||||||||||||||||||||
| 73 | 21 | ▶ | $maxdepth = $ddepth > $maxdepth ? $ddepth : $maxdepth; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | 22 | return $depth + $maxdepth; | |||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||
| 79 | =head2 branch_length | ||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | Title : branch_length | ||||||||||||||||||||||||||||||||
| 82 | Usage : $obj->branch_length($newval) | ||||||||||||||||||||||||||||||||
| 83 | Function: | ||||||||||||||||||||||||||||||||
| 84 | Example : | ||||||||||||||||||||||||||||||||
| 85 | Returns : value of branch_length (a scalar) | ||||||||||||||||||||||||||||||||
| 86 | Args : on set, new value (a scalar or undef, optional) | ||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | =cut | ||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||
| 91 | 107 | ▶ | sub branch_length{ | ||||||||||||||||||||||||||||||
|
Subroutine
branch_length: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 92 | 107 | my $self = shift; | |||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | 107 | ▶ | return $self->{'branch_length'} = shift if @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 95 | 85 | ▶ | return $self->{'branch_length'} || 1; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'branch_length'} || 1
MC/DC0%0/1
$self->{'branch_length'} || 1
$self->{'branch_length'}
Truth table50%1/2
A
A= $self->{'branch_length'}
| |||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||
| 98 | =head2 branch_type | ||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||
| 100 | Title : branch_type | ||||||||||||||||||||||||||||||||
| 101 | Usage : $obj->branch_type($newval) | ||||||||||||||||||||||||||||||||
| 102 | Function: | ||||||||||||||||||||||||||||||||
| 103 | Example : | ||||||||||||||||||||||||||||||||
| 104 | Returns : value of branch_type (a scalar) | ||||||||||||||||||||||||||||||||
| 105 | Args : on set, new value (a scalar or undef, optional) | ||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | =cut | ||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | sub branch_type{ | ||||||||||||||||||||||||||||||
|
Subroutine
branch_type: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 111 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | return $self->{'branch_type'} = shift if @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 114 | 0 | return $self->{'branch_type'}; | |||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||
| 117 | =head2 branch_label | ||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||
| 119 | Title : branch_label | ||||||||||||||||||||||||||||||||
| 120 | Usage : $obj->branch_label($newval) | ||||||||||||||||||||||||||||||||
| 121 | Function: | ||||||||||||||||||||||||||||||||
| 122 | Example : | ||||||||||||||||||||||||||||||||
| 123 | Returns : value of branch_label (a scalar) | ||||||||||||||||||||||||||||||||
| 124 | Args : on set, new value (a scalar or undef, optional) | ||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||
| 127 | =cut | ||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||
| 129 | 21 | ▶ | sub branch_label{ | ||||||||||||||||||||||||||||||
|
Subroutine
branch_label: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 130 | 21 | my $self = shift; | |||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||
| 132 | 21 | ▶ | return $self->{'branch_label'} = shift if @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 133 | 21 | return $self->{'branch_label'}; | |||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||
| 136 | =head2 _style | ||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||
| 138 | Title : _style | ||||||||||||||||||||||||||||||||
| 139 | Usage : $obj->_style($newval) | ||||||||||||||||||||||||||||||||
| 140 | Function: | ||||||||||||||||||||||||||||||||
| 141 | Example : | ||||||||||||||||||||||||||||||||
| 142 | Returns : | ||||||||||||||||||||||||||||||||
| 143 | Args : | ||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||
| 146 | =cut | ||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||
| 148 | 82 | ▶ | sub _style{ | ||||||||||||||||||||||||||||||
|
Subroutine
_style: called CC=6 SCAR=18.4
| |||||||||||||||||||||||||||||||||
| 149 | 82 | my $self = shift; | |||||||||||||||||||||||||||||||
| 150 | 82 | my($key,$val) = @_; | |||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||
| 152 | 82 | ▶ | if(defined($key) and not defined($val)){ | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $key and not defined $val
MC/DC0%0/2
defined $key and not defined $val
defined $key
not defined $val
Truth table66%2/3
A and not(B)
A= defined $keyB= not defined $val
| |||||||||||||||||||||||||||||||||
| 153 | 0 | return $self->{'_style'}{$key}; | |||||||||||||||||||||||||||||||
| 154 | ▶ | } elsif(defined($key) and defined($val)){ | |||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $key and defined $val
MC/DC50%1/2
defined $key and defined $val
defined $key
defined $val
Truth table66%2/3
A and B
A= defined $keyB= defined $val
| |||||||||||||||||||||||||||||||||
| 155 | 42 | $self->{'_style'}{$key} = $val; | |||||||||||||||||||||||||||||||
| 156 | 42 | return $val; | |||||||||||||||||||||||||||||||
| 157 | } else { | ||||||||||||||||||||||||||||||||
| 158 | 40 | ▶ | return $self->{'_style'} ? %{$self->{'_style'}} : (); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||
| 162 | 1 | 1; | |||||||||||||||||||||||||||||||