# -*- 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::Tag; #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::Tag -- =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::String =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::String [C<0..*>] =over 4 =item metatype = L =item type = L =item visibility = C =item multiplicity = C<0..*> =item changeability = C =item targetScope = C =item ordering = C =item initialValue = I =item container_type = C =back =head1 ASSOCIATIONS =head2 C : I C<0..*> E---E C : UMMF::MOF_1_3::Model::ModelElement C<1..*> =over 4 =item metatype = L =item type = L =item multiplicity = C<1..*> =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::ModelElement ); ################################################################# # Exports # our @EXPORT_OK = qw( ); our %EXPORT_TAGS = ( 'all' => \@EXPORT_OK ); ################################################################# # Validation # =head2 C<__validate_type> UMMF::MOF_1_3::Model::Tag->__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::Tag') ; } =head2 C<__typecheck> UMMF::MOF_1_3::Model::Tag->__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::Tag' . ": value '$x'") unless __validate_type($self, $x); } =head2 C Returns true if receiver is a L. Other receivers will return false. =cut sub isaTag { 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__Tag { 1 } ################################################################# # Introspection # =head2 C<__model_name> my $name = $obj_or_package->__model_name; Returns the UML Model name (C<'Model::Tag'>) for an object or package of this Classifier. =cut sub __model_name { 'Model::Tag' } =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::Tag' => { 'table' => 'Model__Tag', 'abstract' => 0, 'slots' => { # Attributes 'tagId' => { 'type_impl' => 'ref', 'class' => 'UMMF::MOF_1_3::Model::String', 'col' => 'tagId', } , 'values' => { 'type_impl' => 'set', 'class' => 'UMMF::MOF_1_3::Model::String', 'table' => 'Model__RefersTo', 'item' => 'values', 'coll' => 'referent', } , # Associations 'modelElement' => { 'type_impl' => 'set', 'class' => 'UMMF::MOF_1_3::Model::ModelElement', 'table' => 'Model__AttachesTo', 'item' => 'modelElement', 'coll' => 'tag', } , }, 'bases' => [ 'UMMF::MOF_1_3::Model::ModelElement', ], '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 tagId if ( exists $self->{'tagId'} ) { my $x = $self->{'tagId'}; $self->{'tagId'} = undef; $self->set_tagId($x); } else { } # Attribute values if ( exists $self->{'values'} ) { my $x = $self->{'values'}; $self->{'values'} = undef; $self->set_values(ref($x) ? @$x : $x); } else { } # Associations # AssociationEnd # tag 0..* # <--> # modelElement 1..* UMMF::MOF_1_3::Model::ModelElement. if ( defined $self->{'modelElement'} ) { my $x = $self->{'modelElement'}; $self->{'modelElement'} = Set::Object->new(); $self->set_modelElement(@$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->UMMF::MOF_1_3::Model::Tag::___initialize; $self->UMMF::MOF_1_3::Model::ModelElement::___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::Tag::___create(@args); $self->UMMF::MOF_1_3::Model::ModelElement::___create(); $self; } ################################################################# # Attributes # =for html
=cut ################################################################# # Attribute tagId # type = UMMF::MOF_1_3::Model::String # multiplicity = 1 # ordering = unordered # ownerScope = instance # initialValue = =head2 C my $val = $obj->tagId; Returns the L value of Attribute C. =cut sub tagId ($) { my ($self) = @_; ; my $val = $self->{'tagId'}; ; $val; } =head2 C $obj->set_tagId($val); Sets the value of Attribute C. C<$val> must be of type L or C. Returns C<$obj>. =cut sub set_tagId ($$) { my ($self, $val) = @_; ; if ( defined $val ) { ; } $self->{'tagId'} = $val ; ; $self; } =head2 C $obj->count_tagId; Returns the number of elements (0 or 1) in C. =cut sub count_tagId ($) { my ($self) = @_; ; my $val = $self->{'tagId'}; ; defined $val ? 1 : 0; } =for html
=cut ################################################################# # Attribute values # type = UMMF::MOF_1_3::Model::String # multiplicity = 0..* # ordering = unordered # ownerScope = instance # initialValue = =head2 C my $array_ref = $obj->values; my @val = $obj->values; Returns the L values of Attribute C. In list context it returns the list of values. In scalar context it returns a reference to the list of values. =cut sub values ($) { my ($self) = @_; ; my $val = $self->{'values'} ||= [ ]; ; wantarray ? @$val : $val; } =head2 C $obj->set_values(@val); Sets the values of Attribute C. The elements of C<@val> must be of type L. Returns C<$obj>. =cut sub set_values ($@) { my ($self, @val) = @_; ; for my $val ( @val ) { ; } $self->{'values'} = \@val; ; $self; } =head2 C $obj->add_values(@val); Adds the values of Attribute C. The elements of C<@val> must be of type L. Returns C<$obj>. =cut sub add_values ($@) { my ($self, @val) = @_; ; for my $val ( @val ) { ; } my $x = $self->{'values'} ||= [ ]; push(@$x, @val); ; $self; } =head2 C $obj->remove_values(@val); Removes values from Attribute C. The elements of C<@val> must be of type L. Returns C<$obj>. =cut sub remove_values ($@) { my ($self, @val) = @_; ; for my $val ( @val ) { ; } my $x = $self->{'values'} ||= [ ]; __ummf_array_delete_each($x, \@val); ; $self; } =head2 C $obj->clear_values; Removes all values from Attribute C. Returns C<$obj>. =cut sub clear_values ($) { my ($self) = @_; ; $self->{'values'} = [ ]; ; $self; } =head2 C $obj->count_values; Returns the number of elements in C. =cut sub count_values ($) { my ($self) = @_; ; my $val = $self->{'values'}; ; $val ? scalar @$val : 0; } ################################################################# # Association # =for html
=cut ################################################################# # AssociationEnd tag <---> modelElement # type = UMMF::MOF_1_3::Model::ModelElement # multiplicity = 1..* # ordering = =head2 C my @val = $obj->modelElement; my $ary_val = $obj->modelElement; 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 modelElement ($) { my ($self) = @_; my $x = $self->{'modelElement'}; # confess("Container for modelElement $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_modelElement(@val); Sets the AssociationEnd C value. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub set_modelElement ($@) { my ($self, @val) = @_; $self->clear_modelElement; $self->add_modelElement(@val); } =head2 C $obj->add_modelElement(@val); Adds AssociationEnd C values. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub add_modelElement ($@) { my ($self, @val) = @_; my $x = $self->{'modelElement'} ||= 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::ModelElement')->__typecheck($val, "UMMF::MOF_1_3::Model::Tag.modelElement"); # Recursion lock $x->insert($val); # weaken? # Remove and add associations with other ends. $old->remove_tag($self) if $old; $val->add_tag($self) if $val; } $self; } =head2 C $obj->remove_modelElement(@val); Removes the AssociationEnd C values C<@val>. Elements of C<@val> must of type L. Returns C<$obj>. =cut sub remove_modelElement ($@) { my ($self, @val) = @_; my $x = $self->{'modelElement'} ||= Set::Object->new(); for my $old ( @val ) { # Recursion lock next unless $x->includes($old); my $val = $old; $self->__use('UMMF::MOF_1_3::Model::ModelElement')->__typecheck($val, "UMMF::MOF_1_3::Model::Tag.modelElement"); # Recursion lock $x->remove($old); $val = undef; # Remove associations with other ends. $old->remove_tag($self) if $old; $val->add_tag($self) if $val; ; } $self; } =head2 C $obj->clear_modelElement; Clears the AssociationEnd C links to L. Returns C<$obj>. =cut sub clear_modelElement ($) { my ($self) = @_; my $x = $self->{'modelElement'} ||= Set::Object->new(); my $val; # Place holder for other MACRO. $self->{'modelElement'} = Set::Object->new(); # Recursion lock for my $old ( $x->members() ) { # Recursion lock # Remove associations with other ends. $old->remove_tag($self) if $old; $val->add_tag($self) if $val; ; } $self; } =head2 C $obj->count_modelElement; Returns the number of elements associated with C. =cut sub count_modelElement ($) { my ($self) = @_; my $x = $self->{'modelElement'}; defined $x ? $x->size : 0; } # End of Class Tag =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: ###