# -*- perl -*-
# DO NOT EDIT - This file is generated by UMMF; http://ummf.sourceforge.net 
# From template: $Id: PerlTemplate.txt,v 1.74 2004/08/01 03:50:07 kstephens Exp $

package UMMF::UML::MetaModel::Foundation::Core::Generalization;

#use 5.6.1;
use strict;
use warnings;

#################################################################
# Version
#

our $VERSION = do { my @r = (q{1.0} =~ /\d+/g); sprintf "%d." . "%03d" x $#r, @r };


#################################################################
# Documentation
#

=head1 NAME

UMMF::UML::MetaModel::Foundation::Core::Generalization -- 

=head1 VERSION

1.0

=head1 SYNOPSIS

=head1 DESCRIPTION 

=head1 USAGE

=head1 EXPORT

=head1 METATYPE

L<UMMF::UML::MetaModel::Foundation::Core::Class|UMMF::UML::MetaModel::Foundation::Core::Class>

=head1 SUPERCLASSES

L<UMMF::UML::MetaModel::Foundation::Core::Relationship|UMMF::UML::MetaModel::Foundation::Core::Relationship>




=head1 ATTRIBUTES

I<NO ATTRIBUTES>


=head1 ASSOCIATIONS


=head2 C<0..*> : C<generalization> E<lt>---E<gt>  C<child> : UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement C<1>



=over 4

=item metatype = L<UMMF::UML::MetaModel::Foundation::Core::AssociationEnd|UMMF::UML::MetaModel::Foundation::Core::AssociationEnd>

=item type = L<UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement|UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement>

=item multiplicity = C<1>

=item changeability = C<changeable>

=item targetScope = C<instance>

=item ordering = C<>

=item isNavigable = C<1>

=item aggregation = C<none>

=item visibility = C<public>

=item container_type = C<Set::Object>

=back


=head2 C<0..*> : C<specialization> E<lt>---E<gt>  C<parent> : UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement C<1>



=over 4

=item metatype = L<UMMF::UML::MetaModel::Foundation::Core::AssociationEnd|UMMF::UML::MetaModel::Foundation::Core::AssociationEnd>

=item type = L<UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement|UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement>

=item multiplicity = C<1>

=item changeability = C<changeable>

=item targetScope = C<instance>

=item ordering = C<>

=item isNavigable = C<1>

=item aggregation = C<none>

=item visibility = C<public>

=item container_type = C<Set::Object>

=back


=head2 C<0..*> : C<powertypeRange> E<lt>---E<gt>  C<powertype> : UMMF::UML::MetaModel::Foundation::Core::Classifier C<0..1>



=over 4

=item metatype = L<UMMF::UML::MetaModel::Foundation::Core::AssociationEnd|UMMF::UML::MetaModel::Foundation::Core::AssociationEnd>

=item type = L<UMMF::UML::MetaModel::Foundation::Core::Classifier|UMMF::UML::MetaModel::Foundation::Core::Classifier>

=item multiplicity = C<0..1>

=item changeability = C<changeable>

=item targetScope = C<instance>

=item ordering = C<>

=item isNavigable = C<1>

=item aggregation = C<none>

=item visibility = C<public>

=item container_type = C<Set::Object>

=back



=head1 METHODS

=cut



#################################################################
# Dependencies
#





use Carp qw(croak confess);
use Set::Object 1.05;
use Class::Multimethods 1.70;
use Data::Dumper;
use Scalar::Util qw(weaken);
use UMMF::UML::MetaModel::__ObjectBase qw(:__ummf_array);


#################################################################
# Generalizations
#

use base qw(
  UMMF::UML::MetaModel::Foundation::Core::Relationship



);


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

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





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


=head2 C<__validate_type>

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

Returns true if C<$value> is a valid representation of L<UMMF::UML::MetaModel::Foundation::Core::Generalization|UMMF::UML::MetaModel::Foundation::Core::Generalization>.

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

  no warnings;

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


=head2 C<__typecheck>

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

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

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

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


=head2 C<isaGeneralization>


Returns true if receiver is a L<UMMF::UML::MetaModel::Foundation::Core::Generalization|UMMF::UML::MetaModel::Foundation::Core::Generalization>.
Other receivers will return false.

=cut
sub isaGeneralization { 1 }


=head2 C<isaFoundation__Core__Generalization>


Returns true if receiver is a L<UMMF::UML::MetaModel::Foundation::Core::Generalization|UMMF::UML::MetaModel::Foundation::Core::Generalization>.
Other receivers will return false.
This is the fully qualified version of the C<isaGeneralization> method.

=cut
sub isaFoundation__Core__Generalization { 1 }


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

=head2 C<__model_name> 

  my $name = $obj_or_package->__model_name;

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

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



=head2 C<__isAbstract>

  $package->__isAbstract;

Returns C<0>.

=cut
sub __isAbstract { 0; }


my $__tangram_schema;
=head2 C<__tangram_schema>

  my $tangram_schema $obj_or_package->__tangram_schema

Returns a HASH ref that describes this Classifier for Tangram.

See L<UMMF::UML::Export::Perl::Tangram|UMMF::UML::Export::Perl::Tangram>

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

  $__tangram_schema ||=
  {
   'classes' =>
   [
     'UMMF::UML::MetaModel::Foundation::Core::Generalization' =>
     {
       'table' => 'Foundation__Core__Generalization',
       'abstract' => 0,
       'slots' => 
       { 
	 # Attributes
	 
	 # Associations
	 	 	       'child'
       => {
	 'type_impl' => 'ref',
         'class' => 'UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement',

                                             'col' => 'child', 

                                                                                                                   }
      ,
                  	 	       'parent'
       => {
	 'type_impl' => 'ref',
         'class' => 'UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement',

                                             'col' => 'parent', 

                                                                                                                   }
      ,
                  	 	       'powertype'
       => {
	 'type_impl' => 'ref',
         'class' => 'UMMF::UML::MetaModel::Foundation::Core::Classifier',

                  'null' => '1', 

                                    'col' => 'powertype', 

                                                                                                                   }
      ,
                         },
       'bases' => [  'UMMF::UML::MetaModel::Foundation::Core::Relationship',  ],
       'sql' => {

       },
     },
   ],

   'sql' =>
   {
    # Note Tangram::Ref::get_exporter() has
    # "UPDATE $table SET $self->{col} = $refid WHERE id = $id",
    # The id_col is hard-coded, 
    # Thus id_col will not work.
    #'id_col' => '__sid',
    #'class_col' => '__stype',
   },
     # 'set_id' => sub { }
     # 'get_id' => sub { }

      
  };
}


