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

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


);

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

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





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


=head2 __validate_type

  UML::MetaModel::Behavioral_Elements::Use_Cases::Extend->__validate_type($value);

Returns true if $value is a valid value of UML::MetaModel::Behavioral_Elements::Use_Cases::Extend.

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

  no warnings;

  UNIVERSAL::isa($x, 'UML::MetaModel::Behavioral_Elements::Use_Cases::Extend')  ;
}


=head2 __typecheck

  UML::MetaModel::Behavioral_Elements::Use_Cases::Extend->__typecheck($value, $msg);

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

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

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


=head2 isaExtend

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

=cut
sub isaExtend { 1 }


=head2 isaBehavioral_Elements__Use_Cases__Extend

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

=cut
sub isaBehavioral_Elements__Use_Cases__Extend { 1 }


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

=head2 __model_name 

  my $name = $obj_or_package->__model_name;

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

=cut
sub __model_name { 'Behavioral_Elements::Use_Cases::Extend' }




  



# ASSOC: extended

  

# ASSOC: 

  

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


  # Associations

  # AssociationEnd 
  #  extended 0..*
  #  <--> 
  #  extension 1 UML::MetaModel::Behavioral_Elements::Use_Cases::UseCase.
    if ( defined $self->{'extension'} ) {
    my $x = $self->{'extension'};
    $self->{'extension'} = undef;
    $self->set_extension($x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  base 1 UML::MetaModel::Behavioral_Elements::Use_Cases::UseCase.
    if ( defined $self->{'base'} ) {
    my $x = $self->{'base'};
    $self->{'base'} = undef;
    $self->set_base($x);
  }
  
  # AssociationEnd 
  #   0..*
  #  <--> 
  #  extensionPoint 1..* UML::MetaModel::Behavioral_Elements::Use_Cases::ExtensionPoint.
    if ( defined $self->{'extensionPoint'} && @{$self->{'extensionPoint'}} ) {
    my $x = $self->{'extensionPoint'};
    $self->{'extensionPoint'} = [ ];
    $self->set_extensionPoint(@$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::Relationship');
  }

  $self->UML::MetaModel::Behavioral_Elements::Use_Cases::Extend::__initialize;
  $self->UML::MetaModel::Foundation::Core::Element::__initialize;
  $self->UML::MetaModel::Foundation::Core::ModelElement::__initialize;
  $self->UML::MetaModel::Foundation::Core::Relationship::__initialize;

  $self;
}
      

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



#################################################################
# Attribute condition
# type = UML::MetaModel::Foundation::Data_Types::BooleanExpression
# multiplicity = 1

=head2 condition

  my $val = $obj->condition;

Returns the value of Attribute condition.

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

  $self->{'condition'};
}


=head2 set_condition

  $obj->set_condition($val);

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

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

  $self->__use('UML::MetaModel::Foundation::Data_Types::BooleanExpression')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Use_Cases::Extend.condition");

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

  $self
}


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


#################################################################
# AssociationEnd extended => extension
# type = UML::MetaModel::Behavioral_Elements::Use_Cases::UseCase
# multiplicity = 1

=head2 extension

  my $val = $obj->extension;

Returns the AssociationEnd value of type C<UML::MetaModel::Behavioral_Elements::Use_Cases::UseCase>.

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


=head2 set_extension

  $obj->set_extension($val);

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

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Use_Cases::UseCase')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Use_Cases::Extend.extension");

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

    }
		  
  $self;
}


=head2 add_extension

  $obj->add_extension($val);

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

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

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

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

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

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

  
  }

  $self;
}


=head2 remove_extension

  $obj->remove_extension($val);

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

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

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

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

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

  
  }
}


=head2 clear_extension

  $obj->clear_extension;

Clears the Association.
Returns C<$obj>.

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

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

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

  
  }

  $self;
}




#################################################################
# AssociationEnd  => base
# type = UML::MetaModel::Behavioral_Elements::Use_Cases::UseCase
# multiplicity = 1

=head2 base

  my $val = $obj->base;

Returns the AssociationEnd value of type C<UML::MetaModel::Behavioral_Elements::Use_Cases::UseCase>.

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


=head2 set_base

  $obj->set_base($val);

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

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

    $self->__use('UML::MetaModel::Behavioral_Elements::Use_Cases::UseCase')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Use_Cases::Extend.base");

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


=head2 add_base

  $obj->add_base($val);

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

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

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

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}


=head2 remove_base

  $obj->remove_base($val);

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

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

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

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

    # Remove and add associations with other ends.
        
  }
}


=head2 clear_base

  $obj->clear_base;

Clears the Association.
Returns C<$obj>.

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

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

    # Remove and add associations with other ends.
        
  }

  $self;
}




#################################################################
# AssociationEnd  => extensionPoint
# type = UML::MetaModel::Behavioral_Elements::Use_Cases::ExtensionPoint
# multiplicity = 1..*

=head2 extensionPoint

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

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


=head2 set_extensionPoint

  $obj->set_extensionPoint(@val);

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

=cut
sub set_extensionPoint ($@)
{
  my ($self, @val) = @_;
  
  $self->clear_extensionPoint;
  $self->add_extensionPoint(@val);
}


=head2 add_extensionPoint

  $obj->add_extensionPoint(@val);

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

=cut
sub add_extensionPoint ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'extensionPoint'} ||= [ ];
  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::Use_Cases::ExtensionPoint')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Use_Cases::Extend.extensionPoint");

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

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


=head2 remove_extensionPoint

  $obj->remove_extensionPoint($val);

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

=cut
sub remove_extensionPoint ($@)
{
  my ($self, @val) = @_;
  
  my $x = $self->{'extensionPoint'} ||= [ ];
  
  for my $old ( @val ) {
    next unless grep($_ eq $old, @$x); # Recursion lock
    my $val = $old;
      
    $self->__use('UML::MetaModel::Behavioral_Elements::Use_Cases::ExtensionPoint')->__typecheck($val, "UML::MetaModel::Behavioral_Elements::Use_Cases::Extend.extensionPoint");

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

    # Remove associations with other ends.

        ;

  }
  
  $self;
}


=head2 clear_extensionPoint

  $obj->clear_extensionPoint;

Clears the Association.
Returns C<$obj>.

=cut
sub clear_extensionPoint ($) 
{
  my ($self) = @_;
  
  my $x = $self->{'extensionPoint'} ||= [ ];
  my $val; # Place holder for other MACRO.
  
  $self->{'extensionPoint'} = [ ];  # 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: ###

