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

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


);

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

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





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


=head2 __validate_type

  UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState->__validate_type($value);

Returns true if $value is a valid value of UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState.

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

  no warnings;

  UNIVERSAL::isa($x, 'UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState')  ;
}


=head2 __typecheck

  UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState->__typecheck($value, $msg);

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

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

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


=head2 isaObjectFlowState

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

=cut
sub isaObjectFlowState { 1 }


=head2 isaBehavioral_Elements__Activity_Graphs__ObjectFlowState

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

=cut
sub isaBehavioral_Elements__Activity_Graphs__ObjectFlowState { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

=cut
sub __model_name { 'Behavioral_Elements::Activity_Graphs::ObjectFlowState' }




  



# ASSOC: state

  

# ASSOC: 

  


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


  # Associations

  # AssociationEnd 
  #  state 0..*
  #  <--> 
  #  parameter 0..* UML::MetaModel::Foundation::Core::Parameter.
    if ( defined $self->{'parameter'} && @{$self->{'parameter'}} ) {
    my $x = $self->{'parameter'};
    $self->{'parameter'} = [ ];
    $self->set_parameter(@$x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  type 1 UML::MetaModel::Foundation::Core::Classifier.
    if ( defined $self->{'type'} ) {
    my $x = $self->{'type'};
    $self->{'type'} = undef;
    $self->set_type($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->__use('UML::MetaModel::Behavioral_Elements::State_Machines::State');
    $self->__use('UML::MetaModel::Behavioral_Elements::State_Machines::SimpleState');
  }

  $self->UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState::__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->UML::MetaModel::Behavioral_Elements::State_Machines::State::__initialize;
  $self->UML::MetaModel::Behavioral_Elements::State_Machines::SimpleState::__initialize;

  $self;
}
      

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



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

=head2 isSynch

  my $val = $obj->isSynch;

Returns the value of Attribute isSynch.

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

  $self->{'isSynch'};
}


=head2 set_isSynch

  $obj->set_isSynch($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Boolean')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState.isSynch");

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

  $self
}


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


#################################################################
# AssociationEnd state => parameter
# type = UML::MetaModel::Foundation::Core::Parameter
# multiplicity = 0..*

=head2 parameter

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

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


=head2 set_parameter

  $obj->set_parameter(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Foundation::Core::Parameter>.
Returns C<$obj>.

=cut
sub set_parameter ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_parameter;
  $self->add_parameter(@val);
}


=head2 add_parameter

  $obj->add_parameter(@val);

Sets the AssociationEnd value.
Elements of C<@val> must of of type C<UML::MetaModel::Foundation::Core::Parameter>.
Returns C<$obj>.

=cut
sub add_parameter ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'parameter'} ||= [ ];
  my $old; # Place holder for other MACRO.
  
  for my $val ( @val ) {
    next if grep($_ eq $val, @$x);   # Recursion lock
    $self->__use('UML::MetaModel::Foundation::Core::Parameter')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState.parameter");

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

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

  
  }
  
  $self;
}


=head2 remove_parameter

  $obj->remove_parameter($val);

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

=cut
sub remove_parameter ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'parameter'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Foundation::Core::Parameter')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState.parameter");

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

    # Remove associations with other ends.

        
    $old->remove_state($self) if $old;
    $val->add_state($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_parameter

  $obj->clear_parameter;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

        
    $old->remove_state($self) if $old;
    $val->add_state($self)    if $val;

  ;

  }
  
  $self;
}


#################################################################
# AssociationEnd  => type
# type = UML::MetaModel::Foundation::Core::Classifier
# multiplicity = 1

=head2 type

  my $val = $obj->type;

Returns the AssociationEnd value of type C<UML::MetaModel::Foundation::Core::Classifier>.

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


=head2 set_type

  $obj->set_type($val);

Sets the AssociationEnd value.
C<$val> must of of type C<UML::MetaModel::Foundation::Core::Classifier>.
Returns C<$obj>.

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

    $self->__use('UML::MetaModel::Foundation::Core::Classifier')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState.type");

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


=head2 add_type

  $obj->add_type($val);

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

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

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

  my $old;
  if ( ($old = $self->{'type'}) ne $val ) { # Recursion lock
    $self->__use('UML::MetaModel::Foundation::Core::Classifier')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState.type");
      
    # confess("UML::MetaModel::Behavioral_Elements::Activity_Graphs::ObjectFlowState::type: too many")
    # if defined $self->{'type'};

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_type

  $obj->remove_type($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_type

  $obj->clear_type;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add 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: ###

