# -*- 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::Foundation::Core::Operation;

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


);

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

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





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


=head2 __validate_type

  UML::MetaModel::Foundation::Core::Operation->__validate_type($value);

Returns true if $value is a valid value of UML::MetaModel::Foundation::Core::Operation.

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

  no warnings;

  UNIVERSAL::isa($x, 'UML::MetaModel::Foundation::Core::Operation')  ;
}


=head2 __typecheck

  UML::MetaModel::Foundation::Core::Operation->__typecheck($value, $msg);

Calls C<confess()> with C<$msg> if C<UML::MetaModel::Foundation::Core::Operation-E<GT>__validate_type($value)> is false.

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

  confess("typecheck: $msg: type 'UML::MetaModel::Foundation::Core::Operation': value '$x'")
    unless __validate_type($self, $x);
}


=head2 isaOperation

Returns true if receiver is a C<UML::MetaModel::Foundation::Core::Operation>.
Other receivers will return false.

=cut
sub isaOperation { 1 }


=head2 isaFoundation__Core__Operation

Returns true if receiver is a C<UML::MetaModel::Foundation::Core::Operation>.
Other receivers will return false.
This is the fully qualified version of the C<isaOperation> method.

=cut
sub isaFoundation__Core__Operation { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

Returns the UML Model name (C<'Foundation::Core::Operation'>) for an object or package of
this Classifier.

=cut
sub __model_name { 'Foundation::Core::Operation' }




  


  


  


  



# ASSOC: specification
# ASSOC: representedOperation
# ASSOC: representedClassifier
# ASSOC: operation

  


#################################################################
# 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 concurrency
  if ( exists $self->{'concurrency'} ) {
    my $x = $self->{'concurrency'};
    $self->{'concurrency'} = undef;
    $self->set_concurrency($x);
  } else {
      }
  
    # Attribute isRoot
  if ( exists $self->{'isRoot'} ) {
    my $x = $self->{'isRoot'};
    $self->{'isRoot'} = undef;
    $self->set_isRoot($x);
  } else {
      }
  
    # Attribute isLeaf
  if ( exists $self->{'isLeaf'} ) {
    my $x = $self->{'isLeaf'};
    $self->{'isLeaf'} = undef;
    $self->set_isLeaf($x);
  } else {
      }
  
    # Attribute isAbstract
  if ( exists $self->{'isAbstract'} ) {
    my $x = $self->{'isAbstract'};
    $self->{'isAbstract'} = undef;
    $self->set_isAbstract($x);
  } else {
      }
  


  # Associations

  # AssociationEnd 
  #  operation 1
  #  <--> 
  #  occurance 0..* UML::MetaModel::Behavioral_Elements::State_Machines::CallEvent.
    if ( defined $self->{'occurance'} && @{$self->{'occurance'}} ) {
    my $x = $self->{'occurance'};
    $self->{'occurance'} = [ ];
    $self->set_occurance(@$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::Foundation::Core::Feature');
    $self->__use('UML::MetaModel::Foundation::Core::BehavioralFeature');
  }

  $self->UML::MetaModel::Foundation::Core::Operation::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::Feature::__initialize;
  $self->UML::MetaModel::Foundation::Core::BehavioralFeature::__initialize;

  $self;
}
      

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



#################################################################
# Attribute concurrency
# type = UML::MetaModel::Foundation::Data_Types::CallConcurrencyKind
# multiplicity = 1

=head2 concurrency

  my $val = $obj->concurrency;

Returns the value of Attribute concurrency.

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

  $self->{'concurrency'};
}


=head2 set_concurrency

  $obj->set_concurrency($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::CallConcurrencyKind')->__typecheck($val, "UML::MetaModel::Foundation::Core::Operation.concurrency");

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

  $self
}

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

=head2 isRoot

  my $val = $obj->isRoot;

Returns the value of Attribute isRoot.

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

  $self->{'isRoot'};
}


=head2 set_isRoot

  $obj->set_isRoot($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Boolean')->__typecheck($val, "UML::MetaModel::Foundation::Core::Operation.isRoot");

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

  $self
}

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

=head2 isLeaf

  my $val = $obj->isLeaf;

Returns the value of Attribute isLeaf.

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

  $self->{'isLeaf'};
}


=head2 set_isLeaf

  $obj->set_isLeaf($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Boolean')->__typecheck($val, "UML::MetaModel::Foundation::Core::Operation.isLeaf");

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

  $self
}

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

=head2 isAbstract

  my $val = $obj->isAbstract;

Returns the value of Attribute isAbstract.

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

  $self->{'isAbstract'};
}


=head2 set_isAbstract

  $obj->set_isAbstract($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::Boolean')->__typecheck($val, "UML::MetaModel::Foundation::Core::Operation.isAbstract");

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

  $self
}


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


#################################################################
# AssociationEnd operation => occurance
# type = UML::MetaModel::Behavioral_Elements::State_Machines::CallEvent
# multiplicity = 0..*

=head2 occurance

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

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


=head2 set_occurance

  $obj->set_occurance(@val);

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

=cut
sub set_occurance ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_occurance;
  $self->add_occurance(@val);
}


=head2 add_occurance

  $obj->add_occurance(@val);

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

=cut
sub add_occurance ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'occurance'} ||= [ ];
  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::CallEvent')->__typecheck($val, "UML::MetaModel::Foundation::Core::Operation.occurance");

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

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

  
  }
  
  $self;
}


=head2 remove_occurance

  $obj->remove_occurance($val);

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

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

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

    # Remove associations with other ends.

        
    $old->remove_operation($self) if $old;
    $val->add_operation($self)    if $val;

  ;

  }
  
  $self;
}


=head2 clear_occurance

  $obj->clear_occurance;

Clears the Association.
Returns C<$obj>.

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

    # Remove associations with other ends.

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

