package UML::MetaModel::Foundation::Model_Management::Package;

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

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

use strict;
use warnings;

use base qw(UML::MetaModel::Foundation::Core::Namespace);

sub __model_name { 'Foundation::Model_Management::Package' }


  my $__class;
  sub __class 
{ 
  my ($self) = @_;
  
  unless ( $__class ) {
    use UML::MetaMetaModel::Util qw(Namespace_ownedElement_name_);
    $__class = Namespace_ownedElement_name_($self->__metamodel, $self->__model_name);
  }
  
  $__class;
}
sub isaPackage { 1 }

sub isaFoundation__Model_Management__Package { 1 }

sub __validate
{
  my ($self, $x) = @_;
  
      # Use $x->isa$Class???
      UNIVERSAL::isa($x, 'UML::MetaModel::Foundation::Model_Management::Package')
    ;
}

sub __typecheck
{
  my ($self, $x, $msg) = @_;
  die("typecheck: $msg: type 'UML::MetaModel::Foundation::Model_Management::Package': value '$x'")  unless __validate($self, $x);
  $x;
}

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

  $self->UML::MetaModel::Foundation::Core::Namespace::__initialize;

# AssociationEnd 0x872bd84 name = importedElement, type = Foundation::Core::ModelElement multiplicity = *
$self->{'importedElement'} = undef unless exists $self->{'importedElement'};

  $self;
}

sub __initialize_associations
{
  my ($self) = @_;

  $self->UML::MetaModel::Foundation::Core::Namespace::__initialize_associations;

# AssociationEnd 0x872bd84 name = importedElement, type = Foundation::Core::ModelElement multiplicity = *

	      if ( defined $self->{'importedElement'} && @{$self->{'importedElement'}}) {
		my $x = $self->{'importedElement'};
		$self->{'importedElement'} = [ ];
		$self->add_importedElement(@$x);
	      }
	    

  $self;
}

# AssociationEnd 0x872bd84 name = importedElement, type = Foundation::Core::ModelElement multiplicity = *

	      sub importedElement {
		my ($self) = @_;
		
		my $x = $self->{'importedElement'} ||= [ ];
		wantarray ? @{$x} : $x;
	      }
	      sub set_importedElement {
		my ($self, @new) = @_;
		
		$self->clear_importedElement;
		$self->add_importedElement(@new);
	      }
	      sub add_importedElement {
		my ($self, @new) = @_;
		
		my $x = $self->{'importedElement'} ||= [ ];
		my $old; # Place holder

		for my $new ( @new ) {
		  unless ( grep($_ eq $new, @$x) ) { # Recursion lock
		    
    $self->__autouse('UML::MetaModel::Foundation::Core::ModelElement')
    ->__typecheck($new, 'importedElement');
  ;
		    push(@{$x}, $new);                # Recursion lock
		    # AssociationEnd 0x8703ea0 name = importedElement_, type = Foundation::Model_Management::Package, multiplicity = *

	  $old->remove_importedElement_($self) if $old;
	  $new->add_importedElement_($self) if $new;
	;
		  }
		}
		
		$self;
	      }
	      sub remove_importedElement {
		my ($self, @new) = @_;

		my $x = $self->{'importedElement'} ||= [ ];
		my $new; # Place holder

		for my $old ( @new ) {
		  if ( grep($_ eq $old, @$x) ) {   # Recursion lock
		    
    $self->__autouse('UML::MetaModel::Foundation::Core::ModelElement')
    ->__typecheck($old, 'importedElement');
  ;
		    @$x = grep($_ ne $old, @$x); # Recursion lock
		    # AssociationEnd 0x8703ea0 name = importedElement_, type = Foundation::Model_Management::Package, multiplicity = *

	  $old->remove_importedElement_($self) if $old;
	  $new->add_importedElement_($self) if $new;
	;
		  }
		}
		
		$self;
	      }
	      sub clear_importedElement {
		my ($self) = @_;

		my $x = $self->{'importedElement'} ||= [ ];
		my $new; # Place holder

		$self->{'importedElement'} = [ ];              # Recursion lock
		for my $old ( @$x ) { # Recursion lock
		  # AssociationEnd 0x8703ea0 name = importedElement_, type = Foundation::Model_Management::Package, multiplicity = *

	  $old->remove_importedElement_($self) if $old;
	  $new->add_importedElement_($self) if $new;
	;
		}
		
		$self;
	      }
	      
	    


1;

