line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
################################################################ |
2
|
|
|
|
|
|
|
# Autodia - Automatic Dia XML.(C)Copyright 2001-2009 A Trevena # |
3
|
|
|
|
|
|
|
# # |
4
|
|
|
|
|
|
|
# Autodia comes with ABSOLUTELY NO WARRANTY; see COPYING file # |
5
|
|
|
|
|
|
|
# This is free software, and you are welcome to redistribute # |
6
|
|
|
|
|
|
|
# it under certain conditions; see COPYING file for details # |
7
|
|
|
|
|
|
|
################################################################ |
8
|
|
|
|
|
|
|
package Autodia::Diagram::Component; |
9
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
7
|
use Carp qw(cluck); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use base qw(Autodia::Diagram::Object); |
|
1
|
|
|
|
|
18
|
|
|
1
|
|
|
|
|
921
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
##################### |
19
|
|
|
|
|
|
|
# Constructor Methods |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
24
|
0
|
|
|
|
|
|
my $name = shift; |
25
|
0
|
0
|
|
|
|
|
cluck "new method called with no name\n" unless ($name); |
26
|
0
|
|
|
|
|
|
my $DiagramComponent = {}; |
27
|
0
|
|
0
|
|
|
|
bless ($DiagramComponent, ref($class) || $class); |
28
|
0
|
|
|
|
|
|
$DiagramComponent->_initialise($name); |
29
|
0
|
|
|
|
|
|
return $DiagramComponent; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
33
|
|
|
|
|
|
|
# Access Methods |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub Dependancies |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
38
|
0
|
0
|
|
|
|
|
if (defined $self->{"dependancies"}) |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
|
|
|
my @dependancies = @{$self->{"dependancies"}}; |
|
0
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return @dependancies; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
else |
44
|
0
|
|
|
|
|
|
{ return -1; } # erk! this component has no dependancies |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub add_dependancy |
49
|
|
|
|
|
|
|
{ |
50
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
51
|
0
|
|
|
|
|
|
my $new_dependancy = shift; |
52
|
0
|
|
|
|
|
|
my @dependancies; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if (defined $self->{"dependancies"}) |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
|
@dependancies = @{$self->{"dependancies"}}; |
|
0
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
push(@dependancies, $new_dependancy); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
else |
60
|
0
|
|
|
|
|
|
{ $dependancies[0] = $new_dependancy; } |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$self->{"dependancies"} = \@dependancies; |
63
|
0
|
|
|
|
|
|
$new_dependancy->Parent($self->Id); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return scalar(@dependancies) ; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub Redundant |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
71
|
0
|
|
|
|
|
|
my $replacement = shift; |
72
|
0
|
0
|
|
|
|
|
if (defined $replacement) |
73
|
|
|
|
|
|
|
{ |
74
|
0
|
0
|
|
|
|
|
if ($self->{"_redundant"}) |
75
|
|
|
|
|
|
|
{ |
76
|
0
|
|
|
|
|
|
my $current_replacement = $self->{"_redundant"}; |
77
|
0
|
|
|
|
|
|
return -1; |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
$self->{"_redundant"} = $replacement; |
80
|
|
|
|
|
|
|
} |
81
|
0
|
|
|
|
|
|
return $self->{"_redundant"}; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub Name |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
87
|
0
|
|
|
|
|
|
my $name = shift; |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
if ($name) |
90
|
0
|
|
|
|
|
|
{ $self->{"name"} = $name; return 1; } |
|
0
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
else |
92
|
0
|
|
|
|
|
|
{ return $self->{"name"}; } |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub LocalId |
96
|
|
|
|
|
|
|
{ |
97
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
98
|
0
|
|
|
|
|
|
my $return_val = 1; |
99
|
0
|
|
|
|
|
|
my $new_id = shift; |
100
|
|
|
|
|
|
|
|
101
|
0
|
0
|
|
|
|
|
if ($new_id) |
102
|
0
|
|
|
|
|
|
{ $self->{"local_id"} = $new_id } |
103
|
|
|
|
|
|
|
else |
104
|
0
|
|
|
|
|
|
{ $return_val = $self->{"local_id"}; } |
105
|
0
|
|
|
|
|
|
return $return_val; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub TextPos |
109
|
|
|
|
|
|
|
{ |
110
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
111
|
0
|
|
|
|
|
|
my $text_pos = $self->{"left_x"}+0.285; |
112
|
0
|
|
|
|
|
|
$text_pos .= ","; |
113
|
0
|
|
|
|
|
|
$text_pos .= $self->{"top_y"}+0.895; |
114
|
0
|
|
|
|
|
|
return $text_pos; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
118
|
|
|
|
|
|
|
# Internal Methods |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub _initialise # over-rides method in DiagramObject |
121
|
|
|
|
|
|
|
{ |
122
|
0
|
|
|
0
|
|
|
my $self = shift; |
123
|
0
|
|
|
|
|
|
$self->{"name"} = shift; |
124
|
0
|
|
|
|
|
|
$self->{"type"} = "Component"; # Component in caps rest lower case (fix this) |
125
|
0
|
|
|
|
|
|
$self->{"left_x"} = 0; |
126
|
0
|
|
|
|
|
|
$self->{"top_y"} = 0; |
127
|
0
|
|
|
|
|
|
return 1; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub _update # over-rides method in DiagramObject |
131
|
|
|
|
|
|
|
{ |
132
|
|
|
|
|
|
|
# might use this later |
133
|
0
|
|
|
0
|
|
|
my $self = shift; |
134
|
0
|
|
|
|
|
|
$self->reposition(); |
135
|
0
|
|
|
|
|
|
return 1; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
############################################################################ |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 NAME DiagramComponent - Handles elements of type UML Smallpackage |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This is a subclass of DiagramObject, which acts as a UML package. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Used by autodia.pl and Handler (and handlers inheriting from Handler) |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
used as in $Component = DiagramComponent->New($name); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |