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

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::Behavioral_Elements::Actions::Pin


);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaOutputPin

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

=cut
sub isaOutputPin { 1 }


=head2 isaBehavioral_Elements__Actions__OutputPin

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

=cut
sub isaBehavioral_Elements__Actions__OutputPin { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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





# ASSOC: outputPin

  

# ASSOC: argument

  

# ASSOC: source

  


#################################################################
# 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 
  #  outputPin 0..*
  #  <--> 
  #  action 0..1 UML::MetaModel::Behavioral_Elements::Actions::Action.
    if ( defined $self->{'action'} ) {
    my $x = $self->{'action'};
    $self->{'action'} = undef;
    $self->set_action($x);
  }
  
  # AssociationEnd 
  #  argument 0..*
  #  <--> 
  #  procedure 0..1 UML::MetaModel::Behavioral_Elements::Actions::Procedure.
    if ( defined $self->{'procedure'} ) {
    my $x = $self->{'procedure'};
    $self->{'procedure'} = undef;
    $self->set_procedure($x);
  }
  
  # AssociationEnd 
  #  source 1
  #  <--> 
  #  flow 0..* UML::MetaModel::Behavioral_Elements::Actions::DataFlow.
    if ( defined $self->{'flow'} && @{$self->{'flow'}} ) {
    my $x = $self->{'flow'};
    $self->{'flow'} = [ ];
    $self->set_flow(@$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->__use('UML::MetaModel::Behavioral_Elements::Actions::Pin');
  }

  $self->UML::MetaModel::Behavioral_Elements::Actions::OutputPin::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Behavioral_Elements::Actions::Pin::__initialize;

  $self;
}
      

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




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


#################################################################
# AssociationEnd outputPin => action
# type = UML::MetaModel::Behavioral_Elements::Actions::Action
# multiplicity = 0..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::OutputPin.action");

    $self->{'action'} = $val;                 # Recursion lock
    # Remove and add associations with other ends.
        
    $old->remove_outputPin($self) if $old;
    $val->add_outputPin($self)    if $val;

    }
		  
  $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::OutputPin.action");
      
    # confess("UML::MetaModel::Behavioral_Elements::Actions::OutputPin::action: too many")
    # if defined $self->{'action'};

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

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

  
  }

  $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.
        
    $old->remove_outputPin($self) if $old;
    $val->add_outputPin($self)    if $val;

  
  }
}


=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.
        
    $old->remove_outputPin($self) if $old;
    $val->add_outputPin($self)    if $val;

  
  }

  $self;
}




#################################################################
# AssociationEnd argument => procedure
# type = UML::MetaModel::Behavioral_Elements::Actions::Procedure
# multiplicity = 0..1

=head2 procedure

  my $val = $obj->procedure;

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

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


=head2 set_procedure

  $obj->set_procedure($val);

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

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

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

    $self->{'procedure'} = $val;                 # Recursion lock
    # Remove and add associations with other ends.
        
    $old->remove_argument($self) if $old;
    $val->add_argument($self)    if $val;

    }
		  
  $self;
}


=head2 add_procedure

  $obj->add_procedure($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 remove_procedure

  $obj->remove_procedure($val);

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

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

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

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

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

  
  }
}


=head2 clear_procedure

  $obj->clear_procedure;

Clears the Association.
Returns C<$obj>.

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

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

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

  
  }

  $self;
}




#################################################################
# AssociationEnd source => flow
# type = UML::MetaModel::Behavioral_Elements::Actions::DataFlow
# multiplicity = 0..*

=head2 flow

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

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


=head2 set_flow

  $obj->set_flow(@val);

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

=cut
sub set_flow ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_flow;
  $self->add_flow(@val);
}


=head2 add_flow

  $obj->add_flow(@val);

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

=cut
sub add_flow ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'flow'} ||= [ ];
  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::DataFlow')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Actions::OutputPin.flow");

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

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

  
  }
  
  $self;
}


=head2 remove_flow

  $obj->remove_flow($val);

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

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

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

    # Remove associations with other ends.

        
    $old->remove_source($self) if $old;
    $val->add_source($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_flow

  $obj->clear_flow;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

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

