# -*- 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::Behavioral_Elements::Common_Behavior::Instance;

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


);

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

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





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


=head2 __validate_type

  UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance->__validate_type($value);

Returns true if $value is a valid value of UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.

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

  no warnings;

  UNIVERSAL::isa($x, 'UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance')  ;
}


=head2 __typecheck

  UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance->__typecheck($value, $msg);

Calls C<confess()> with C<$msg> if C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance-E<GT>__validate_type($value)> is false.

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

  confess("typecheck: $msg: type 'UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance': value '$x'")
    unless __validate_type($self, $x);
}


=head2 isaInstance

Returns true if receiver is a C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance>.
Other receivers will return false.

=cut
sub isaInstance { 1 }


=head2 isaBehavioral_Elements__Common_Behavior__Instance

Returns true if receiver is a C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance>.
Other receivers will return false.
This is the fully qualified version of the C<isaInstance> method.

=cut
sub isaBehavioral_Elements__Common_Behavior__Instance { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

Returns the UML Model name (C<'Behavioral_Elements::Common_Behavior::Instance'>) for an object or package of
this Classifier.

=cut
sub __model_name { 'Behavioral_Elements::Common_Behavior::Instance' }





# ASSOC: 

  

# ASSOC: value
# ASSOC: argument
# ASSOC: receiver
# ASSOC: sender
# ASSOC: 

  

# ASSOC: ownedInstance

  

# ASSOC: owner_Instance

  

# ASSOC: resident
# ASSOC: owner_Link

  

# ASSOC: instance

  

# ASSOC: conformingInstance

  

# ASSOC: particpatingInstance

#################################################################
# 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 
  #   1
  #  <--> 
  #  slot 0..* UML::MetaModel::Behavioral_Elements::Common_Behavior::AttributeLink.
    if ( defined $self->{'slot'} && @{$self->{'slot'}} ) {
    my $x = $self->{'slot'};
    $self->{'slot'} = [ ];
    $self->set_slot(@$x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  classifier 1..* UML::MetaModel::Foundation::Core::Classifier.
    if ( defined $self->{'classifier'} && @{$self->{'classifier'}} ) {
    my $x = $self->{'classifier'};
    $self->{'classifier'} = [ ];
    $self->set_classifier(@$x);
  }
  
  # AssociationEnd 
  #  ownedInstance 0..*
  #  <--> 
  #  owner_Instance 0..1 UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.
    if ( defined $self->{'owner_Instance'} ) {
    my $x = $self->{'owner_Instance'};
    $self->{'owner_Instance'} = undef;
    $self->set_owner_Instance($x);
  }
  
  # AssociationEnd 
  #  owner_Instance 0..1
  #  <--> 
  #  ownedInstance 0..* UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.
    if ( defined $self->{'ownedInstance'} && @{$self->{'ownedInstance'}} ) {
    my $x = $self->{'ownedInstance'};
    $self->{'ownedInstance'} = [ ];
    $self->set_ownedInstance(@$x);
  }
  
  # AssociationEnd 
  #  owner_Link 0..1
  #  <--> 
  #  ownedLink 0..* UML::MetaModel::Behavioral_Elements::Common_Behavior::Link.
    if ( defined $self->{'ownedLink'} && @{$self->{'ownedLink'}} ) {
    my $x = $self->{'ownedLink'};
    $self->{'ownedLink'} = [ ];
    $self->set_ownedLink(@$x);
  }
  
  # AssociationEnd 
  #  instance 1
  #  <--> 
  #  linkEnd 0..* UML::MetaModel::Behavioral_Elements::Common_Behavior::LinkEnd.
    if ( defined $self->{'linkEnd'} && @{$self->{'linkEnd'}} ) {
    my $x = $self->{'linkEnd'};
    $self->{'linkEnd'} = [ ];
    $self->set_linkEnd(@$x);
  }
  
  # AssociationEnd 
  #  conformingInstance 0..*
  #  <--> 
  #  playedRole 0..* UML::MetaModel::Behavioral_Elements::Collaborations::ClassifierRole.
    if ( defined $self->{'playedRole'} && @{$self->{'playedRole'}} ) {
    my $x = $self->{'playedRole'};
    $self->{'playedRole'} = [ ];
    $self->set_playedRole(@$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::Element');
    $self->__use('UML::MetaModel::Foundation::Core::ModelElement');
  }

  $self->UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;

  $self;
}
      

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




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


#################################################################
# AssociationEnd  => slot
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::AttributeLink
# multiplicity = 0..*

=head2 slot

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

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 slot ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'slot'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_slot

  $obj->set_slot(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::AttributeLink>.
Returns C<$obj>.

=cut
sub set_slot ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_slot;
  $self->add_slot(@val);
}


=head2 add_slot

  $obj->add_slot(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::AttributeLink>.
Returns C<$obj>.

=cut
sub add_slot ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'slot'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::AttributeLink')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.slot");

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

    # Remove and add associations with other ends.
        
  }
  
  $self;
}


=head2 remove_slot

  $obj->remove_slot($val);

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

=cut
sub remove_slot ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'slot'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::AttributeLink')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.slot");

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_slot

  $obj->clear_slot;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


#################################################################
# AssociationEnd  => classifier
# type = UML::MetaModel::Foundation::Core::Classifier
# multiplicity = 1..*

=head2 classifier

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

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 classifier ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'classifier'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_classifier

  $obj->set_classifier(@val);

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

=cut
sub set_classifier ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_classifier;
  $self->add_classifier(@val);
}


=head2 add_classifier

  $obj->add_classifier(@val);

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

=cut
sub add_classifier ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'classifier'} ||= [ ];
  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::Classifier')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.classifier");

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

    # Remove and add associations with other ends.
        
  }
  
  $self;
}


