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

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


);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaAttribute

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

=cut
sub isaAttribute { 1 }


=head2 isaFoundation__Core__Attribute

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

=cut
sub isaFoundation__Core__Attribute { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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




  



# ASSOC: qualifier

  

# ASSOC: attribute
# ASSOC: avaliableQualifier

#################################################################
# 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

    # Attribute initialValue
  if ( exists $self->{'initialValue'} ) {
    my $x = $self->{'initialValue'};
    $self->{'initialValue'} = undef;
    $self->set_initialValue($x);
  } else {
      }
  


  # Associations

  # AssociationEnd 
  #  qualifier 0..*
  #  <--> 
  #  associationEnd 0..1 UML::MetaModel::Foundation::Core::AssociationEnd.
    if ( defined $self->{'associationEnd'} ) {
    my $x = $self->{'associationEnd'};
    $self->{'associationEnd'} = undef;
    $self->set_associationEnd($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::Feature');
    $self->__use('UML::MetaModel::Foundation::Core::StructuralFeature');
  }

  $self->UML::MetaModel::Foundation::Core::Attribute::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::Feature::__initialize;
  $self->UML::MetaModel::Foundation::Core::StructuralFeature::__initialize;

  $self;
}
      

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



#################################################################
# Attribute initialValue
# type = UML::MetaModel::Foundation::Data_Types::Expression
# multiplicity = 1

=head2 initialValue

  my $val = $obj->initialValue;

Returns the value of Attribute initialValue.

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

  $self->{'initialValue'};
}


=head2 set_initialValue

  $obj->set_initialValue($val);

Sets the value of Attribute initialValue.
C<$val> must be of type C<UML::MetaModel::Foundation::Data_Types::Expression>.
Returns C<$obj>.

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Expression')->__typecheck($val, "UML::MetaModel::Foundation::Core::Attribute.initialValue");

  $self->{'initialValue'} = $val;

  $self
}


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


#################################################################
# AssociationEnd qualifier => associationEnd
# type = UML::MetaModel::Foundation::Core::AssociationEnd
# multiplicity = 0..1

=head2 associationEnd

  my $val = $obj->associationEnd;

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

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


=head2 set_associationEnd

  $obj->set_associationEnd($val);

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

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

    $self->__use('UML::MetaModel::Foundation::Core::AssociationEnd')->__typecheck($val, "UML::MetaModel::Foundation::Core::Attribute.associationEnd");

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

    }
		  
  $self;
}


=head2 add_associationEnd

  $obj->add_associationEnd($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 remove_associationEnd

  $obj->remove_associationEnd($val);

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

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

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

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

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

  
  }
}


=head2 clear_associationEnd

  $obj->clear_associationEnd;

Clears the Association.
Returns C<$obj>.

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

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

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

