# -*- 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::ElementOwnership;

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::__ObjectBase

);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaElementOwnership

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

=cut
sub isaElementOwnership { 1 }


=head2 isaFoundation__Core__ElementOwnership

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

=cut
sub isaFoundation__Core__ElementOwnership { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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




  


  



# ASSOC: 

  

# ASSOC: 

  


#################################################################
# 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

    # Attribute visibility
  if ( exists $self->{'visibility'} ) {
    my $x = $self->{'visibility'};
    $self->{'visibility'} = undef;
    $self->set_visibility($x);
  } else {
      }
  
    # Attribute isSpecification
  if ( exists $self->{'isSpecification'} ) {
    my $x = $self->{'isSpecification'};
    $self->{'isSpecification'} = undef;
    $self->set_isSpecification($x);
  } else {
      }
  


  # Associations

  # AssociationEnd 
  #   1
  #  <--> 
  #  ownedElement 1 UML::MetaModel::Foundation::Core::ModelElement.
    if ( defined $self->{'ownedElement'} ) {
    my $x = $self->{'ownedElement'};
    $self->{'ownedElement'} = undef;
    $self->set_ownedElement($x);
  }
  
  # AssociationEnd 
  #   1
  #  <--> 
  #  namespace 1 UML::MetaModel::Foundation::Core::Namespace.
    if ( defined $self->{'namespace'} ) {
    my $x = $self->{'namespace'};
    $self->{'namespace'} = undef;
    $self->set_namespace($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->UML::MetaModel::Foundation::Core::ElementOwnership::__initialize;

  $self;
}
      

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



#################################################################
# Attribute visibility
# type = UML::MetaModel::Foundation::Data_Types::VisibilityKind
# multiplicity = 1

=head2 visibility

  my $val = $obj->visibility;

Returns the value of Attribute visibility.

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

  $self->{'visibility'};
}


=head2 set_visibility

  $obj->set_visibility($val);

Sets the value of Attribute visibility.
C<$val> must be of type C<UML::MetaModel::Foundation::Data_Types::VisibilityKind>.
Returns C<$obj>.

=cut
sub set_visibility ($$)
{
  my ($self, $val) = @_;

  $self->__use('UML::MetaModel::Foundation::Data_Types::VisibilityKind')->__typecheck($val, "UML::MetaModel::Foundation::Core::ElementOwnership.visibility");

  $self->{'visibility'} = $val;

  $self
}

#################################################################
# Attribute isSpecification
# type = UML::MetaModel::Foundation::Data_Types::Boolean
# multiplicity = 1

=head2 isSpecification

  my $val = $obj->isSpecification;

Returns the value of Attribute isSpecification.

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

  $self->{'isSpecification'};
}


=head2 set_isSpecification

  $obj->set_isSpecification($val);

Sets the value of Attribute isSpecification.
C<$val> must be of type C<UML::MetaModel::Foundation::Data_Types::Boolean>.
Returns C<$obj>.

=cut
sub set_isSpecification ($$)
{
  my ($self, $val) = @_;

  $self->__use('UML::MetaModel::Foundation::Data_Types::Boolean')->__typecheck($val, "UML::MetaModel::Foundation::Core::ElementOwnership.isSpecification");

  $self->{'isSpecification'} = $val;

  $self
}


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


#################################################################
# AssociationEnd  => ownedElement
# type = UML::MetaModel::Foundation::Core::ModelElement
# multiplicity = 1

=head2 ownedElement

  my $val = $obj->ownedElement;

Returns the AssociationEnd value of type C<UML::MetaModel::Foundation::Core::ModelElement>.

=cut
sub ownedElement ($)
{
  my ($self) = @_;
		  
  $self->{'ownedElement'};
}


=head2 set_ownedElement

  $obj->set_ownedElement($val);

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

=cut
sub set_ownedElement ($$)
{
  my ($self, $val) = @_;
		  
  no warnings; # Use of uninitialized value in string ne at ...
		  
  my $old;
  if ( ($old = $self->{'ownedElement'}) ne $val ) { # Recursion lock

    $self->__use('UML::MetaModel::Foundation::Core::ModelElement')->__typecheck($val, "UML::MetaModel::Foundation::Core::ElementOwnership.ownedElement");

    $self->{'ownedElement'} = $val;                 # Recursion lock
    # Remove and add associations with other ends.
          }
		  
  $self;
}


