# -*- 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::Behavioral_Elements::Common_Behavior::Procedure;

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


);

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

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





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


=head2 __validate_type

  UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure->__validate_type($value);

Returns true if $value is a valid value of UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.

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

  no warnings;

  UNIVERSAL::isa($x, 'UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure')  ;
}


=head2 __typecheck

  UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure->__typecheck($value, $msg);

Calls C<confess()> with C<$msg> if C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure-E<GT>__validate_type($value)> is false.

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

  confess("typecheck: $msg: type 'UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure': value '$x'")
    unless __validate_type($self, $x);
}


=head2 isaProcedure

Returns true if receiver is a C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure>.
Other receivers will return false.

=cut
sub isaProcedure { 1 }


=head2 isaBehavioral_Elements__Common_Behavior__Procedure

Returns true if receiver is a C<UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure>.
Other receivers will return false.
This is the fully qualified version of the C<isaProcedure> method.

=cut
sub isaBehavioral_Elements__Common_Behavior__Procedure { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

=cut
sub __model_name { 'Behavioral_Elements::Common_Behavior::Procedure' }




  


  


  



# ASSOC: procedure

  

# ASSOC: procedure

  

# ASSOC: dispatchAction
# ASSOC: effect
# ASSOC: entry
# ASSOC: exit
# ASSOC: doActivity

#################################################################
# 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 language
  if ( exists $self->{'language'} ) {
    my $x = $self->{'language'};
    $self->{'language'} = undef;
    $self->set_language($x);
  } else {
      }
  
    # Attribute body
  if ( exists $self->{'body'} ) {
    my $x = $self->{'body'};
    $self->{'body'} = undef;
    $self->set_body($x);
  } else {
      }
  
    # Attribute isList
  if ( exists $self->{'isList'} ) {
    my $x = $self->{'isList'};
    $self->{'isList'} = undef;
    $self->set_isList($x);
  } else {
      }
  


  # Associations

  # AssociationEnd 
  #  procedure 0..1
  #  <--> 
  #  expression 0..* UML::MetaModel::Foundation::Data_Types::Expression.
    if ( defined $self->{'expression'} && @{$self->{'expression'}} ) {
    my $x = $self->{'expression'};
    $self->{'expression'} = [ ];
    $self->set_expression(@$x);
  }
  
  # AssociationEnd 
  #  procedure 0..1
  #  <--> 
  #  method 0..* UML::MetaModel::Foundation::Core::Method.
    if ( defined $self->{'method'} && @{$self->{'method'}} ) {
    my $x = $self->{'method'};
    $self->{'method'} = [ ];
    $self->set_method(@$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->UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;

  $self;
}
      

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



#################################################################
# Attribute language
# type = UML::MetaModel::Foundation::Data_Types::Name
# multiplicity = 1

=head2 language

  my $val = $obj->language;

Returns the value of Attribute language.

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

  $self->{'language'};
}


=head2 set_language

  $obj->set_language($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Name')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.language");

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

  $self
}

#################################################################
# Attribute body
# type = UML::MetaModel::Foundation::Data_Types::String
# multiplicity = 1

=head2 body

  my $val = $obj->body;

Returns the value of Attribute body.

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

  $self->{'body'};
}


=head2 set_body

  $obj->set_body($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::String')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.body");

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

  $self
}

#################################################################
# Attribute isList
# type = UML::MetaModel::Foundation::Data_Types::Boolean
# multiplicity = 1

=head2 isList

  my $val = $obj->isList;

Returns the value of Attribute isList.

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

  $self->{'isList'};
}


=head2 set_isList

  $obj->set_isList($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Boolean')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.isList");

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

  $self
}


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


#################################################################
# AssociationEnd procedure => expression
# type = UML::MetaModel::Foundation::Data_Types::Expression
# multiplicity = 0..*

=head2 expression

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

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


=head2 set_expression

  $obj->set_expression(@val);

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

=cut
sub set_expression ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_expression;
  $self->add_expression(@val);
}


=head2 add_expression

  $obj->add_expression(@val);

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

=cut
sub add_expression ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'expression'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Foundation::Data_Types::Expression')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.expression");

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

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

  
  }
  
  $self;
}


=head2 remove_expression

  $obj->remove_expression($val);

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

=cut
sub remove_expression ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'expression'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Data_Types::Expression')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.expression");

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

    # Remove associations with other ends.

        
    $old->remove_procedure($self) if $old;
    $val->add_procedure($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_expression

  $obj->clear_expression;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_procedure($self) if $old;
    $val->add_procedure($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd procedure => method
# type = UML::MetaModel::Foundation::Core::Method
# multiplicity = 0..*

=head2 method

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

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


=head2 set_method

  $obj->set_method(@val);

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

=cut
sub set_method ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_method;
  $self->add_method(@val);
}


=head2 add_method

  $obj->add_method(@val);

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

=cut
sub add_method ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'method'} ||= [ ];
  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::Method')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.method");

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

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

  
  }
  
  $self;
}


=head2 remove_method

  $obj->remove_method($val);

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

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

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

    # Remove associations with other ends.

        
    $old->remove_procedure($self) if $old;
    $val->add_procedure($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_method

  $obj->clear_method;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

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

