# -*- 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::Actions::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::__ObjectBase

);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaProcedure

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

=cut
sub isaProcedure { 1 }


=head2 isaBehavioral_Elements__Actions__Procedure

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

=cut
sub isaBehavioral_Elements__Actions__Procedure { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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




  


  


  



# ASSOC: 

  

# ASSOC: procedure

  

# ASSOC: procedure

  


#################################################################
# 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 
  #   0..1
  #  <--> 
  #  action 1 UML::MetaModel::Behavioral_Elements::Actions::Action.
    if ( defined $self->{'action'} ) {
    my $x = $self->{'action'};
    $self->{'action'} = undef;
    $self->set_action($x);
  }
  
  # AssociationEnd 
  #  procedure 0..1
  #  <--> 
  #  argument 0..* UML::MetaModel::Behavioral_Elements::Actions::OutputPin.
    if ( defined $self->{'argument'} && @{$self->{'argument'}} ) {
    my $x = $self->{'argument'};
    $self->{'argument'} = [ ];
    $self->set_argument(@$x);
  }
  
  # AssociationEnd 
  #  procedure 0..1
  #  <--> 
  #  result 0..* UML::MetaModel::Behavioral_Elements::Actions::InputPin.
    if ( defined $self->{'result'} && @{$self->{'result'}} ) {
    my $x = $self->{'result'};
    $self->{'result'} = [ ];
    $self->set_result(@$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->UML::MetaModel::Behavioral_Elements::Actions::Procedure::__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::Actions::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::Actions::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::Actions::Procedure.isList");

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

  $self
}


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


#################################################################
# AssociationEnd  => action
# type = UML::MetaModel::Behavioral_Elements::Actions::Action
# multiplicity = 1

=head2 action

  my $val = $obj->action;

Returns the AssociationEnd value of type C<UML::MetaModel::Behavioral_Elements::Actions::Action>.

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


=head2 set_action

  $obj->set_action($val);

Sets the AssociationEnd value.
C<$val> must of of type C<UML::MetaModel::Behavioral_Elements::Actions::Action>.
Returns C<$obj>.

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Actions::Action')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Actions::Procedure.action");

    $self->{'action'} = $val;                 # Recursion lock
    # Remove and add associations with other ends.
          }
		  
  $self;
}


=head2 add_action

  $obj->add_action($val);

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

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

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

  my $old;
  if ( ($old = $self->{'action'}) ne $val ) { # Recursion lock
    $self->__use('UML::MetaModel::Behavioral_Elements::Actions::Action')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Actions::Procedure.action");
      
    # confess("UML::MetaModel::Behavioral_Elements::Actions::Procedure::action: too many")
    # if defined $self->{'action'};

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_action

  $obj->remove_action($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_action

  $obj->clear_action;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}




#################################################################
# AssociationEnd procedure => argument
# type = UML::MetaModel::Behavioral_Elements::Actions::OutputPin
# multiplicity = 0..*

=head2 argument

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

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


=head2 set_argument

  $obj->set_argument(@val);

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

=cut
sub set_argument ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_argument;
  $self->add_argument(@val);
}


=head2 add_argument

  $obj->add_argument(@val);

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

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

    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_argument

  $obj->remove_argument($val);

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

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

    @$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_argument

  $obj->clear_argument;

Clears the Association.
Returns C<$obj>.

=cut
sub clear_argument ($) 
{
  my ($self) = @_;
  
  my $x = $self->{'argument'} ||= [ ];
  my $val; # Place holder for other MACRO.
  
  $self->{'argument'} = [ ];  # 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 => result
# type = UML::MetaModel::Behavioral_Elements::Actions::InputPin
# multiplicity = 0..*

=head2 result

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

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


=head2 set_result

  $obj->set_result(@val);

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

=cut
sub set_result ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_result;
  $self->add_result(@val);
}


=head2 add_result

  $obj->add_result(@val);

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

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

    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_result

  $obj->remove_result($val);

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

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

    @$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_result

  $obj->clear_result;

Clears the Association.
Returns C<$obj>.

=cut
sub clear_result ($) 
{
  my ($self) = @_;
  
  my $x = $self->{'result'} ||= [ ];
  my $val; # Place holder for other MACRO.
  
  $self->{'result'} = [ ];  # 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: ###

