# -*- perl -*-
# DO NOT EDIT - This file is generated by UML2CODE.
# From template: $Id: PerlTemplate.txt,v 1.12 2003/05/11 06:16:02 stephens Exp $

package UML::MetaModel::Foundation::Core::Component;

use 5.6.1;
use strict;
use warnings;

#################################################################
# Version
#

our $VERSION = do { my @r = (q$Revision: 1.12 $ =~ /\d+/g); sprintf "%d." . "%03d" x $#r, @r };

#################################################################
# Dependencies
#



use Carp qw(croak confess);

#################################################################
# Generalizations
#

use base qw(
  UML::MetaModel::Foundation::Core::Classifier


);

#################################################################
# Exports
#

our @EXPORT_OK = qw(
);
our %EXPORT_TAGS = ( ':all' => \@EXPORT_OK );





#################################################################
# Validation
#


=head2 __validate_type

  UML::MetaModel::Foundation::Core::Component->__validate_type($value);

Returns true if $value is a valid value of UML::MetaModel::Foundation::Core::Component.

=cut
sub __validate_type($$)
{
  my ($self, $x) = @_;

  no warnings;

  UNIVERSAL::isa($x, 'UML::MetaModel::Foundation::Core::Component')  ;
}


=head2 __typecheck

  UML::MetaModel::Foundation::Core::Component->__typecheck($value, $msg);

Calls C<confess()> with C<$msg> if C<UML::MetaModel::Foundation::Core::Component-E<GT>__validate_type($value)> is false.

=cut
sub __typecheck
{
  my ($self, $x, $msg) = @_;

  confess("typecheck: $msg: type 'UML::MetaModel::Foundation::Core::Component': value '$x'")
    unless __validate_type($self, $x);
}


=head2 isaComponent

Returns true if receiver is a C<UML::MetaModel::Foundation::Core::Component>.
Other receivers will return false.

=cut
sub isaComponent { 1 }


=head2 isaFoundation__Core__Component

Returns true if receiver is a C<UML::MetaModel::Foundation::Core::Component>.
Other receivers will return false.
This is the fully qualified version of the C<isaComponent> method.

=cut
sub isaFoundation__Core__Component { 1 }


#################################################################
# Introspection
#

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

Returns the UML Model name (C<'Foundation::Core::Component'>) for an object or package of
this Classifier.

=cut
sub __model_name { 'Foundation::Core::Component' }





# ASSOC: deployedComponent

  

# ASSOC: implementationLocation

  

# ASSOC: container_ModelElement

  


#################################################################
# Class Attributes
#


    

#################################################################
# Initialization
#

 
=head2 __intialize

Initialize all slots in this Classifier.
Does not initlaize slots in Generalizations.

See also: C<_initialize>.

=cut
sub __initialize
{
  my ($self) = @_;

  # Attributes



  # Associations

  # AssociationEnd 
  #  deployedComponent 0..*
  #  <--> 
  #  deploymentLocation 0..* UML::MetaModel::Foundation::Core::Node.
    if ( defined $self->{'deploymentLocation'} && @{$self->{'deploymentLocation'}} ) {
    my $x = $self->{'deploymentLocation'};
    $self->{'deploymentLocation'} = [ ];
    $self->set_deploymentLocation(@$x);
  }
  
  # AssociationEnd 
  #  implementationLocation 0..*
  #  <--> 
  #  implementation 0..* UML::MetaModel::Foundation::Core::Artifact.
    if ( defined $self->{'implementation'} && @{$self->{'implementation'}} ) {
    my $x = $self->{'implementation'};
    $self->{'implementation'} = [ ];
    $self->set_implementation(@$x);
  }
  
  # AssociationEnd 
  #  container_ModelElement 0..*
  #  <--> 
  #  resident 0..* UML::MetaModel::Foundation::Core::ModelElement.
    if ( defined $self->{'resident'} && @{$self->{'resident'}} ) {
    my $x = $self->{'resident'};
    $self->{'resident'} = [ ];
    $self->set_resident(@$x);
  }
  

  $self;
}


my $__initialize_use;

=head2 _intialize

Initialize all slots in this Classifier and all Generalizations.

See also: C<__initialize>.

=cut
sub _initialize
{
  my ($self) = @_;

  # $DB::single = 1;

  unless ( ! $__initialize_use ) {
    $__initialize_use = 1;
    $self->__use('UML::MetaModel::Foundation::Core::Namespace');
    $self->__use('UML::MetaModel::Foundation::Core::Element');
    $self->__use('UML::MetaModel::Foundation::Core::ModelElement');
    $self->__use('UML::MetaModel::Foundation::Core::GeneralizableElement');
    $self->__use('UML::MetaModel::Foundation::Core::Classifier');
  }

  $self->UML::MetaModel::Foundation::Core::Component::__initialize;
  $self->UML::MetaModel::Foundation::Core::Namespace::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::GeneralizableElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::Classifier::__initialize;

  $self;
}
      

#################################################################
# Attributes
#




#################################################################
# Association
#


#################################################################
# AssociationEnd deployedComponent => deploymentLocation
# type = UML::MetaModel::Foundation::Core::Node
# multiplicity = 0..*

=head2 deploymentLocation

  my @val = $obj->deploymentLocation;
  my $ary_val = $obj->deploymentLocation;

Returns the AssociationEnd value.
In array context, returns all the objects in the Association.
In scalar context, returns an array ref of all the objects in the Association.

=cut
sub deploymentLocation ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'deploymentLocation'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_deploymentLocation

  $obj->set_deploymentLocation(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Foundation::Core::Node>.
Returns C<$obj>.

=cut
sub set_deploymentLocation ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_deploymentLocation;
  $self->add_deploymentLocation(@val);
}


=head2 add_deploymentLocation

  $obj->add_deploymentLocation(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Foundation::Core::Node>.
Returns C<$obj>.

=cut
sub add_deploymentLocation ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'deploymentLocation'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Foundation::Core::Node')->__typecheck($val, "UML::MetaModel::Foundation::Core::Component.deploymentLocation");

    push(@{$x}, $val);               # Recursion lock

    # Remove and add associations with other ends.
        
    $old->remove_deployedComponent($self) if $old;
    $val->add_deployedComponent($self)    if $val;

  
  }
  
  $self;
}


