| 1 | package GraphViz::Diagram::ClassDiagram::ClassElement; | ||||||||||||||||||||||||||||
| 2 | #_{ use | ||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use GraphViz::Diagram::ClassDiagram; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | #_} | ||||||||||||||||||||||||||||
| 10 | 1 | our $VERSION = $GraphViz::Diagram::ClassDiagram::VERSION; | |||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub new { #_{ | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | my $class_parent = shift; # Either a GraphViz::Diagram::ClassDiagram::Attribute or a GraphViz::Diagram::ClassDiagram::Method | |||||||||||||||||||||||||||
| 14 | # my $self = shift; | ||||||||||||||||||||||||||||
| 15 | 0 | my $class = shift; # The GraphViz::Diagram::ClassDiagram::Class object in which this ClassElement is being defined | |||||||||||||||||||||||||||
| 16 | 0 | my $ident = shift; | |||||||||||||||||||||||||||
| 17 | 0 | ▶ | my $opts = shift // {}; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() // {}
MC/DC0%0/1
shift() // {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | croak "ClassElement - new: passed \$class_parent (= $class_parent) is neither an *::Attribute nor a *::Method" unless | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$class_parent eq "GraphViz::Diagram::ClassDiagram::Attribute" or $class_parent eq "GraphViz::Diagram::ClassDiagram::Method"
MC/DC0%0/2
$class_parent eq "GraphViz::Diagram::ClassDiagram::Attribute" or $class_parent eq "GraphViz::Diagram::ClassDiagram::Method"
$class_parent eq "GraphViz::Diagram::ClassDiagram::Attribute"
$class_parent eq "GraphViz::Diagram::ClassDiagram::Method"
Truth table0%0/3
A or B
A= $class_parent eq "GraphViz::Diagram::ClassDiagram::Attribute"B= $class_parent eq "GraphViz::Diagram::ClassDiagram::Method"
| |||||||||||||||||||||||||||||
| 20 | $class_parent eq 'GraphViz::Diagram::ClassDiagram::Attribute' or | ||||||||||||||||||||||||||||
| 21 | $class_parent eq 'GraphViz::Diagram::ClassDiagram::Method'; | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | croak "ClassElement -new passed attribute \$class (=$class) is not a GraphViz::Diagram::ClassDiagram::Class" unless ref $class eq 'GraphViz::Diagram::ClassDiagram::Class'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | my $self = {}; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | $self->{class} = $class; | |||||||||||||||||||||||||||
| 28 | 0 | $self->{ident} = $ident; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | $self->{comment} = delete $opts->{comment} if exists $opts->{comment}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | $self->{type} = delete $opts->{type} if exists $opts->{type}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | bless $self, $class_parent; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | return $self; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | } #_} | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub tr { #_{ | ||||||||||||||||||||||||||
|
Subroutine
tr: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 40 | 0 | my $first_row = shift; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | my $draw_border_above = 0; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if (! $first_row) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | $draw_border_above = 1; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | my $border_etc=''; | |||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ($draw_border_above) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | $border_etc = " sides='t'"; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | else { | ||||||||||||||||||||||||||||
| 53 | 0 | $border_etc = " border='0'"; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | my $color_ident = $self->ident_color(); | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | my $td_type = "<td align='left'$border_etc>"; | |||||||||||||||||||||||||||
| 59 | 0 | ▶ | $td_type .= $self->{type} if (exists $self->{type}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | $td_type .= "</td>"; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | my $td_ident = "<td align='left'$border_etc port='$self->{ident}'><font color='$color_ident'>$self->{ident}</font></td>"; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | my $tr = "<tr>$td_type$td_ident</tr>"; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | my $colspan_max = GraphViz::Diagram::ClassDiagram::Class::colspan_(); | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ($self->{comment}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 0 | my $color_comment = GraphViz::Diagram::ClassDiagram::color_comment(); | |||||||||||||||||||||||||||
| 69 | 0 | $tr .= "<tr><td border='0' $colspan_max align='left'><font color='$color_comment'>$self->{comment}</font></td></tr>"; | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | return $tr; | |||||||||||||||||||||||||||
| 73 | } #_} | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub connector_for_links {#_{ | ||||||||||||||||||||||||||
|
Subroutine
connector_for_links: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 75 | =head2 connector_for_links | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | Returns a string that can be used in L<GraphViz::Graph> -> C<edge()>. | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | Must currently (as of version 0.01) be called after C<connector_for_links> was called! | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | Should not be called by a user, it is called by L<GraphViz::Diagram::ClassDiagram> C<< -> create() >> instead | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =cut | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | croak "ClassElement - connector_for_links: self->{class} is not set - is Class->add_class_as_node_to_graph already run?" unless $self->{class}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | croak "ClassElement - connector_for_links: $self->{class} is not a GraphViz::Diagram::ClassDiagram::Class" unless ref $self->{class} eq 'GraphViz::Diagram::ClassDiagram::Class'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | # return $self->{class}->{class_node}->port($self->{ident}); | ||||||||||||||||||||||||||||
| 91 | 0 | return $self->{class} ->port($self->{ident}); | |||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | } #_} | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 1 | 'tq84'; | |||||||||||||||||||||||||||