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

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


);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaClassifier

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

=cut
sub isaClassifier { 1 }


=head2 isaFoundation__Core__Classifier

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

=cut
sub isaFoundation__Core__Classifier { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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





# ASSOC: type
# ASSOC: owner

  

# ASSOC: type

  

# ASSOC: powertype

  

# ASSOC: participant

  

# ASSOC: specification

  

# ASSOC: classifier
# ASSOC: base
# ASSOC: type
# ASSOC: type
# ASSOC: type

#################################################################
# 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 
  #  owner 0..1
  #  <--> 
  #  feature 0..* UML::MetaModel::Foundation::Core::Feature.
    if ( defined $self->{'feature'} && @{$self->{'feature'}} ) {
    my $x = $self->{'feature'};
    $self->{'feature'} = [ ];
    $self->set_feature(@$x);
  }
  
  # AssociationEnd 
  #  type 1
  #  <--> 
  #  typedFeature 0..* UML::MetaModel::Foundation::Core::StructuralFeature.
    if ( defined $self->{'typedFeature'} && @{$self->{'typedFeature'}} ) {
    my $x = $self->{'typedFeature'};
    $self->{'typedFeature'} = [ ];
    $self->set_typedFeature(@$x);
  }
  
  # AssociationEnd 
  #  powertype 0..1
  #  <--> 
  #  powertypeRange 0..* UML::MetaModel::Foundation::Core::Generalization.
    if ( defined $self->{'powertypeRange'} && @{$self->{'powertypeRange'}} ) {
    my $x = $self->{'powertypeRange'};
    $self->{'powertypeRange'} = [ ];
    $self->set_powertypeRange(@$x);
  }
  
  # AssociationEnd 
  #  participant 1
  #  <--> 
  #  association 0..* UML::MetaModel::Foundation::Core::AssociationEnd.
    if ( defined $self->{'association'} && @{$self->{'association'}} ) {
    my $x = $self->{'association'};
    $self->{'association'} = [ ];
    $self->set_association(@$x);
  }
  
  # AssociationEnd 
  #  specification 0..*
  #  <--> 
  #  specifiedEnd 0..* UML::MetaModel::Foundation::Core::AssociationEnd.
    if ( defined $self->{'specifiedEnd'} && @{$self->{'specifiedEnd'}} ) {
    my $x = $self->{'specifiedEnd'};
    $self->{'specifiedEnd'} = [ ];
    $self->set_specifiedEnd(@$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::Namespace');
    $self->__use('UML::MetaModel::Foundation::Core::Element');
    $self->__use('UML::MetaModel::Foundation::Core::ModelElement');
    $self->__use('UML::MetaModel::Foundation::Core::GeneralizableElement');
  }

  $self->UML::MetaModel::Foundation::Core::Classifier::__initialize;
  $self->UML::MetaModel::Foundation::Core::Namespace::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::GeneralizableElement::__initialize;

  $self;
}
      

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




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


#################################################################
# AssociationEnd owner => feature
# type = UML::MetaModel::Foundation::Core::Feature
# multiplicity = 0..*

=head2 feature

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

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


=head2 set_feature

  $obj->set_feature(@val);

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

=cut
sub set_feature ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_feature;
  $self->add_feature(@val);
}


=head2 add_feature

  $obj->add_feature(@val);

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

=cut
sub add_feature ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'feature'} ||= [ ];
  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::Feature')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.feature");

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

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

  
  }
  
  $self;
}


=head2 remove_feature

  $obj->remove_feature($val);

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

