-- @atlcompiler atl2006 -- $Id$ -- UML2 helpers library UML2; uses Strings; ------------------------------- General helpers ----------------------------------- helper context String def : primitiveType() : UML2!"uml::PrimitiveType" = UML2!"uml::PrimitiveType".allInstances()->any(s|s.name=self); helper context String def : profile() : UML2!"uml::Profile" = UML2!"uml::Profile".allInstances()->any(p|p.name=self); helper context String def : stereotype() : UML2!"uml::Stereotype" = UML2!"uml::Stereotype".allInstances()->any(s|s.name=self); helper context String def : dataType() : UML2!"uml::DataType" = UML2!"uml::DataType".allInstances()->any(c|c.umlQualifiedName=self); helper context String def : type() : UML2!"uml::Type" = UML2!"uml::Type".allInstances()->any(c|c.umlQualifiedName=self); helper context String def : interface() : UML2!"uml::Interface" = UML2!"uml::Interface".allInstances()->any(c|c.umlQualifiedName=self); helper context String def : class() : UML2!"uml::Class" = UML2!"uml::Class".allInstances()->any(c|c.umlQualifiedName=self); ------------------------------- BehavioredClassifier ----------------------------------- helper context UML2!"uml::BehavioredClassifier" def : superTypes : Set(UML2!"uml::Classifier") = self.general->union(self.interfaceRealization->collect(i|i.contract)).debug('BehavioredClassifier.superTypes'); ------------------------------- Classifier ----------------------------------- helper context UML2!"uml::Classifier" def : superTypes : Set(UML2!"uml::Classifier") = self.general; ------------------------------- MultiplicityElement ----------------------------------- helper context UML2!"uml::MultiplicityElement" def : accessorBaseName : String = self.name.firstToUpper; helper context UML2!"uml::MultiplicityElement" def : accessorBaseNameS : String = self.accessorBaseName + if self.isSingle then '' else 's' endif; helper context UML2!"uml::MultiplicityElement" def : isSingle : Boolean = if self.upperValue.oclIsUndefined() then true else self.upperValue.value = 1 endif; helper context UML2!"uml::MultiplicityElement" def : lower : Integer = if self.lowerValue.oclIsUndefined() then 1 else self.lowerValue.value endif; helper context UML2!"uml::MultiplicityElement" def : upper : Integer = if self.upperValue.oclIsUndefined() then 1 else self.upperValue.value endif; ------------------------------- NamedElement ----------------------------------- helper context UML2!"uml::NamedElement" def : umlQualifiedName : String = self.qualifiedName('::'); helper context UML2!"uml::NamedElement" def : qualifiedName(separator : String) : String = if self.owner.oclIsTypeOf(UML2!"uml::Package") then self.owner.qualifiedName(separator) + separator + self.name else self.name endif; ------------------------------- Package ----------------------------------- helper context UML2!"uml::Package" def : includesProfile(p : UML2!"uml::Profile") : Boolean = self.profileApplication->exists(a|a.appliedProfile=p); helper context UML2!"uml::Package" def : includesProfileName(p : String) : Boolean = self.profileApplication->exists(a|a.appliedProfile.name=p); ------------------------------- PackageableElement ----------------------------------- helper context UML2!"uml::PackageableElement" def : owningPackage : UML2!"uml::Package" = if self.owner.oclIsKindOf(UML2!"uml::Package") then self.owner else OclUndefined endif; ------------------------------- Property ----------------------------------- helper context UML2!"uml::Property" def : isNavigable : Boolean = self.owningAssociation.oclIsUndefined(); helper context UML2!"uml::Property" def : associatedProperty : UML2!"uml::Property" = if self.association.oclIsUndefined() then OclUndefined else self.association.memberEnd->any(p| p<>self and p.isNavigable) endif;