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

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::Event


);

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

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





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


=head2 __validate_type

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

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

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

  no warnings;

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


=head2 __typecheck

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

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

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

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


=head2 isaSignalEvent

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

=cut
sub isaSignalEvent { 1 }


=head2 isaBehavioral_Elements__State_Machines__SignalEvent

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

=cut
sub isaBehavioral_Elements__State_Machines__SignalEvent { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

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





# ASSOC: occurance

  


#################################################################
# 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 
  #  occurance 0..*
  #  <--> 
  #  signal 1 UML::MetaModel::Behavioral_Elements::Common_Behavior::Signal.
    if ( defined $self->{'signal'} ) {
    my $x = $self->{'signal'};
    $self->{'signal'} = undef;
    $self->set_signal($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::Behavioral_Elements::State_Machines::Event');
  }

  $self->UML::MetaModel::Behavioral_Elements::State_Machines::SignalEvent::__initialize;
  $self->UML::MetaModel::Behavioral_Elements::State_Machines::Event::__initialize;

  $self;
}
      

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




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


#################################################################
# AssociationEnd occurance => signal
# type = UML::MetaModel::Behavioral_Elements::Common_Behavior::Signal
# multiplicity = 1

=head2 signal

  my $val = $obj->signal;

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

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


=head2 set_signal

  $obj->set_signal($val);

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

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Common_Behavior::Signal')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::State_Machines::SignalEvent.signal");

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

    }
		  
  $self;
}


=head2 add_signal

  $obj->add_signal($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 remove_signal

  $obj->remove_signal($val);

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

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

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

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

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

  
  }
}


=head2 clear_signal

  $obj->clear_signal;

Clears the Association.
Returns C<$obj>.

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

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

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