=head2 remove_deploymentLocation

  $obj->remove_deploymentLocation($val);

Removes the Association to C<$val>.
Returns C<$obj>.

=cut
sub remove_deploymentLocation ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'deploymentLocation'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::Node')->__typecheck($val, "UML::MetaModel::Foundation::Core::Component.deploymentLocation");

    @$x = grep($_ ne $old, @$x);       # Recursion lock
    $val = undef;

    # Remove associations with other ends.

        
    $old->remove_deployedComponent($self) if $old;
    $val->add_deployedComponent($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_deploymentLocation

  $obj->clear_deploymentLocation;

Clears the Association.
Returns C<$obj>.

=cut
sub clear_deploymentLocation ($) 
{
  my ($self) = @_;
  
  my $x = $self->{'deploymentLocation'} ||= [ ];
  my $val; # Place holder for other MACRO.
  
  $self->{'deploymentLocation'} = [ ];  # Recursion lock
  for my $old ( @$x ) { # Recursion lock

    # Remove associations with other ends.

        
    $old->remove_deployedComponent($self) if $old;
    $val->add_deployedComponent($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd implementationLocation => implementation
# type = UML::MetaModel::Foundation::Core::Artifact
# multiplicity = 0..*

=head2 implementation

  my @val = $obj->implementation;
  my $ary_val = $obj->implementation;

Returns the AssociationEnd value.
In array context, returns all the objects in the Association.
In scalar context, returns an array ref of all the objects in the Association.

=cut
sub implementation ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'implementation'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_implementation

  $obj->set_implementation(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Foundation::Core::Artifact>.
Returns C<$obj>.

=cut
sub set_implementation ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_implementation;
  $self->add_implementation(@val);
}


=head2 add_implementation

  $obj->add_implementation(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Foundation::Core::Artifact>.
Returns C<$obj>.

=cut
sub add_implementation ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'implementation'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Foundation::Core::Artifact')->__typecheck($val, "UML::MetaModel::Foundation::Core::Component.implementation");

    push(@{$x}, $val);               # Recursion lock

    # Remove and add associations with other ends.
        
    $old->remove_implementationLocation($self) if $old;
    $val->add_implementationLocation($self)    if $val;

  
  }
  
  $self;
}


=head2 remove_implementation

  $obj->remove_implementation($val);

Removes the Association to C<$val>.
Returns C<$obj>.

=cut
sub remove_implementation ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'implementation'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::Artifact')->__typecheck($val, "UML::MetaModel::Foundation::Core::Component.implementation");

    @$x = grep($_ ne $old, @$x);       # Recursion lock
    $val = undef;

    # Remove associations with other ends.

        
    $old->remove_implementationLocation($self) if $old;
    $val->add_implementationLocation($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_implementation

  $obj->clear_implementation;

Clears the Association.
Returns C<$obj>.

=cut
sub clear_implementation ($) 
{
  my ($self) = @_;
  
  my $x = $self->{'implementation'} ||= [ ];
  my $val; # Place holder for other MACRO.
  
  $self->{'implementation'} = [ ];  # Recursion lock
  for my $old ( @$x ) { # Recursion lock

    # Remove associations with other ends.

        
    $old->remove_implementationLocation($self) if $old;
    $val->add_implementationLocation($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd container_ModelElement => resident
# type = UML::MetaModel::Foundation::Core::ModelElement
# multiplicity = 0..*

=head2 resident

  my @val = $obj->resident;
  my $ary_val = $obj->resident;

Returns the AssociationEnd value.
In array context, returns all the objects in the Association.
In scalar context, returns an array ref of all the objects in the Association.

=cut
sub resident ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'resident'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_resident

  $obj->set_resident(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Foundation::Core::ModelElement>.
Returns C<$obj>.

=cut
sub set_resident ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_resident;
  $self->add_resident(@val);
}


=head2 add_resident

  $obj->add_resident(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Foundation::Core::ModelElement>.
Returns C<$obj>.

=cut
sub add_resident ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'resident'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Foundation::Core::ModelElement')->__typecheck($val, "UML::MetaModel::Foundation::Core::Component.resident");

    push(@{$x}, $val);               # Recursion lock

    # Remove and add associations with other ends.
        
    $old->remove_container_ModelElement($self) if $old;
    $val->add_container_ModelElement($self)    if $val;

  
  }
  
  $self;
}


=head2 remove_resident

  $obj->remove_resident($val);

Removes the Association to C<$val>.
Returns C<$obj>.

=cut
sub remove_resident ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'resident'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::ModelElement')->__typecheck($val, "UML::MetaModel::Foundation::Core::Component.resident");

    @$x = grep($_ ne $old, @$x);       # Recursion lock
    $val = undef;

    # Remove associations with other ends.

        
    $old->remove_container_ModelElement($self) if $old;
    $val->add_container_ModelElement($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_resident

  $obj->clear_resident;

Clears the Association.
Returns C<$obj>.

=cut
sub clear_resident ($) 
{
  my ($self) = @_;
  
  my $x = $self->{'resident'} ||= [ ];
  my $val; # Place holder for other MACRO.
  
  $self->{'resident'} = [ ];  # Recursion lock
  for my $old ( @$x ) { # Recursion lock

    # Remove associations with other ends.

        
    $old->remove_container_ModelElement($self) if $old;
    $val->add_container_ModelElement($self)    if $val;

  ;

  }
  
  $self;
}




############################################################################

1; # is true!

############################################################################

### Keep these comments at end of file: ks.perl@kurtstephens.com 2003/04/06 ###
### Local Variables: ###
### mode:perl ###
### perl-indent-level:2 ###
### perl-continued-statement-offset:0 ###
### perl-brace-offset:0 ###
### perl-label-offset:0 ###
### End: ###