=head2 remove_classifier

  $obj->remove_classifier($val);

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

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

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_classifier

  $obj->clear_classifier;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


#################################################################
# AssociationEnd ownedInstance => owner_Instance
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance
# multiplicity = 0..1

=head2 owner_Instance

  my $val = $obj->owner_Instance;

Returns the AssociationEnd value of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance>.

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


=head2 set_owner_Instance

  $obj->set_owner_Instance($val);

Sets the AssociationEnd value.
C<$val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance>.
Returns C<$obj>.

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.owner_Instance");

    $self->{'owner_Instance'} = $val;                 # Recursion lock
    # Remove and add associations with other ends.
        
    $old->remove_ownedInstance($self) if $old;
    $val->add_ownedInstance($self)    if $val;

    }
		  
  $self;
}


=head2 add_owner_Instance

  $obj->add_owner_Instance($val);

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

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

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

  my $old;
  if ( ($old = $self->{'owner_Instance'}) ne $val ) { # Recursion lock
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.owner_Instance");
      
    # confess("UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance::owner_Instance: too many")
    # if defined $self->{'owner_Instance'};

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

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

  
  }

  $self;
}


=head2 remove_owner_Instance

  $obj->remove_owner_Instance($val);

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

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

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

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

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

  
  }
}


=head2 clear_owner_Instance

  $obj->clear_owner_Instance;

Clears the Association.
Returns C<$obj>.

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

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

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

  
  }

  $self;
}




#################################################################
# AssociationEnd owner_Instance => ownedInstance
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance
# multiplicity = 0..*

=head2 ownedInstance

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

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 ownedInstance ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'ownedInstance'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_ownedInstance

  $obj->set_ownedInstance(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance>.
Returns C<$obj>.

=cut
sub set_ownedInstance ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_ownedInstance;
  $self->add_ownedInstance(@val);
}


=head2 add_ownedInstance

  $obj->add_ownedInstance(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance>.
Returns C<$obj>.

=cut
sub add_ownedInstance ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'ownedInstance'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.ownedInstance");

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

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

  
  }
  
  $self;
}


