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

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::Actions::Action->__validate_type($value);

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaAction

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

=cut
sub isaAction { 1 }


=head2 isaBehavioral_Elements__Actions__Action

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

=cut
sub isaBehavioral_Elements__Actions__Action { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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




  



# ASSOC: predecessor

  

# ASSOC: successor

  

# ASSOC: action
# ASSOC: action

  

# ASSOC: action

  


#################################################################
# 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 isReadOnly
  if ( exists $self->{'isReadOnly'} ) {
    my $x = $self->{'isReadOnly'};
    $self->{'isReadOnly'} = undef;
    $self->set_isReadOnly($x);
  } else {
      }
  


  # Associations

  # AssociationEnd 
  #  predecessor 1
  #  <--> 
  #  consequent 0..* UML::MetaModel::Behavioral_Elements::Actions::ControlFlow.
    if ( defined $self->{'consequent'} && @{$self->{'consequent'}} ) {
    my $x = $self->{'consequent'};
    $self->{'consequent'} = [ ];
    $self->set_consequent(@$x);
  }
  
  # AssociationEnd 
  #  successor 1
  #  <--> 
  #  antecedent 0..* UML::MetaModel::Behavioral_Elements::Actions::ControlFlow.
    if ( defined $self->{'antecedent'} && @{$self->{'antecedent'}} ) {
    my $x = $self->{'antecedent'};
    $self->{'antecedent'} = [ ];
    $self->set_antecedent(@$x);
  }
  
  # AssociationEnd 
  #  action 0..1
  #  <--> 
  #  outputPin 0..* UML::MetaModel::Behavioral_Elements::Actions::OutputPin.
    if ( defined $self->{'outputPin'} && @{$self->{'outputPin'}} ) {
    my $x = $self->{'outputPin'};
    $self->{'outputPin'} = [ ];
    $self->set_outputPin(@$x);
  }
  
  # AssociationEnd 
  #  action 0..1
  #  <--> 
  #  inputPin 0..* UML::MetaModel::Behavioral_Elements::Actions::InputPin.
    if ( defined $self->{'inputPin'} && @{$self->{'inputPin'}} ) {
    my $x = $self->{'inputPin'};
    $self->{'inputPin'} = [ ];
    $self->set_inputPin(@$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::Actions::Action::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;

  $self;
}
      

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



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

=head2 isReadOnly

  my $val = $obj->isReadOnly;

Returns the value of Attribute isReadOnly.

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

  $self->{'isReadOnly'};
}


=head2 set_isReadOnly

  $obj->set_isReadOnly($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Boolean')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Actions::Action.isReadOnly");

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

  $self
}


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


#################################################################
# AssociationEnd predecessor => consequent
# type = UML::MetaModel::Behavioral_Elements::Actions::ControlFlow
# multiplicity = 0..*

=head2 consequent

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

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


=head2 set_consequent

  $obj->set_consequent(@val);

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

=cut
sub set_consequent ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_consequent;
  $self->add_consequent(@val);
}


=head2 add_consequent

  $obj->add_consequent(@val);

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

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

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

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

  
  }
  
  $self;
}


=head2 remove_consequent

  $obj->remove_consequent($val);

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

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

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

    # Remove associations with other ends.

        
    $old->remove_predecessor($self) if $old;
    $val->add_predecessor($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_consequent

  $obj->clear_consequent;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_predecessor($self) if $old;
    $val->add_predecessor($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd successor => antecedent
# type = UML::MetaModel::Behavioral_Elements::Actions::ControlFlow
# multiplicity = 0..*

=head2 antecedent

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

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


=head2 set_antecedent

  $obj->set_antecedent(@val);

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

=cut
sub set_antecedent ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_antecedent;
  $self->add_antecedent(@val);
}


=head2 add_antecedent

  $obj->add_antecedent(@val);

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

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

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

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

  
  }
  
  $self;
}


=head2 remove_antecedent

  $obj->remove_antecedent($val);

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

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

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

    # Remove associations with other ends.

        
    $old->remove_successor($self) if $old;
    $val->add_successor($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_antecedent

  $obj->clear_antecedent;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_successor($self) if $old;
    $val->add_successor($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd action => outputPin
# type = UML::MetaModel::Behavioral_Elements::Actions::OutputPin
# multiplicity = 0..*

=head2 outputPin

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

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


=head2 set_outputPin

  $obj->set_outputPin(@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_outputPin ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_outputPin;
  $self->add_outputPin(@val);
}


=head2 add_outputPin

  $obj->add_outputPin(@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_outputPin ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'outputPin'} ||= [ ];
  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::Action.outputPin");

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

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

  
  }
  
  $self;
}


=head2 remove_outputPin

  $obj->remove_outputPin($val);

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

=cut
sub remove_outputPin ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'outputPin'} ||= [ ];
  
  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::Action.outputPin");

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

    # Remove associations with other ends.

        
    $old->remove_action($self) if $old;
    $val->add_action($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_outputPin

  $obj->clear_outputPin;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_action($self) if $old;
    $val->add_action($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd action => inputPin
# type = UML::MetaModel::Behavioral_Elements::Actions::InputPin
# multiplicity = 0..*

=head2 inputPin

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

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


=head2 set_inputPin

  $obj->set_inputPin(@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_inputPin ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_inputPin;
  $self->add_inputPin(@val);
}


=head2 add_inputPin

  $obj->add_inputPin(@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_inputPin ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'inputPin'} ||= [ ];
  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::Action.inputPin");

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

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

  
  }
  
  $self;
}


=head2 remove_inputPin

  $obj->remove_inputPin($val);

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

=cut
sub remove_inputPin ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'inputPin'} ||= [ ];
  
  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::Action.inputPin");

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

    # Remove associations with other ends.

        
    $old->remove_action($self) if $old;
    $val->add_action($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_inputPin

  $obj->clear_inputPin;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

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

