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

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


);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaTemplateArgument

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

=cut
sub isaTemplateArgument { 1 }


=head2 isaFoundation__Core__TemplateArgument

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

=cut
sub isaFoundation__Core__TemplateArgument { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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





# ASSOC: 

  

# ASSOC: argument

  


#################################################################
# 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..*
  #  <--> 
  #  modelElement 1 UML::MetaModel::Foundation::Core::ModelElement.
    if ( defined $self->{'modelElement'} ) {
    my $x = $self->{'modelElement'};
    $self->{'modelElement'} = undef;
    $self->set_modelElement($x);
  }
  
  # AssociationEnd 
  #  argument 1..*
  #  <--> 
  #  binding 1 UML::MetaModel::Foundation::Core::Binding.
    if ( defined $self->{'binding'} ) {
    my $x = $self->{'binding'};
    $self->{'binding'} = undef;
    $self->set_binding($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->UML::MetaModel::Foundation::Core::TemplateArgument::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;

  $self;
}
      

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




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


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

=head2 modelElement

  my $val = $obj->modelElement;

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

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


=head2 set_modelElement

  $obj->set_modelElement($val);

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

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

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

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


=head2 add_modelElement

  $obj->add_modelElement($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_modelElement ($$)
{
  my ($self, $val) = @_;

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

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_modelElement

  $obj->remove_modelElement($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_modelElement

  $obj->clear_modelElement;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}




#################################################################
# AssociationEnd argument => binding
# type = UML::MetaModel::Foundation::Core::Binding
# multiplicity = 1

=head2 binding

  my $val = $obj->binding;

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

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


=head2 set_binding

  $obj->set_binding($val);

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

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

    $self->__use('UML::MetaModel::Foundation::Core::Binding')->__typecheck($val, "UML::MetaModel::Foundation::Core::TemplateArgument.binding");

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

    }
		  
  $self;
}


=head2 add_binding

  $obj->add_binding($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 remove_binding

  $obj->remove_binding($val);

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

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

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

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

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

  
  }
}


=head2 clear_binding

  $obj->clear_binding;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
    $old->remove_argument($self) if $old;
    $val->add_argument($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: ###