=head2 remove_ownedInstance

  $obj->remove_ownedInstance($val);

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

=cut
sub remove_ownedInstance ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'ownedInstance'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.ownedInstance");

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

    # Remove associations with other ends.

        
    $old->remove_owner_Instance($self) if $old;
    $val->add_owner_Instance($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_ownedInstance

  $obj->clear_ownedInstance;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_owner_Instance($self) if $old;
    $val->add_owner_Instance($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd owner_Link => ownedLink
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::Link
# multiplicity = 0..*

=head2 ownedLink

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

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 ownedLink ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'ownedLink'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_ownedLink

  $obj->set_ownedLink(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Link>.
Returns C<$obj>.

=cut
sub set_ownedLink ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_ownedLink;
  $self->add_ownedLink(@val);
}


=head2 add_ownedLink

  $obj->add_ownedLink(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Link>.
Returns C<$obj>.

=cut
sub add_ownedLink ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'ownedLink'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Link')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.ownedLink");

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

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

  
  }
  
  $self;
}


=head2 remove_ownedLink

  $obj->remove_ownedLink($val);

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

=cut
sub remove_ownedLink ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'ownedLink'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Link')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.ownedLink");

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

    # Remove associations with other ends.

        
    $old->remove_owner_Link($self) if $old;
    $val->add_owner_Link($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_ownedLink

  $obj->clear_ownedLink;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_owner_Link($self) if $old;
    $val->add_owner_Link($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd instance => linkEnd
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::LinkEnd
# multiplicity = 0..*

=head2 linkEnd

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

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 linkEnd ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'linkEnd'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_linkEnd

  $obj->set_linkEnd(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::LinkEnd>.
Returns C<$obj>.

=cut
sub set_linkEnd ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_linkEnd;
  $self->add_linkEnd(@val);
}


=head2 add_linkEnd

  $obj->add_linkEnd(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Common_Behavior::LinkEnd>.
Returns C<$obj>.

=cut
sub add_linkEnd ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'linkEnd'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::LinkEnd')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.linkEnd");

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

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

  
  }
  
  $self;
}


=head2 remove_linkEnd

  $obj->remove_linkEnd($val);

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

=cut
sub remove_linkEnd ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'linkEnd'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::LinkEnd')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.linkEnd");

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

    # Remove associations with other ends.

        
    $old->remove_instance($self) if $old;
    $val->add_instance($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_linkEnd

  $obj->clear_linkEnd;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_instance($self) if $old;
    $val->add_instance($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd conformingInstance => playedRole
# type = UML::MetaModel::Behavioral_Elements::Collaborations::ClassifierRole
# multiplicity = 0..*

=head2 playedRole

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

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 playedRole ($)
{
  my ($self) = @_;
		  
  my $x = $self->{'playedRole'} ||= [ ];
  wantarray ? @{$x} : $x;
}


=head2 set_playedRole

  $obj->set_playedRole(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Collaborations::ClassifierRole>.
Returns C<$obj>.

=cut
sub set_playedRole ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_playedRole;
  $self->add_playedRole(@val);
}


=head2 add_playedRole

  $obj->add_playedRole(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Behavioral_Elements::Collaborations::ClassifierRole>.
Returns C<$obj>.

=cut
sub add_playedRole ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'playedRole'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Behavioral_Elements::Collaborations::ClassifierRole')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.playedRole");

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

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

  
  }
  
  $self;
}


=head2 remove_playedRole

  $obj->remove_playedRole($val);

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

=cut
sub remove_playedRole ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'playedRole'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Behavioral_Elements::Collaborations::ClassifierRole')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.playedRole");

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

    # Remove associations with other ends.

        
    $old->remove_conformingInstance($self) if $old;
    $val->add_conformingInstance($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_playedRole

  $obj->clear_playedRole;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_conformingInstance($self) if $old;
    $val->add_conformingInstance($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: ###

