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

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::State_Machines::StateVertex


);

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

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





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


=head2 __validate_type

  UML::MetaModel::Behavioral_Elements::State_Machines::State->__validate_type($value);

Returns true if $value is a valid value of UML::MetaModel::Behavioral_Elements::State_Machines::State.

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

  no warnings;

  UNIVERSAL::isa($x, 'UML::MetaModel::Behavioral_Elements::State_Machines::State')  ;
}


=head2 __typecheck

  UML::MetaModel::Behavioral_Elements::State_Machines::State->__typecheck($value, $msg);

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

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

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


=head2 isaState

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

=cut
sub isaState { 1 }


=head2 isaBehavioral_Elements__State_Machines__State

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

=cut
sub isaBehavioral_Elements__State_Machines__State { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

=cut
sub __model_name { 'Behavioral_Elements::State_Machines::State' }





# ASSOC: top
# ASSOC: 

  

# ASSOC: 

  

# ASSOC: 

  

# ASSOC: 

  

# ASSOC: 

  

# ASSOC: inState

#################################################################
# 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 
  #   0..1
  #  <--> 
  #  internalTransition 0..* UML::MetaModel::Behavioral_Elements::State_Machines::Transition.
    if ( defined $self->{'internalTransition'} && @{$self->{'internalTransition'}} ) {
    my $x = $self->{'internalTransition'};
    $self->{'internalTransition'} = [ ];
    $self->set_internalTransition(@$x);
  }
  
  # AssociationEnd 
  #   0..1
  #  <--> 
  #  entry 0..1 UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.
    if ( defined $self->{'entry'} ) {
    my $x = $self->{'entry'};
    $self->{'entry'} = undef;
    $self->set_entry($x);
  }
  
  # AssociationEnd 
  #   0..1
  #  <--> 
  #  exit 0..1 UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.
    if ( defined $self->{'exit'} ) {
    my $x = $self->{'exit'};
    $self->{'exit'} = undef;
    $self->set_exit($x);
  }
  
  # AssociationEnd 
  #   0..1
  #  <--> 
  #  doActivity 0..1 UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure.
    if ( defined $self->{'doActivity'} ) {
    my $x = $self->{'doActivity'};
    $self->{'doActivity'} = undef;
    $self->set_doActivity($x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  deferrableEvent 0..* UML::MetaModel::Behavioral_Elements::State_Machines::Event.
    if ( defined $self->{'deferrableEvent'} && @{$self->{'deferrableEvent'}} ) {
    my $x = $self->{'deferrableEvent'};
    $self->{'deferrableEvent'} = [ ];
    $self->set_deferrableEvent(@$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::State_Machines::StateVertex');
  }

  $self->UML::MetaModel::Behavioral_Elements::State_Machines::State::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Behavioral_Elements::State_Machines::StateVertex::__initialize;

  $self;
}
      

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




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


#################################################################
# AssociationEnd  => internalTransition
# type = UML::MetaModel::Behavioral_Elements::State_Machines::Transition
# multiplicity = 0..*

=head2 internalTransition

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

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


=head2 set_internalTransition

  $obj->set_internalTransition(@val);

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

=cut
sub set_internalTransition ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_internalTransition;
  $self->add_internalTransition(@val);
}


=head2 add_internalTransition

  $obj->add_internalTransition(@val);

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

=cut
sub add_internalTransition ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'internalTransition'} ||= [ ];
  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::State_Machines::Transition')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::State_Machines::State.internalTransition");

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

    # Remove and add associations with other ends.
        
  }
  
  $self;
}


=head2 remove_internalTransition

  $obj->remove_internalTransition($val);

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

=cut
sub remove_internalTransition ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'internalTransition'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Behavioral_Elements::State_Machines::Transition')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::State_Machines::State.internalTransition");

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_internalTransition

  $obj->clear_internalTransition;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


#################################################################
# AssociationEnd  => entry
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure
# multiplicity = 0..1

=head2 entry

  my $val = $obj->entry;

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

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


=head2 set_entry

  $obj->set_entry($val);

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

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::State_Machines::State.entry");

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


=head2 add_entry

  $obj->add_entry($val);

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

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

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

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_entry

  $obj->remove_entry($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_entry

  $obj->clear_entry;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}




#################################################################
# AssociationEnd  => exit
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure
# multiplicity = 0..1

=head2 exit

  my $val = $obj->exit;

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

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


=head2 set_exit

  $obj->set_exit($val);

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

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::State_Machines::State.exit");

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


=head2 add_exit

  $obj->add_exit($val);

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

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

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

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_exit

  $obj->remove_exit($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_exit

  $obj->clear_exit;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}




#################################################################
# AssociationEnd  => doActivity
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure
# multiplicity = 0..1

=head2 doActivity

  my $val = $obj->doActivity;

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

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


=head2 set_doActivity

  $obj->set_doActivity($val);

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

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Procedure')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::State_Machines::State.doActivity");

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


=head2 add_doActivity

  $obj->add_doActivity($val);

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

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

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

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_doActivity

  $obj->remove_doActivity($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_doActivity

  $obj->clear_doActivity;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}




#################################################################
# AssociationEnd  => deferrableEvent
# type = UML::MetaModel::Behavioral_Elements::State_Machines::Event
# multiplicity = 0..*

=head2 deferrableEvent

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

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


=head2 set_deferrableEvent

  $obj->set_deferrableEvent(@val);

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

=cut
sub set_deferrableEvent ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_deferrableEvent;
  $self->add_deferrableEvent(@val);
}


=head2 add_deferrableEvent

  $obj->add_deferrableEvent(@val);

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

=cut
sub add_deferrableEvent ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'deferrableEvent'} ||= [ ];
  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::State_Machines::Event')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::State_Machines::State.deferrableEvent");

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

    # Remove and add associations with other ends.
        
  }
  
  $self;
}


=head2 remove_deferrableEvent

  $obj->remove_deferrableEvent($val);

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

=cut
sub remove_deferrableEvent ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'deferrableEvent'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Behavioral_Elements::State_Machines::Event')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::State_Machines::State.deferrableEvent");

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_deferrableEvent

  $obj->clear_deferrableEvent;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        ;

  }
  
  $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: ###

