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

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

=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::ModelElement|UMMF::UML::MetaModel::Foundation::Core::ModelElement>




=head1 ATTRIBUTES


=head2 C<body> : UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression 


=over 4

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

=item type = L<UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression|UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression>

=item visibility = C<private>

=item multiplicity = C<1>

=item changeability = C<changeable>

=item targetScope = C<instance>

=item ordering = C<unordered>

=item initialValue = I<UNSPECIFIED>

=item container_type = C<Set::Object>

=back



=head1 ASSOCIATIONS


=head2 C<0..*> : C<constraint> E<lt>---E<gt>  C<constrainedElement> : UMMF::UML::MetaModel::Foundation::Core::ModelElement 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::ModelElement|UMMF::UML::MetaModel::Foundation::Core::ModelElement>

=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


=head2 C<0..*> : C<stereotypeConstraint> E<lt>---E<gt>  C<constrainedStereotype> : UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype 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::Extension_Mechanisms::Stereotype|UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype>

=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::ModelElement



);


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

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





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


=head2 C<__validate_type>

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

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

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

  no warnings;

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


=head2 C<__typecheck>

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

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

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

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


=head2 C<isaConstraint>


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

=cut
sub isaConstraint { 1 }


=head2 C<isaFoundation__Core__Constraint>


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

=cut
sub isaFoundation__Core__Constraint { 1 }


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

=head2 C<__model_name> 

  my $name = $obj_or_package->__model_name;

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

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



=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::Constraint' =>
     {
       'table' => 'Foundation__Core__Constraint',
       'abstract' => 0,
       'slots' => 
       { 
	 # Attributes
	 	       'body'
       => {
	 'type_impl' => 'ref',
         'class' => 'UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression',

                                             'col' => 'body', 

                                                                                                                   }
      ,
         
	 # Associations
	 	 	       'constrainedElement'
       => {
	 'type_impl' => 'ref',
         'class' => 'UMMF::UML::MetaModel::Foundation::Core::ModelElement',

                  'null' => '1', 

                                    'col' => 'constrainedElement', 

                                                                                                                   }
      ,
                  	 	       'constrainedStereotype'
       => {
	 'type_impl' => 'ref',
         'class' => 'UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype',

                  'null' => '1', 

                                    'col' => 'constrainedStereotype', 

                                                                                                                   }
      ,
                         },
       'bases' => [  'UMMF::UML::MetaModel::Foundation::Core::ModelElement',  ],
       '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

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


  # Associations

  # AssociationEnd 
  #  constraint 0..*
  #  <--> 
  #  constrainedElement 0..1 UMMF::UML::MetaModel::Foundation::Core::ModelElement.
    if ( defined $self->{'constrainedElement'} ) {
    my $x = $self->{'constrainedElement'};
    $self->{'constrainedElement'} = undef;
    $self->set_constrainedElement($x);
  }
  
  # AssociationEnd 
  #  stereotypeConstraint 0..*
  #  <--> 
  #  constrainedStereotype 0..1 UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype.
    if ( defined $self->{'constrainedStereotype'} ) {
    my $x = $self->{'constrainedStereotype'};
    $self->{'constrainedStereotype'} = undef;
    $self->set_constrainedStereotype($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->UMMF::UML::MetaModel::Foundation::Core::Constraint::___initialize;
  $self->UMMF::UML::MetaModel::Foundation::Core::Element::___initialize;
  $self->UMMF::UML::MetaModel::Foundation::Core::ModelElement::___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::Constraint::___create(@args);
  $self->UMMF::UML::MetaModel::Foundation::Core::Element::___create();
  $self->UMMF::UML::MetaModel::Foundation::Core::ModelElement::___create();

  $self;
}




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



=for html <hr/>

=cut

#################################################################
# Attribute body
# type = UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression
# multiplicity = 1
# ordering = unordered
# ownerScope = instance
# initialValue = 

=head2 C<body>

  my $val = $obj->body;

Returns the L<UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression|UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression> value of Attribute C<body>.

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

  ;

  my $val = $self->{'body'};

  ;

  $val;
}


=head2 C<set_body>

  $obj->set_body($val);

Sets the value of Attribute C<body>.
C<$val> must be of type L<UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression|UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression> or C<undef>.
Returns C<$obj>.

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

  ;

  if ( defined $val ) {
    $self->__use('UMMF::UML::MetaModel::Foundation::Data_Types::BooleanExpression')->__typecheck($val, "UMMF::UML::MetaModel::Foundation::Core::Constraint.body");
  }

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

  ;

  $self;
}


=head2 C<count_body>

  $obj->count_body;

Returns the number of elements (0 or 1) in C<body>.

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

  ;

  my $val = $self->{'body'};

  ;

  defined $val ? 1 : 0;
}




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


=for html <hr/>

=cut

#################################################################
# AssociationEnd constraint <---> constrainedElement
# type = UMMF::UML::MetaModel::Foundation::Core::ModelElement
# multiplicity = 0..1
# ordering = 

=head2 C<constrainedElement>

  my $val = $obj->constrainedElement;

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

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


=head2 C<set_constrainedElement>

  $obj->set_constrainedElement($val);

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

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

    if ( defined $val ) { $self->__use('UMMF::UML::MetaModel::Foundation::Core::ModelElement')->__typecheck($val, "UMMF::UML::MetaModel::Foundation::Core::Constraint.constrainedElement") }

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

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

    }
		  
  $self;
}


=head2 C<add_constrainedElement>

  $obj->add_constrainedElement($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 C<remove_constrainedElement>

  $obj->remove_constrainedElement($val);

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

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

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

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

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

  
  }
}


=head2 C<clear_constrainedElement>

  $obj->clear_constrainedElement;

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

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

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

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

    }

  $self;
}


=head2 C<count_constrainedElement>

  $obj->count_constrainedElement;

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

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

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

  defined $x ? 1 : 0;
}




=for html <hr/>

=cut

#################################################################
# AssociationEnd stereotypeConstraint <---> constrainedStereotype
# type = UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype
# multiplicity = 0..1
# ordering = 

=head2 C<constrainedStereotype>

  my $val = $obj->constrainedStereotype;

Returns the AssociationEnd C<constrainedStereotype> value of type L<UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype|UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype>.

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


=head2 C<set_constrainedStereotype>

  $obj->set_constrainedStereotype($val);

Sets the AssociationEnd C<constrainedStereotype> value.
C<$val> must of type L<UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype|UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype>.
Returns C<$obj>.

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

    if ( defined $val ) { $self->__use('UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype')->__typecheck($val, "UMMF::UML::MetaModel::Foundation::Core::Constraint.constrainedStereotype") }

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

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

    }
		  
  $self;
}


=head2 C<add_constrainedStereotype>

  $obj->add_constrainedStereotype($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 C<remove_constrainedStereotype>

  $obj->remove_constrainedStereotype($val);

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

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

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

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

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

  
  }
}


=head2 C<clear_constrainedStereotype>

  $obj->clear_constrainedStereotype;

Clears the AssociationEnd C<constrainedStereotype> links to L<UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype|UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype>.
Returns C<$obj>.

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

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

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

    }

  $self;
}


=head2 C<count_constrainedStereotype>

  $obj->count_constrainedStereotype;

Returns the number of elements of type L<UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype|UMMF::UML::MetaModel::Foundation::Extension_Mechanisms::Stereotype> associated with C<constrainedStereotype>.

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

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

  defined $x ? 1 : 0;
}







# End of Class Constraint


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