=head2 add_ownedElement

  $obj->add_ownedElement($val);

Adds the AssociationEnd value.
C<$val> must of of type C<UML::MetaModel::Foundation::Core::ModelElement>.
Throws exception if a value already exists.
Returns C<$obj>.

=cut
sub add_ownedElement ($$)
{
  my ($self, $val) = @_;

  no warnings; # Use of uninitialized value in string ne at ...

  my $old;
  if ( ($old = $self->{'ownedElement'}) ne $val ) { # Recursion lock
    $self->__use('UML::MetaModel::Foundation::Core::ModelElement')->__typecheck($val, "UML::MetaModel::Foundation::Core::ElementOwnership.ownedElement");
      
    # confess("UML::MetaModel::Foundation::Core::ElementOwnership::ownedElement: too many")
    # if defined $self->{'ownedElement'};

    $self->{'ownedElement'} = $val;                 # Recursion lock

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_ownedElement

  $obj->remove_ownedElement($val);

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

=cut
sub remove_ownedElement ($$)
{
  my ($self, $val) = @_;

  no warnings; # Use of uninitialized value in string ne at ...

  my $old;
  if ( ($old = $self->{'ownedElement'}) eq $val ) { # Recursion lock
    $val = $self->{'ownedElement'} = undef;         # Recursion lock

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_ownedElement

  $obj->clear_ownedElement;

Clears the Association.
Returns C<$obj>.

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

  my $old;
  if ( defined ($old = $self->{'ownedElement'}) ) { # Recursion lock
    my $val = $self->{'ownedElement'} = undef;      # Recursion lock

    # Remove and add associations with other ends.
        
  }

  $self;
}




#################################################################
# AssociationEnd  => namespace
# type = UML::MetaModel::Foundation::Core::Namespace
# multiplicity = 1

=head2 namespace

  my $val = $obj->namespace;

Returns the AssociationEnd value of type C<UML::MetaModel::Foundation::Core::Namespace>.

=cut
sub namespace ($)
{
  my ($self) = @_;
		  
  $self->{'namespace'};
}


=head2 set_namespace

  $obj->set_namespace($val);

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

=cut
sub set_namespace ($$)
{
  my ($self, $val) = @_;
		  
  no warnings; # Use of uninitialized value in string ne at ...
		  
  my $old;
  if ( ($old = $self->{'namespace'}) ne $val ) { # Recursion lock

    $self->__use('UML::MetaModel::Foundation::Core::Namespace')->__typecheck($val, "UML::MetaModel::Foundation::Core::ElementOwnership.namespace");

    $self->{'namespace'} = $val;                 # Recursion lock
    # Remove and add associations with other ends.
          }
		  
  $self;
}


=head2 add_namespace

  $obj->add_namespace($val);

Adds the AssociationEnd value.
C<$val> must of of type C<UML::MetaModel::Foundation::Core::Namespace>.
Throws exception if a value already exists.
Returns C<$obj>.

=cut
sub add_namespace ($$)
{
  my ($self, $val) = @_;

  no warnings; # Use of uninitialized value in string ne at ...

  my $old;
  if ( ($old = $self->{'namespace'}) ne $val ) { # Recursion lock
    $self->__use('UML::MetaModel::Foundation::Core::Namespace')->__typecheck($val, "UML::MetaModel::Foundation::Core::ElementOwnership.namespace");
      
    # confess("UML::MetaModel::Foundation::Core::ElementOwnership::namespace: too many")
    # if defined $self->{'namespace'};

    $self->{'namespace'} = $val;                 # Recursion lock

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_namespace

  $obj->remove_namespace($val);

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

=cut
sub remove_namespace ($$)
{
  my ($self, $val) = @_;

  no warnings; # Use of uninitialized value in string ne at ...

  my $old;
  if ( ($old = $self->{'namespace'}) eq $val ) { # Recursion lock
    $val = $self->{'namespace'} = undef;         # Recursion lock

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_namespace

  $obj->clear_namespace;

Clears the Association.
Returns C<$obj>.

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

  my $old;
  if ( defined ($old = $self->{'namespace'}) ) { # Recursion lock
    my $val = $self->{'namespace'} = undef;      # Recursion lock

    # Remove and add associations with other ends.
        
  }

  $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: ###

