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