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

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


);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaStructuralFeature

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

=cut
sub isaStructuralFeature { 1 }


=head2 isaFoundation__Core__StructuralFeature

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

=cut
sub isaFoundation__Core__StructuralFeature { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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




  


  


  


  



# ASSOC: typedFeature

  


#################################################################
# 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 multiplicity
  if ( exists $self->{'multiplicity'} ) {
    my $x = $self->{'multiplicity'};
    $self->{'multiplicity'} = undef;
    $self->set_multiplicity($x);
  } else {
      }
  
    # Attribute changeability
  if ( exists $self->{'changeability'} ) {
    my $x = $self->{'changeability'};
    $self->{'changeability'} = undef;
    $self->set_changeability($x);
  } else {
      }
  
    # Attribute targetScope
  if ( exists $self->{'targetScope'} ) {
    my $x = $self->{'targetScope'};
    $self->{'targetScope'} = undef;
    $self->set_targetScope($x);
  } else {
      }
  
    # Attribute ordering
  if ( exists $self->{'ordering'} ) {
    my $x = $self->{'ordering'};
    $self->{'ordering'} = undef;
    $self->set_ordering($x);
  } else {
      }
  


  # Associations

  # AssociationEnd 
  #  typedFeature 0..*
  #  <--> 
  #  type 1 UML::MetaModel::Foundation::Core::Classifier.
    if ( defined $self->{'type'} ) {
    my $x = $self->{'type'};
    $self->{'type'} = undef;
    $self->set_type($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->UML::MetaModel::Foundation::Core::StructuralFeature::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::Feature::__initialize;

  $self;
}
      

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



#################################################################
# Attribute multiplicity
# type = UML::MetaModel::Foundation::Data_Types::Multiplicity
# multiplicity = 1

=head2 multiplicity

  my $val = $obj->multiplicity;

Returns the value of Attribute multiplicity.

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

  $self->{'multiplicity'};
}


=head2 set_multiplicity

  $obj->set_multiplicity($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Multiplicity')->__typecheck($val, "UML::MetaModel::Foundation::Core::StructuralFeature.multiplicity");

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

  $self
}

#################################################################
# Attribute changeability
# type = UML::MetaModel::Foundation::Data_Types::ChangeableKind
# multiplicity = 1

=head2 changeability

  my $val = $obj->changeability;

Returns the value of Attribute changeability.

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

  $self->{'changeability'};
}


=head2 set_changeability

  $obj->set_changeability($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::ChangeableKind')->__typecheck($val, "UML::MetaModel::Foundation::Core::StructuralFeature.changeability");

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

  $self
}

#################################################################
# Attribute targetScope
# type = UML::MetaModel::Foundation::Data_Types::ScopeKind
# multiplicity = 1

=head2 targetScope

  my $val = $obj->targetScope;

Returns the value of Attribute targetScope.

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

  $self->{'targetScope'};
}


=head2 set_targetScope

  $obj->set_targetScope($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::ScopeKind')->__typecheck($val, "UML::MetaModel::Foundation::Core::StructuralFeature.targetScope");

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

  $self
}

#################################################################
# Attribute ordering
# type = UML::MetaModel::Foundation::Data_Types::OrderingKind
# multiplicity = 1

=head2 ordering

  my $val = $obj->ordering;

Returns the value of Attribute ordering.

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

  $self->{'ordering'};
}


=head2 set_ordering

  $obj->set_ordering($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::OrderingKind')->__typecheck($val, "UML::MetaModel::Foundation::Core::StructuralFeature.ordering");

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

  $self
}


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


#################################################################
# AssociationEnd typedFeature => type
# type = UML::MetaModel::Foundation::Core::Classifier
# multiplicity = 1

=head2 type

  my $val = $obj->type;

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

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


=head2 set_type

  $obj->set_type($val);

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

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

    $self->__use('UML::MetaModel::Foundation::Core::Classifier')->__typecheck($val, "UML::MetaModel::Foundation::Core::StructuralFeature.type");

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

    }
		  
  $self;
}


=head2 add_type

  $obj->add_type($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 remove_type

  $obj->remove_type($val);

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

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

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

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

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

  
  }
}


=head2 clear_type

  $obj->clear_type;

Clears the Association.
Returns C<$obj>.

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

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

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

