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

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaControlFlow

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

=cut
sub isaControlFlow { 1 }


=head2 isaBehavioral_Elements__Actions__ControlFlow

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

=cut
sub isaBehavioral_Elements__Actions__ControlFlow { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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





# ASSOC: consequent

  

# ASSOC: antecedent

  


#################################################################
# 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 
  #  consequent 0..*
  #  <--> 
  #  predecessor 1 UML::MetaModel::Behavioral_Elements::Actions::Action.
    if ( defined $self->{'predecessor'} ) {
    my $x = $self->{'predecessor'};
    $self->{'predecessor'} = undef;
    $self->set_predecessor($x);
  }
  
  # AssociationEnd 
  #  antecedent 0..*
  #  <--> 
  #  successor 1 UML::MetaModel::Behavioral_Elements::Actions::Action.
    if ( defined $self->{'successor'} ) {
    my $x = $self->{'successor'};
    $self->{'successor'} = undef;
    $self->set_successor($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::ControlFlow::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;

  $self;
}
      

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




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


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

=head2 predecessor

  my $val = $obj->predecessor;

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

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


=head2 set_predecessor

  $obj->set_predecessor($val);

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

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

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

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

    }
		  
  $self;
}


=head2 add_predecessor

  $obj->add_predecessor($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_predecessor ($$)
{
  my ($self, $val) = @_;

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

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

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

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

  
  }

  $self;
}


=head2 remove_predecessor

  $obj->remove_predecessor($val);

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

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

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

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

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

  
  }
}


=head2 clear_predecessor

  $obj->clear_predecessor;

Clears the Association.
Returns C<$obj>.

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

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

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

  
  }

  $self;
}




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

=head2 successor

  my $val = $obj->successor;

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

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


=head2 set_successor

  $obj->set_successor($val);

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

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

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

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

    }
		  
  $self;
}


=head2 add_successor

  $obj->add_successor($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_successor ($$)
{
  my ($self, $val) = @_;

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

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

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

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

  
  }

  $self;
}


=head2 remove_successor

  $obj->remove_successor($val);

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

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

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

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

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

  
  }
}


=head2 clear_successor

  $obj->clear_successor;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
    $old->remove_antecedent($self) if $old;
    $val->add_antecedent($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: ###

