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

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::Collaborations::CollaborationInstanceSet->__validate_type($value);

Returns true if $value is a valid value of UML::MetaModel::Behavioral_Elements::Collaborations::CollaborationInstanceSet.

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

  no warnings;

  UNIVERSAL::isa($x, 'UML::MetaModel::Behavioral_Elements::Collaborations::CollaborationInstanceSet')  ;
}


=head2 __typecheck

  UML::MetaModel::Behavioral_Elements::Collaborations::CollaborationInstanceSet->__typecheck($value, $msg);

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

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

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


=head2 isaCollaborationInstanceSet

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

=cut
sub isaCollaborationInstanceSet { 1 }


=head2 isaBehavioral_Elements__Collaborations__CollaborationInstanceSet

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

=cut
sub isaBehavioral_Elements__Collaborations__CollaborationInstanceSet { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

=cut
sub __model_name { 'Behavioral_Elements::Collaborations::CollaborationInstanceSet' }





# ASSOC: context

  

# ASSOC: 

  

# ASSOC: 

  

# 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



  # Associations

  # AssociationEnd 
  #  context 1
  #  <--> 
  #  interactionInstance 0..* UML::MetaModel::Behavioral_Elements::Collaborations::InteractionInstanceSet.
    if ( defined $self->{'interactionInstance'} && @{$self->{'interactionInstance'}} ) {
    my $x = $self->{'interactionInstance'};
    $self->{'interactionInstance'} = [ ];
    $self->set_interactionInstance(@$x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  constrainingElement 0..* UML::MetaModel::Foundation::Core::ModelElement.
    if ( defined $self->{'constrainingElement'} && @{$self->{'constrainingElement'}} ) {
    my $x = $self->{'constrainingElement'};
    $self->{'constrainingElement'} = [ ];
    $self->set_constrainingElement(@$x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  particpatingLink 0..* UML::MetaModel::Behavioral_Elements::Common_Behavior::Link.
    if ( defined $self->{'particpatingLink'} && @{$self->{'particpatingLink'}} ) {
    my $x = $self->{'particpatingLink'};
    $self->{'particpatingLink'} = [ ];
    $self->set_particpatingLink(@$x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  particpatingInstance 1..* UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance.
    if ( defined $self->{'particpatingInstance'} && @{$self->{'particpatingInstance'}} ) {
    my $x = $self->{'particpatingInstance'};
    $self->{'particpatingInstance'} = [ ];
    $self->set_particpatingInstance(@$x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  collaboration 0..1 UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration.
    if ( defined $self->{'collaboration'} ) {
    my $x = $self->{'collaboration'};
    $self->{'collaboration'} = undef;
    $self->set_collaboration($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::Collaborations::CollaborationInstanceSet::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;

  $self;
}
      

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




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


#################################################################
# AssociationEnd context => interactionInstance
# type = UML::MetaModel::Behavioral_Elements::Collaborations::InteractionInstanceSet
# multiplicity = 0..*

=head2 interactionInstance

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

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


=head2 set_interactionInstance

  $obj->set_interactionInstance(@val);

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

=cut
sub set_interactionInstance ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_interactionInstance;
  $self->add_interactionInstance(@val);
}


=head2 add_interactionInstance

  $obj->add_interactionInstance(@val);

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

=cut
sub add_interactionInstance ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'interactionInstance'} ||= [ ];
  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::InteractionInstanceSet')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Collaborations::CollaborationInstanceSet.interactionInstance");

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

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

  
  }
  
  $self;
}


=head2 remove_interactionInstance

  $obj->remove_interactionInstance($val);

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

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

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

    # Remove associations with other ends.

        
    $old->remove_context($self) if $old;
    $val->add_context($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_interactionInstance

  $obj->clear_interactionInstance;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_context($self) if $old;
    $val->add_context($self)    if $val;

  ;

  }
  
  $self;
}


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

=head2 constrainingElement

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

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


=head2 set_constrainingElement

  $obj->set_constrainingElement(@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_constrainingElement ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_constrainingElement;
  $self->add_constrainingElement(@val);
}


=head2 add_constrainingElement

  $obj->add_constrainingElement(@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_constrainingElement ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'constrainingElement'} ||= [ ];
  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::Behavioral_Elements::Collaborations::CollaborationInstanceSet.constrainingElement");

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

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


=head2 remove_constrainingElement

  $obj->remove_constrainingElement($val);

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

=cut
sub remove_constrainingElement ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'constrainingElement'} ||= [ ];
  
  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::Behavioral_Elements::Collaborations::CollaborationInstanceSet.constrainingElement");

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_constrainingElement

  $obj->clear_constrainingElement;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


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

=head2 particpatingLink

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

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


=head2 set_particpatingLink

  $obj->set_particpatingLink(@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_particpatingLink ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_particpatingLink;
  $self->add_particpatingLink(@val);
}


=head2 add_particpatingLink

  $obj->add_particpatingLink(@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_particpatingLink ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'particpatingLink'} ||= [ ];
  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::Collaborations::CollaborationInstanceSet.particpatingLink");

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

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


=head2 remove_particpatingLink

  $obj->remove_particpatingLink($val);

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

=cut
sub remove_particpatingLink ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'particpatingLink'} ||= [ ];
  
  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::Collaborations::CollaborationInstanceSet.particpatingLink");

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_particpatingLink

  $obj->clear_particpatingLink;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


#################################################################
# AssociationEnd  => particpatingInstance
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::Instance
# multiplicity = 1..*

=head2 particpatingInstance

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

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


=head2 set_particpatingInstance

  $obj->set_particpatingInstance(@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_particpatingInstance ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_particpatingInstance;
  $self->add_particpatingInstance(@val);
}


=head2 add_particpatingInstance

  $obj->add_particpatingInstance(@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_particpatingInstance ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'particpatingInstance'} ||= [ ];
  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::Collaborations::CollaborationInstanceSet.particpatingInstance");

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

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


=head2 remove_particpatingInstance

  $obj->remove_particpatingInstance($val);

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

=cut
sub remove_particpatingInstance ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'particpatingInstance'} ||= [ ];
  
  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::Collaborations::CollaborationInstanceSet.particpatingInstance");

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_particpatingInstance

  $obj->clear_particpatingInstance;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


#################################################################
# AssociationEnd  => collaboration
# type = UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration
# multiplicity = 0..1

=head2 collaboration

  my $val = $obj->collaboration;

Returns the AssociationEnd value of type C<UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration>.

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


=head2 set_collaboration

  $obj->set_collaboration($val);

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

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Collaborations::CollaborationInstanceSet.collaboration");

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


=head2 add_collaboration

  $obj->add_collaboration($val);

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

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

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

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_collaboration

  $obj->remove_collaboration($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_collaboration

  $obj->clear_collaboration;

Clears the Association.
Returns C<$obj>.

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

  my $old;
  if ( defined ($old = $self->{'collaboration'}) ) { # Recursion lock
    my $val = $self->{'collaboration'} = 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: ###