#################################################################
# Class Attributes
#


    

#################################################################
# Class Associations
#


    

#################################################################
# Initialization
#


=head2 C<___initialize>

Initialize all Attributes and AssociationEnds in a instance of this Classifier.
Does B<not> initalize slots in its Generalizations.

See also: C<__initialize>.

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

  # Attributes



  # Associations

  # AssociationEnd 
  #  generalization 0..*
  #  <--> 
  #  child 1 UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement.
    if ( defined $self->{'child'} ) {
    my $x = $self->{'child'};
    $self->{'child'} = undef;
    $self->set_child($x);
  }
  
  # AssociationEnd 
  #  specialization 0..*
  #  <--> 
  #  parent 1 UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement.
    if ( defined $self->{'parent'} ) {
    my $x = $self->{'parent'};
    $self->{'parent'} = undef;
    $self->set_parent($x);
  }
  
  # AssociationEnd 
  #  powertypeRange 0..*
  #  <--> 
  #  powertype 0..1 UMMF::UML::MetaModel::Foundation::Core::Classifier.
    if ( defined $self->{'powertype'} ) {
    my $x = $self->{'powertype'};
    $self->{'powertype'} = undef;
    $self->set_powertype($x);
  }
  

  $self;
}


my $__initialize_use;

=head2 C<__initialize>

Initialize all slots in this Classifier and all its Generalizations.

See also: C<___initialize>.

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

  # $DB::single = 1;

  unless ( ! $__initialize_use ) {
    $__initialize_use = 1;
    $self->__use('UMMF::UML::MetaModel::Foundation::Core::Element');
    $self->__use('UMMF::UML::MetaModel::Foundation::Core::ModelElement');
    $self->__use('UMMF::UML::MetaModel::Foundation::Core::Relationship');
  }

  $self->UMMF::UML::MetaModel::Foundation::Core::Generalization::___initialize;
  $self->UMMF::UML::MetaModel::Foundation::Core::Element::___initialize;
  $self->UMMF::UML::MetaModel::Foundation::Core::ModelElement::___initialize;
  $self->UMMF::UML::MetaModel::Foundation::Core::Relationship::___initialize;

  $self;
}
      

=head2 C<__create>

Calls all <<create>> Methods for this Classifier and all Generalizations.

See also: C<___create>.

