# -*- perl -*- # DO NOT EDIT - This file is generated by UMMF; http://ummf.sourceforge.net # From template: $Id: Perl.txt,v 1.77 2006/05/14 01:40:03 kstephens Exp $ package UMMF::MOF_1_3::Model::AssociationEnd; #use 5.6.1; use strict; use warnings; ################################################################# # Version # our $VERSION = do { my @r = (q{1.3} =~ /\d+/g); sprintf "%d." . "%03d" x $#r, @r }; ################################################################# # Documentation # =head1 NAME UMMF::MOF_1_3::Model::AssociationEnd -- =head1 VERSION 1.3 =head1 SYNOPSIS =head1 DESCRIPTION =head1 USAGE =head1 EXPORT =head1 METATYPE L =head1 SUPERCLASSES L =head1 ATTRIBUTES =head2 C : UMMF::MOF_1_3::Model::Boolean =over 4 =item metatype = L =item type = L =item visibility = C =item multiplicity = C<1> =item changeability = C =item targetScope = C =item ordering = C =item initialValue = I =item container_type = C =back =head2 C : UMMF::MOF_1_3::Model::AggregationKind =over 4 =item metatype = L =item type = L =item visibility = C =item multiplicity = C<1> =item changeability = C =item targetScope = C =item ordering = C =item initialValue = I =item container_type = C =back =head2 C : UMMF::MOF_1_3::Model::MultiplicityType =over 4 =item metatype = L =item type = L =item visibility = C =item multiplicity = C<1> =item changeability = C =item targetScope = C =item ordering = C =item initialValue = I =item container_type = C =back =head2 C : UMMF::MOF_1_3::Model::Boolean =over 4 =item metatype = L =item type = L =item visibility = C =item multiplicity = C<1> =item changeability = C =item targetScope = C =item ordering = C =item initialValue = I =item container_type = C =back =head1 ASSOCIATIONS =head2 C : I C<1> E---E C : UMMF::MOF_1_3::Model::Reference C<0..*> =over 4 =item metatype = L =item type = L =item multiplicity = C<0..*> =item changeability = C =item targetScope = C =item ordering = C<> =item isNavigable = C<1> =item aggregation = C =item visibility = C =item container_type = C =back =head2 C : I C<1> E---E C : UMMF::MOF_1_3::Model::Reference C<0..*> =over 4 =item metatype = L =item type = L =item multiplicity = C<0..*> =item changeability = C =item targetScope = C =item ordering = C<> =item isNavigable = C<1> =item aggregation = C =item visibility = C =item container_type = C =back =head1 METHODS =cut ################################################################# # Dependencies # use Carp qw(croak confess); use Set::Object 1.05; use Class::Multimethods 1.70; use Data::Dumper; use Scalar::Util qw(weaken); use UMMF::MOF_1_3::__ObjectBase qw(:__ummf_array); ################################################################# # Generalizations # use base qw( UMMF::MOF_1_3::Model::TypedElement ); ################################################################# # Exports # our @EXPORT_OK = qw( ); our %EXPORT_TAGS = ( 'all' => \@EXPORT_OK ); ################################################################# # Validation # =head2 C<__validate_type> UMMF::MOF_1_3::Model::AssociationEnd->__validate_type($value); Returns true if C<$value> is a valid representation of L. =cut sub __validate_type($$) { my ($self, $x) = @_; no warnings; UNIVERSAL::isa($x, 'UMMF::MOF_1_3::Model::AssociationEnd') ; } =head2 C<__typecheck> UMMF::MOF_1_3::Model::AssociationEnd->__typecheck($value, $msg); Calls C with C<$msg> if C<__validate_type($value)>> is false. =cut sub __typecheck { my ($self, $x, $msg) = @_; confess("typecheck: $msg: type '" . 'UMMF::MOF_1_3::Model::AssociationEnd' . ": value '$x'") unless __validate_type($self, $x); } =head2 C Returns true if receiver is a L. Other receivers will return false. =cut sub isaAssociationEnd { 1 } =head2 C Returns true if receiver is a L. Other receivers will return false. This is the fully qualified version of the C method. =cut sub isaModel__AssociationEnd { 1 } ################################################################# # Introspection # =head2 C<__model_name> my $name = $obj_or_package->__model_name; Returns the UML Model name (C<'Model::AssociationEnd'>) for an object or package of this Classifier. =cut sub __model_name { 'Model::AssociationEnd' } =head2 C<__isAbstract> $package->__isAbstract; Returns C<0>. =cut sub __isAbstract { 0; } my $__tangram_schema; =head2 C<__tangram_schema> my $tangram_schema $obj_or_package->__tangram_schema Returns a HASH ref that describes this Classifier for Tangram. See L =cut sub __tangram_schema { my ($self) = @_; $__tangram_schema ||= { 'classes' => [ 'UMMF::MOF_1_3::Model::AssociationEnd' => { 'table' => 'Model__AssociationEnd', 'abstract' => 0, 'slots' => { # Attributes 'isNavigable' => { 'type_impl' => 'string', 'col' => 'isNavigable', } , 'aggregation' => { 'type_impl' => 'string', 'col' => 'aggregation', } , 'multiplicity' => { 'type_impl' => 'ref', 'class' => 'UMMF::MOF_1_3::Model::MultiplicityType', 'col' => 'multiplicity', } , 'isChangeable' => { 'type_impl' => 'string', 'col' => 'isChangeable', } , # Associations 'referent' => { 'type_impl' => 'iset', 'class' => 'UMMF::MOF_1_3::Model::Reference', 'table' => 'Model__AssociationEnd__referent', 'coll' => 'referencedEnd', } , 'referrer' => { 'type_impl' => 'iset', 'class' => 'UMMF::MOF_1_3::Model::Reference', 'table' => 'Model__AssociationEnd__referrer', 'coll' => 'exposedEnd', } , }, 'bases' => [ 'UMMF::MOF_1_3::Model::TypedElement', ], 'sql' => { }, }, ], 'sql' => { # Note Tangram::Ref::get_exporter() has # "UPDATE $table SET $self->{col} = $refid WHERE id = $id", # The id_col is hard-coded, # Thus id_col will not work. #'id_col' => '__sid', #'class_col' => '__stype', }, # 'set_id' => sub { } # 'get_id' => sub { } }; } ################################################################# # Class Attributes # ################################################################# # Class Associations # ################################################################# # Initialization # =head2 C<___initialize> Initialize all Attributes and AssociationEnds in a instance of this Classifier. Does B initalize slots in its Generalizations. See also: C<__initialize>. =cut sub ___initialize { my ($self) = @_; # Attributes # Attribute isNavigable if ( exists $self->{'isNavigable'} ) { my $x = $self->{'isNavigable'}; $self->{'isNavigable'} = undef; $self->set_isNavigable($x); } else { } # Attribute aggregation if ( exists $self->{'aggregation'} ) { my $x = $self->{'aggregation'}; $self->{'aggregation'} = undef; $self->set_aggregation($x); } else { } # Attribute multiplicity if ( exists $self->{'multiplicity'} ) { my $x = $self->{'multiplicity'}; $self->{'multiplicity'} = undef; $self->set_multiplicity($x); } else { } # Attribute isChangeable if ( exists $self->{'isChangeable'} ) { my $x = $self->{'isChangeable'}; $self->{'isChangeable'} = undef; $self->set_isChangeable($x); } else { } # Associations # AssociationEnd # referencedEnd 1 # <--> # referent 0..* UMMF::MOF_1_3::Model::Reference. if ( defined $self->{'referent'} ) { my $x = $self->{'referent'}; $self->{'referent'} = Set::Object->new(); $self->set_referent(@$x); } # AssociationEnd # exposedEnd 1 # <--> # referrer 0..* UMMF::MOF_1_3::Model::Reference. if ( defined $self->{'referrer'} ) { my $x = $self->{'referrer'}; $self->{'referrer'} = Set::Object->new(); $self->set_referrer(@$x); } $self; } my $__initialize_use; =head2 C<__initialize> Initialize all slots in this Classifier and all its Generalizations. See also: C<___initialize>. =cut sub __initialize { my ($self) = @_; # $DB::single = 1; unless ( ! $__initialize_use ) { $__initialize_use = 1; $self->__use('UMMF::MOF_1_3::Model::ModelElement'); $self->__use('UMMF::MOF_1_3::Model::TypedElement'); } $self->UMMF::MOF_1_3::Model::AssociationEnd::___initialize; $self->UMMF::MOF_1_3::Model::ModelElement::___initialize; $self->UMMF::MOF_1_3::Model::TypedElement::___initialize; $self; } =head2 C<__create> Calls all <> Methods for this Classifier and all Generalizations. See also: C<___create>. =cut sub __create { my ($self, @args) = @_; # $DB::single = 1; $self->UMMF::MOF_1_3::Model::AssociationEnd::___create(@args); $self->UMMF::MOF_1_3::Model::ModelElement::___create(); $self->UMMF::MOF_1_3::Model::TypedElement::___create(); $self; } ################################################################# # Attributes # =for html
=cut ################################################################# # Attribute isNavigable # type = UMMF::MOF_1_3::Model::Boolean # multiplicity = 1 # ordering = unordered # ownerScope = instance # initialValue = =head2 C my $val = $obj->isNavigable; Returns the L value of Attribute C. =cut sub isNavigable ($) { my ($self) = @_; ; my $val = $self->{'isNavigable'}; ; $val; } =head2 C $obj->set_isNavigable($val); Sets the value of Attribute C. C<$val> must be of type L or C. Returns C<$obj>. =cut sub set_isNavigable ($$) { my ($self, $val) = @_; ; if ( defined $val ) { ; } $self->{'isNavigable'} = $val ; ; $self; } =head2 C $obj->count_isNavigable; Returns the number of elements (0 or 1) in C. =cut sub count_isNavigable ($) { my ($self) = @_; ; my $val = $self->{'isNavigable'}; ; defined $val ? 1 : 0; } =for html
=cut ################################################################# # Attribute aggregation # type = UMMF::MOF_1_3::Model::AggregationKind # multiplicity = 1 # ordering = unordered # ownerScope = instance # initialValue = =head2 C my $val = $obj->aggregation; Returns the L value of Attribute C. =cut sub aggregation ($) { my ($self) = @_; ; my $val = $self->{'aggregation'}; ; $val; } =head2 C $obj->set_aggregation($val); Sets the value of Attribute C. C<$val> must be of type L or C. Returns C<$obj>. =cut sub set_aggregation ($$) { my ($self, $val) = @_; ; if ( defined $val ) { $self->__use('UMMF::MOF_1_3::Model::AggregationKind')->__typecheck($val, "UMMF::MOF_1_3::Model::AssociationEnd.aggregation"); } $self->{'aggregation'} = $val ; ; $self; } =head2 C $obj->count_aggregation; Returns the number of elements (0 or 1) in C. =cut sub count_aggregation ($) { my ($self) = @_; ; my $val = $self->{'aggregation'}; ; defined $val ? 1 : 0; } =for html
=cut ################################################################# # Attribute multiplicity # type = UMMF::MOF_1_3::Model::MultiplicityType # multiplicity = 1 # ordering = unordered # ownerScope = instance # initialValue = =head2 C my $val = $obj->multiplicity; Returns the L value of Attribute C. =cut sub multiplicity ($) { my ($self) = @_; ; my $val = $self->{'multiplicity'}; ; $val; } =head2 C $obj->set_multiplicity($val); Sets the value of Attribute C. C<$val> must be of type L or C. Returns C<$obj>. =cut sub set_multiplicity ($$) { my ($self, $val) = @_; ; if ( defined $val ) { $self->__use('UMMF::MOF_1_3::Model::MultiplicityType')->__typecheck($val, "UMMF::MOF_1_3::Model::AssociationEnd.multiplicity"); } $self->{'multiplicity'} = $val ; ; $self; } =head2 C $obj->count_multiplicity; Returns the number of elements (0 or 1) in C. =cut sub count_multiplicity ($) { my ($self) = @_; ; my $val = $self->{'multiplicity'}; ; defined $val ? 1 : 0; } =for html
=cut ################################################################# # Attribute isChangeable # type = UMMF::MOF_1_3::Model::Boolean # multiplicity = 1 # ordering = unordered # ownerScope = instance # initialValue = =head2 C my $val = $obj->isChangeable; Returns the L value of Attribute C. =cut sub isChangeable ($) { my ($self) = @_; ; my $val = $self->{'isChangeable'}; ; $val; } =head2 C $obj->set_isChangeable($val); Sets the value of Attribute C. C<$val> must be of type L or C. Returns C<$obj>. =cut sub set_isChangeable ($$) { my ($self, $val) = @_; ; if ( defined $val ) { ; } $self->{'isChangeable'} = $val ; ; $self; } =head2 C $obj->count_isChangeable; Returns the number of elements (0 or 1) in C. =cut sub count_isChangeable ($) { my ($self) = @_; ; my $val = $self->{'isChangeable'}; ; defined $val ? 1 : 0; } ################################################################# # Association # =for html
=cut ################################################################# # AssociationEnd referencedEnd <---> referent # type = UMMF::MOF_1_3::Model::Reference # multiplicity = 0..* # ordering = =head2 C my @val = $obj->referent; my $ary_val = $obj->referent; Returns the AssociationEnd C values of type L. 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 referent ($) { my ($self) = @_; my $x = $self->{'referent'}; # confess("Container for referent $x is not a blessed ref: " . Data::Dumper->new([ $self ], [qw($self)])->Maxdepth(2)->Dump()) if $x && ref($x) !~ /::/; wantarray ? ($x ? $x->members() : ()) : [ $x ? $x->members() : () ]; } =head2 C $obj->set_referent(@val); Sets the AssociationEnd C value. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub set_referent ($@) { my ($self, @val) = @_; $self->clear_referent; $self->add_referent(@val); } =head2 C $obj->add_referent(@val); Adds AssociationEnd C values. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub add_referent ($@) { my ($self, @val) = @_; my $x = $self->{'referent'} ||= Set::Object->new(); my $old; # Place holder for other MACRO. for my $val ( @val ) { # Recursion lock next if $x->includes($val); $self->__use('UMMF::MOF_1_3::Model::Reference')->__typecheck($val, "UMMF::MOF_1_3::Model::AssociationEnd.referent"); # Recursion lock $x->insert($val); # weaken? # Remove and add associations with other ends. $old->remove_referencedEnd($self) if $old; $val->add_referencedEnd($self) if $val; } $self; } =head2 C $obj->remove_referent(@val); Removes the AssociationEnd C values C<@val>. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub remove_referent ($@) { my ($self, @val) = @_; my $x = $self->{'referent'} ||= Set::Object->new(); for my $old ( @val ) { # Recursion lock next unless $x->includes($old); my $val = $old; $self->__use('UMMF::MOF_1_3::Model::Reference')->__typecheck($val, "UMMF::MOF_1_3::Model::AssociationEnd.referent"); # Recursion lock $x->remove($old); $val = undef; # Remove associations with other ends. $old->remove_referencedEnd($self) if $old; $val->add_referencedEnd($self) if $val; ; } $self; } =head2 C $obj->clear_referent; Clears the AssociationEnd C links to L. Returns C<$obj>. =cut sub clear_referent ($) { my ($self) = @_; my $x = $self->{'referent'} ||= Set::Object->new(); my $val; # Place holder for other MACRO. $self->{'referent'} = Set::Object->new(); # Recursion lock for my $old ( $x->members() ) { # Recursion lock # Remove associations with other ends. $old->remove_referencedEnd($self) if $old; $val->add_referencedEnd($self) if $val; ; } $self; } =head2 C $obj->count_referent; Returns the number of elements associated with C. =cut sub count_referent ($) { my ($self) = @_; my $x = $self->{'referent'}; defined $x ? $x->size : 0; } =for html
=cut ################################################################# # AssociationEnd exposedEnd <---> referrer # type = UMMF::MOF_1_3::Model::Reference # multiplicity = 0..* # ordering = =head2 C my @val = $obj->referrer; my $ary_val = $obj->referrer; Returns the AssociationEnd C values of type L. 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 referrer ($) { my ($self) = @_; my $x = $self->{'referrer'}; # confess("Container for referrer $x is not a blessed ref: " . Data::Dumper->new([ $self ], [qw($self)])->Maxdepth(2)->Dump()) if $x && ref($x) !~ /::/; wantarray ? ($x ? $x->members() : ()) : [ $x ? $x->members() : () ]; } =head2 C $obj->set_referrer(@val); Sets the AssociationEnd C value. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub set_referrer ($@) { my ($self, @val) = @_; $self->clear_referrer; $self->add_referrer(@val); } =head2 C $obj->add_referrer(@val); Adds AssociationEnd C values. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub add_referrer ($@) { my ($self, @val) = @_; my $x = $self->{'referrer'} ||= Set::Object->new(); my $old; # Place holder for other MACRO. for my $val ( @val ) { # Recursion lock next if $x->includes($val); $self->__use('UMMF::MOF_1_3::Model::Reference')->__typecheck($val, "UMMF::MOF_1_3::Model::AssociationEnd.referrer"); # Recursion lock $x->insert($val); # weaken? # Remove and add associations with other ends. $old->remove_exposedEnd($self) if $old; $val->add_exposedEnd($self) if $val; } $self; } =head2 C $obj->remove_referrer(@val); Removes the AssociationEnd C values C<@val>. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub remove_referrer ($@) { my ($self, @val) = @_; my $x = $self->{'referrer'} ||= Set::Object->new(); for my $old ( @val ) { # Recursion lock next unless $x->includes($old); my $val = $old; $self->__use('UMMF::MOF_1_3::Model::Reference')->__typecheck($val, "UMMF::MOF_1_3::Model::AssociationEnd.referrer"); # Recursion lock $x->remove($old); $val = undef; # Remove associations with other ends. $old->remove_exposedEnd($self) if $old; $val->add_exposedEnd($self) if $val; ; } $self; } =head2 C $obj->clear_referrer; Clears the AssociationEnd C links to L. Returns C<$obj>. =cut sub clear_referrer ($) { my ($self) = @_; my $x = $self->{'referrer'} ||= Set::Object->new(); my $val; # Place holder for other MACRO. $self->{'referrer'} = Set::Object->new(); # Recursion lock for my $old ( $x->members() ) { # Recursion lock # Remove associations with other ends. $old->remove_exposedEnd($self) if $old; $val->add_exposedEnd($self) if $val; ; } $self; } =head2 C $obj->count_referrer; Returns the number of elements associated with C. =cut sub count_referrer ($) { my ($self) = @_; my $x = $self->{'referrer'}; defined $x ? $x->size : 0; } # End of Class AssociationEnd =pod =for html
I =cut ############################################################################ 1; # is true! ############################################################################ ### Keep these comments at end of file: kstephens@users.sourceforge.net 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: ###