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

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


);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaDependency

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

=cut
sub isaDependency { 1 }


=head2 isaFoundation__Core__Dependency

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

=cut
sub isaFoundation__Core__Dependency { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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





# ASSOC: supplierDependency

  

# ASSOC: clientDependency

  


#################################################################
# 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 
  #  supplierDependency 0..*
  #  <--> 
  #  supplier 1..* UML::MetaModel::Foundation::Core::ModelElement.
    if ( defined $self->{'supplier'} && @{$self->{'supplier'}} ) {
    my $x = $self->{'supplier'};
    $self->{'supplier'} = [ ];
    $self->set_supplier(@$x);
  }
  
  # AssociationEnd 
  #  clientDependency 0..*
  #  <--> 
  #  client 1..* UML::MetaModel::Foundation::Core::ModelElement.
    if ( defined $self->{'client'} && @{$self->{'client'}} ) {
    my $x = $self->{'client'};
    $self->{'client'} = [ ];
    $self->set_client(@$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->__use('UML::MetaModel::Foundation::Core::Relationship');
  }

  $self->UML::MetaModel::Foundation::Core::Dependency::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::Relationship::__initialize;

  $self;
}
      

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




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


#################################################################
# AssociationEnd supplierDependency => supplier
# type = UML::MetaModel::Foundation::Core::ModelElement
# multiplicity = 1..*

=head2 supplier

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

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


=head2 set_supplier

  $obj->set_supplier(@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_supplier ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_supplier;
  $self->add_supplier(@val);
}


=head2 add_supplier

  $obj->add_supplier(@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_supplier ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'supplier'} ||= [ ];
  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::Foundation::Core::Dependency.supplier");

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

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

  
  }
  
  $self;
}


=head2 remove_supplier

  $obj->remove_supplier($val);

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

=cut
sub remove_supplier ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'supplier'} ||= [ ];
  
  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::Foundation::Core::Dependency.supplier");

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

    # Remove associations with other ends.

        
    $old->remove_supplierDependency($self) if $old;
    $val->add_supplierDependency($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_supplier

  $obj->clear_supplier;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_supplierDependency($self) if $old;
    $val->add_supplierDependency($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd clientDependency => client
# type = UML::MetaModel::Foundation::Core::ModelElement
# multiplicity = 1..*

=head2 client

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

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


=head2 set_client

  $obj->set_client(@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_client ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_client;
  $self->add_client(@val);
}


=head2 add_client

  $obj->add_client(@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_client ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'client'} ||= [ ];
  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::Foundation::Core::Dependency.client");

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

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

  
  }
  
  $self;
}


=head2 remove_client

  $obj->remove_client($val);

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

=cut
sub remove_client ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'client'} ||= [ ];
  
  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::Foundation::Core::Dependency.client");

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

    # Remove associations with other ends.

        
    $old->remove_clientDependency($self) if $old;
    $val->add_clientDependency($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_client

  $obj->clear_client;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

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