=cut
sub __create
{
  my ($self, @args) = @_;

  # $DB::single = 1;
  $self->UMMF::UML::MetaModel::Foundation::Core::Generalization::___create(@args);
  $self->UMMF::UML::MetaModel::Foundation::Core::Element::___create();
  $self->UMMF::UML::MetaModel::Foundation::Core::ModelElement::___create();
  $self->UMMF::UML::MetaModel::Foundation::Core::Relationship::___create();

  $self;
}




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




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


=for html <hr/>

=cut

#################################################################
# AssociationEnd generalization <---> child
# type = UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement
# multiplicity = 1
# ordering = 

=head2 C<child>

  my $val = $obj->child;

Returns the AssociationEnd C<child> value of type L<UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement|UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement>.

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


=head2 C<set_child>

  $obj->set_child($val);

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

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

    if ( defined $val ) { $self->__use('UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement')->__typecheck($val, "UMMF::UML::MetaModel::Foundation::Core::Generalization.child") }

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

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

    }
		  
  $self;
}


=head2 C<add_child>

  $obj->add_child($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 C<remove_child>

  $obj->remove_child($val);

Removes the AssociationEnd C<child> value C<$val>.
Returns C<$obj>.

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

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

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

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

  
  }
}


=head2 C<clear_child>

  $obj->clear_child;

Clears the AssociationEnd C<child> links to L<UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement|UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement>.
Returns C<$obj>.

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

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

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

    }

  $self;
}


=head2 C<count_child>

  $obj->count_child;

Returns the number of elements of type L<UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement|UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement> associated with C<child>.

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

  my $x = $self->{'child'};

  defined $x ? 1 : 0;
}




=for html <hr/>

=cut

#################################################################
# AssociationEnd specialization <---> parent
# type = UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement
# multiplicity = 1
# ordering = 

=head2 C<parent>

  my $val = $obj->parent;

Returns the AssociationEnd C<parent> value of type L<UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement|UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement>.

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


=head2 C<set_parent>

  $obj->set_parent($val);

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

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

    if ( defined $val ) { $self->__use('UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement')->__typecheck($val, "UMMF::UML::MetaModel::Foundation::Core::Generalization.parent") }

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

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

    }
		  
  $self;
}


=head2 C<add_parent>

  $obj->add_parent($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 C<remove_parent>

  $obj->remove_parent($val);

Removes the AssociationEnd C<parent> value C<$val>.
Returns C<$obj>.

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

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

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

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

  
  }
}


=head2 C<clear_parent>

  $obj->clear_parent;

Clears the AssociationEnd C<parent> links to L<UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement|UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement>.
Returns C<$obj>.

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

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

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

    }

  $self;
}


=head2 C<count_parent>

  $obj->count_parent;

Returns the number of elements of type L<UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement|UMMF::UML::MetaModel::Foundation::Core::GeneralizableElement> associated with C<parent>.

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

  my $x = $self->{'parent'};

  defined $x ? 1 : 0;
}




=for html <hr/>

=cut

#################################################################
# AssociationEnd powertypeRange <---> powertype
# type = UMMF::UML::MetaModel::Foundation::Core::Classifier
# multiplicity = 0..1
# ordering = 

=head2 C<powertype>

  my $val = $obj->powertype;

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

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


=head2 C<set_powertype>

  $obj->set_powertype($val);

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

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

    if ( defined $val ) { $self->__use('UMMF::UML::MetaModel::Foundation::Core::Classifier')->__typecheck($val, "UMMF::UML::MetaModel::Foundation::Core::Generalization.powertype") }

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

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

    }
		  
  $self;
}


=head2 C<add_powertype>

  $obj->add_powertype($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 C<remove_powertype>

  $obj->remove_powertype($val);

Removes the AssociationEnd C<powertype> value C<$val>.
Returns C<$obj>.

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

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

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

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

  
  }
}


=head2 C<clear_powertype>

  $obj->clear_powertype;

Clears the AssociationEnd C<powertype> links to L<UMMF::UML::MetaModel::Foundation::Core::Classifier|UMMF::UML::MetaModel::Foundation::Core::Classifier>.
Returns C<$obj>.

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

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

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

    }

  $self;
}


=head2 C<count_powertype>

  $obj->count_powertype;

Returns the number of elements of type L<UMMF::UML::MetaModel::Foundation::Core::Classifier|UMMF::UML::MetaModel::Foundation::Core::Classifier> associated with C<powertype>.

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

  my $x = $self->{'powertype'};

  defined $x ? 1 : 0;
}







# End of Class Generalization


=pod

=for html <hr/>

I<END OF DOCUMENT>

=cut

############################################################################

1; # is true!

############################################################################

### Keep these comments at end of file: kstephens@users.sourceforge.net 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: ###

