📄 marte4cheddar.atl
字号:
-- Thales MARTE to Cheddar (Copyright (c) THALES 2007 All rights reserved) is free software; you can redistribute itand/or modify-- it under the terms of the Eclipse Public License as published in http://www.eclipse.org/legal/epl-v10.html---- Thales MARTE to Cheddar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Eclipse Public License for more details.---------------------------------------------------- Nicolas VIENNE-- Eric MAES---------------------------------------------------- This library contains some helpers for the use of MARTE for cheddar--------------------------------------------------library MARTE4CHEDDAR;uses UML2;uses MARTE;------ Generic helpers----helper context UML!Element def: Name() : String = if self.oclIsKindOf(UML!NamedElement) then self.getQualifiedName.replaceAll('::','_') else self.name endif;helper context UML!Element def : getStereoElemsKindOfStereoAttrib(stereotype:String,attributeName:String, stereotype2:String) : Sequence(UML!Element) = self.getStereotypeAttributeValue(stereotype, attributeName)->select(e2 | e2.hasStereotypeKindOf(stereotype2));helper context UML!Element def : getStereoElemsTypeOfStereoAttrib(stereotype:String,attributeName:String, stereotype2:String) : Sequence(UML!Element) = self.getStereotypeAttributeValue(stereotype, attributeName)->select(e2 | e2.hasStereotypeTypeOf(stereotype2));helper context UML!Element def : getDefaultValueAttributeByName(attribute_name:String) : OclAny = if not self.getOwnedAttributes()->select(e|e.name=attribute_name).first().oclIsUndefined() then if not self.getOwnedAttributes()->select(e|e.name=attribute_name).first().getDefaultValue().oclIsUndefined() then self.getOwnedAttributes()->select(e|e.name=attribute_name).first().getDefaultValue().getValue() else OclUndefined endif else OclUndefined endif;helper context UML!Element def : getStereoAttribDefaultValueByName(stereotype : String, attribute: String, name:String) : UML!Element = let a : UML!Element = self.getStereotypeAttributeValue(stereotype, attribute) ->select(a | a.name=name)->first() in if not a.oclIsUndefined() then a.getDefaultValue() else OclUndefined endif;helper context UML!Element def : getStereoAttribDefaultIntegerValueByName(stereotype : String, attribute: String, name:String) : UML!Element = if self.marteHasVSLInteger(stereotype,attribute,Sequence{'value'}.including(name)) then self.marteGetVSLInteger(stereotype,attribute,Sequence{'value'}.including(name)) else let a : UML!Element = self.getStereotypeAttributeValue(stereotype, attribute) ->select(a | a.name=name)->first() in if not a.oclIsUndefined() then a.getDefaultValue().integerValue() else OclUndefined endif endif;helper context UML!Element def : getIntSADVBN(stereotype : String, attribute: String, name:String) : UML!Element = let a : UML!Element = self.getStereoAttribDefaultIntegerValueByName(stereotype, attribute, name) in if not a.oclIsUndefined() then a else OclUndefined endif;helper context UML!Element def : getStrSADVBN(stereotype : String, attribute: String, name:String) : UML!Element = let a : UML!Element = self.getStereoAttribDefaultValueByName(stereotype, attribute, name) in if not a.oclIsUndefined() then a.stringValue() else OclUndefined endif;helper context UML!Element def : getBoolSADVBN(stereotype : String, attribute: String, name:String) : UML!Element = let a : UML!Element = self.getStereoAttribDefaultValueByName(stereotype, attribute, name) in if not a.oclIsUndefined() then a.booleanValue() else OclUndefined endif;-- getFirstStereotypedTypesOfStereotypeAttributehelper context UML!Element def : getFirstStereotypedTypeOfStereotypeAttribute(stereotype : String, attribute : String, type_stereotype : String): UML!Element = self.getStereotypeAttributeValue( stereotype, attribute).asSequence() -> collect(e1 | e1.getType()) -> select(e2 | not e2.oclIsUndefined()) -> select(e3 | e3.hasStereotypeKindOf(type_stereotype)).first();-- Sequence versionhelper context UML!Element def : getFirstStereotypedTypeOfStereotypeAttribute_Seq(stereotype : String, attribute : String, stereotypes : Sequence(String)): UML!Element = self.getStereotypeAttributeValue( stereotype, attribute).asSequence() -> collect(e1 | e1.getType()) -> select(e2 | not e2.oclIsUndefined()) -> select(e3 | stereotypes->select(s | e3.hasStereotypeKindOf(s))->notEmpty()).first();helper context UML!Element def : getStorageResourceElementSize(stereotype : String, attribute: String, name : String) : Integer = let elem : UML!Element = self.getStereoElemsKindOfStereoAttrib(stereotype, attribute, self.StorageResource()) ->select(el | el.name = name) .first() in if not elem.oclIsUndefined() then elem.marteGetAttributeValue(self.StorageResource(), self.StorageResource_elementSize()).toInteger() else 0 endif;helper context UML!Element def : getSuppliersKindOf(stereotype : String) : Sequence(UML!Element) = self.getClientDependencies()->collect(e | e.getSuppliers())->flatten()->select(sup | sup.marteIsKindOf(stereotype));helper context UML!Element def : getSupplyingDependencies() : Sequence(UML!Element) = UML!Dependency.allInstances()->select(dep | not dep.getSupplier(self.name).oclIsUndefined());-- Analysis Context Versionhelper context UML!Element def : ACV() : String = if self.marteIsTypeOf(self.GaAnalysisContext()) then self.GaAnalysisContext() else self.SaAnalysisContext() endif;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -