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

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::GeneralizableElement  UML::MetaModel::Foundation::Core::Namespace


);

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

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





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


=head2 __validate_type

  UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration->__validate_type($value);

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaCollaboration

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

=cut
sub isaCollaboration { 1 }


=head2 isaBehavioral_Elements__Collaborations__Collaboration

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

=cut
sub isaBehavioral_Elements__Collaborations__Collaboration { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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





# ASSOC: 

  

# ASSOC: usedCollaboration
# ASSOC: 

  

# ASSOC: context
# ASSOC: 

  

# ASSOC: 

  

# ASSOC: collaboration

#################################################################
# 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 
  #   0..*
  #  <--> 
  #  usedCollaboration 0..* UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration.
    if ( defined $self->{'usedCollaboration'} && @{$self->{'usedCollaboration'}} ) {
    my $x = $self->{'usedCollaboration'};
    $self->{'usedCollaboration'} = [ ];
    $self->set_usedCollaboration(@$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..*
  #  <--> 
  #  representedOperation 0..1 UML::MetaModel::Foundation::Core::Operation.
    if ( defined $self->{'representedOperation'} ) {
    my $x = $self->{'representedOperation'};
    $self->{'representedOperation'} = undef;
    $self->set_representedOperation($x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  representedClassifier 0..1 UML::MetaModel::Foundation::Core::Operation.
    if ( defined $self->{'representedClassifier'} ) {
    my $x = $self->{'representedClassifier'};
    $self->{'representedClassifier'} = undef;
    $self->set_representedClassifier($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::GeneralizableElement');
    $self->__use('UML::MetaModel::Foundation::Core::Element');
    $self->__use('UML::MetaModel::Foundation::Core::ModelElement');
    $self->__use('UML::MetaModel::Foundation::Core::Namespace');
  }

  $self->UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration::__initialize;
  $self->UML::MetaModel::Foundation::Core::GeneralizableElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::Namespace::__initialize;

  $self;
}
      

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




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


#################################################################
# AssociationEnd  => usedCollaboration
# type = UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration
# multiplicity = 0..*

=head2 usedCollaboration

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

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


=head2 set_usedCollaboration

  $obj->set_usedCollaboration(@val);

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

=cut
sub set_usedCollaboration ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_usedCollaboration;
  $self->add_usedCollaboration(@val);
}


=head2 add_usedCollaboration

  $obj->add_usedCollaboration(@val);

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

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

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

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


=head2 remove_usedCollaboration

  $obj->remove_usedCollaboration($val);

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

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

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_usedCollaboration

  $obj->clear_usedCollaboration;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        ;

  }
  
  $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::Collaboration.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::Collaboration.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  => representedOperation
# type = UML::MetaModel::Foundation::Core::Operation
# multiplicity = 0..1

=head2 representedOperation

  my $val = $obj->representedOperation;

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

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


=head2 set_representedOperation

  $obj->set_representedOperation($val);

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

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

    $self->__use('UML::MetaModel::Foundation::Core::Operation')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration.representedOperation");

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


=head2 add_representedOperation

  $obj->add_representedOperation($val);

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

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

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

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_representedOperation

  $obj->remove_representedOperation($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_representedOperation

  $obj->clear_representedOperation;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}




#################################################################
# AssociationEnd  => representedClassifier
# type = UML::MetaModel::Foundation::Core::Operation
# multiplicity = 0..1

=head2 representedClassifier

  my $val = $obj->representedClassifier;

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

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


=head2 set_representedClassifier

  $obj->set_representedClassifier($val);

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

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

    $self->__use('UML::MetaModel::Foundation::Core::Operation')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Collaborations::Collaboration.representedClassifier");

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


=head2 add_representedClassifier

  $obj->add_representedClassifier($val);

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

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

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

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_representedClassifier

  $obj->remove_representedClassifier($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_representedClassifier

  $obj->clear_representedClassifier;

Clears the Association.
Returns C<$obj>.

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

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