=cut
sub remove_feature ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'feature'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::Feature')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.feature");

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

    # Remove associations with other ends.

        
    $old->remove_owner($self) if $old;
    $val->add_owner($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_feature

  $obj->clear_feature;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_owner($self) if $old;
    $val->add_owner($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd type => typedFeature
# type = UML::MetaModel::Foundation::Core::StructuralFeature
# multiplicity = 0..*

=head2 typedFeature

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

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


=head2 set_typedFeature

  $obj->set_typedFeature(@val);

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

=cut
sub set_typedFeature ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_typedFeature;
  $self->add_typedFeature(@val);
}


=head2 add_typedFeature

  $obj->add_typedFeature(@val);

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

=cut
sub add_typedFeature ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'typedFeature'} ||= [ ];
  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::StructuralFeature')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.typedFeature");

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

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

  
  }
  
  $self;
}


=head2 remove_typedFeature

  $obj->remove_typedFeature($val);

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

=cut
sub remove_typedFeature ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'typedFeature'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::StructuralFeature')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.typedFeature");

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

    # Remove associations with other ends.

        
    $old->remove_type($self) if $old;
    $val->add_type($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_typedFeature

  $obj->clear_typedFeature;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_type($self) if $old;
    $val->add_type($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd powertype => powertypeRange
# type = UML::MetaModel::Foundation::Core::Generalization
# multiplicity = 0..*

=head2 powertypeRange

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

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


=head2 set_powertypeRange

  $obj->set_powertypeRange(@val);

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

=cut
sub set_powertypeRange ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_powertypeRange;
  $self->add_powertypeRange(@val);
}


=head2 add_powertypeRange

  $obj->add_powertypeRange(@val);

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

=cut
sub add_powertypeRange ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'powertypeRange'} ||= [ ];
  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::Generalization')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.powertypeRange");

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

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

  
  }
  
  $self;
}


=head2 remove_powertypeRange

  $obj->remove_powertypeRange($val);

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

=cut
sub remove_powertypeRange ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'powertypeRange'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::Generalization')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.powertypeRange");

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

    # Remove associations with other ends.

        
    $old->remove_powertype($self) if $old;
    $val->add_powertype($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_powertypeRange

  $obj->clear_powertypeRange;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_powertype($self) if $old;
    $val->add_powertype($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd participant => association
# type = UML::MetaModel::Foundation::Core::AssociationEnd
# multiplicity = 0..*

=head2 association

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

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


=head2 set_association

  $obj->set_association(@val);

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

=cut
sub set_association ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_association;
  $self->add_association(@val);
}


=head2 add_association

  $obj->add_association(@val);

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

=cut
sub add_association ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'association'} ||= [ ];
  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::AssociationEnd')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.association");

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

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

  
  }
  
  $self;
}


=head2 remove_association

  $obj->remove_association($val);

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

=cut
sub remove_association ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'association'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::AssociationEnd')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.association");

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

    # Remove associations with other ends.

        
    $old->remove_participant($self) if $old;
    $val->add_participant($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_association

  $obj->clear_association;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_participant($self) if $old;
    $val->add_participant($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd specification => specifiedEnd
# type = UML::MetaModel::Foundation::Core::AssociationEnd
# multiplicity = 0..*

=head2 specifiedEnd

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

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


=head2 set_specifiedEnd

  $obj->set_specifiedEnd(@val);

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

=cut
sub set_specifiedEnd ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_specifiedEnd;
  $self->add_specifiedEnd(@val);
}


=head2 add_specifiedEnd

  $obj->add_specifiedEnd(@val);

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

=cut
sub add_specifiedEnd ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'specifiedEnd'} ||= [ ];
  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::AssociationEnd')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.specifiedEnd");

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

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

  
  }
  
  $self;
}


=head2 remove_specifiedEnd

  $obj->remove_specifiedEnd($val);

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

=cut
sub remove_specifiedEnd ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'specifiedEnd'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::AssociationEnd')->__typecheck($val, "UML::MetaModel::Foundation::Core::Classifier.specifiedEnd");

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

    # Remove associations with other ends.

        
    $old->remove_specification($self) if $old;
    $val->add_specification($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_specifiedEnd

  $obj->clear_specifiedEnd;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

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

