Difference between revisions of "Artefact:Template/org/ooem/templates/wiml-1.0-ooem-multipart-1.0"

From OOModels
Jump to navigationJump to search
Line 49: Line 49:
   ⋮«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" == null){»…
   ⋮«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" == null){»…
   <Attribute Name="◂‖"Ⓟ/Name"▸" Type="◂((String)(‖"Ⓟ/Type")).replace("/",".")▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»…
   <Attribute Name="◂‖"Ⓟ/Name"▸" Type="◂((String)(‖"Ⓟ/Type")).replace("/",".")▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»…
     ⋮«¬∅(-:‖"Ⓟ/Extensions"){»…
     ⋮⊏ ➜ this.Extensions(object, "Attribute") ⊐…
      ⋮>
      ⋮⊏ ➜ this.Extensions(object) ⊐…
  </Attribute>
    ⋮«}∨{»…
      ⋮/>
    ⋮«}/¬∅»…
   ⋮«}}/∀»…
   ⋮«}}/∀»…
   ⋮«∀(‖"Ⓟ/Operations"){»…
   ⋮«∀(‖"Ⓟ/Operations"){»…
   <Operation Name="◂‖"Ⓟ/Name"▸" ReturnType="◂‖"Ⓟ/ReturnType"▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»…
   <Operation Name="◂‖"Ⓟ/Name"▸" ReturnType="◂‖"Ⓟ/ReturnType"▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»…
     ⋮«¬∅(-:‖"Ⓟ/Extensions"){»…
     ⋮⊏ ➜ this.Extensions(object, "Operation") ⊐…
      ⋮>
      ⋮⊏ ➜ this.Extensions(object) ⊐…
  </Attribute>
    ⋮«}∨{»…
      ⋮/>
    ⋮«}/¬∅»…
   ⋮«}/∀»…
   ⋮«}/∀»…
   ⋮«¬∅(-:‖"Ⓟ/Extensions"){»…
   ⋮⊏ ➜ this.Extensions(object, null) ⊐…
    ⋮⊏ ➜ this.Extensions(object) ⊐…
  ⋮«}/¬∅»…
</Class>
</Class>
« if (has_associations) { »…
« if (has_associations) { »…
Line 88: Line 74:
       <Multiplicity>1</Multiplicity>
       <Multiplicity>1</Multiplicity>
       <IsNavigable>false</IsNavigable>
       <IsNavigable>false</IsNavigable>
       ⋮⊏ ➜ this.Extensions(object) ⊐…
       ⋮⊏ ➜ this.Extensions(object, null) ⊐…
     </End>
     </End>
     <End>
     <End>
Line 95: Line 81:
       <Multiplicity>◂‖"Ⓟ/Association"▸</Multiplicity>
       <Multiplicity>◂‖"Ⓟ/Association"▸</Multiplicity>
       <IsNavigable>true</IsNavigable>
       <IsNavigable>true</IsNavigable>
       ⋮⊏ ➜ this.Extensions(object) ⊐…
       ⋮⊏ ➜ this.Extensions(object, null) ⊐…
     </End>
     </End>
   </Ends>
   </Ends>
   ⋮⊏ ➜ this.Extensions(object) ⊐…
   ⋮⊏ ➜ this.Extensions(object, null) ⊐…
</Association>
</Association>
⋮«}}/∀»…
⋮«}}/∀»…
Line 105: Line 91:
ERROR: ◂t▸
ERROR: ◂t▸
« } »…
« } »…
⊏ Ⓣ Extensions(Object object) ⊐…
⊏ Ⓣ Extensions(Object object, String element) ⊐…
   ⋮«¬∅(‖"Ⓟ/Extensions"){»…
   ⋮«¬∅(‖"Ⓟ/Extensions"){»…
     ⋮«➀:(x)»…
     ⋮«➀:(x)»…
Line 111: Line 97:
       ⋮«if(((String)(‖"Ⓟ/Name")).equals("UML")){»…
       ⋮«if(((String)(‖"Ⓟ/Name")).equals("UML")){»…
       ⋮«}else{»…
       ⋮«}else{»…
         ⋮«➀(x){»…
         ⋮«➀(x){if(element!=null){»>
        ⋮«}»…
     <Extensions>
     <Extensions>
         ⋮«}/➀»…
         ⋮«}/➀»…
Line 131: Line 118:
     ⋮«¬➀(x){»…
     ⋮«¬➀(x){»…
     </Extensions>
     </Extensions>
      ⋮«if(element!=null){»
  </◂element▸>
      ⋮«}»…
    ⋮«}∨{if(element!=null){»/>
      ⋮«}»…
     ⋮«}/¬➀»…
     ⋮«}/¬➀»…
   ⋮«}/¬∅»…
   ⋮«}/¬∅»…

Revision as of 19:46, 16 July 2009

Classification
Type Type:org/oogenerator/Template/2.0
Domain Domain:it/development/formatting
Category Type:org/oomodels/wiki/Template
Maturity final
More
Download Code
Namespace (more)

OOEM main package

create new pages

Code[edit]


G-2.0-java_jpp-1.0 -*- coding: utf-8; -*-

import org.oomodels.wiml.*;
▼
⊏ signature(String wiml_code) ⊐
« WIMLClass wc; try { wc = WIMLClass.parseWIML(wiml_code); object = wc; 
  boolean has_associations = false;
  ∀(‖"Ⓟ/Attributes"){
    if (‖"Ⓟ/Association"!=null) { has_associations = true; }
  }/∀
»
MIME-Version: 1.0
Content-type: multipart/mixed; charset=utf-8; boundary="mimeboundery"

--mimeboundery
Content-type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=‖"Ⓟ/Name".model

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Class>
  ⋮⊏ ➜ this.Imports(object) ⊐
  <Name>‖"Ⓟ/Name"</Name>
  ⋮«∀(‖"Ⓟ/ModelTemplateArguments"){»
  <TemplateParameter Name="‖"Ⓟ/Name"" «∃(‖"Ⓟ/DefaultValue"){»DefaultValue="◂((String)(⊙)).replace("/",".")▸" «}/∃»GenericLevel="MODEL_TEMPLATE"/>
  ⋮«}/∀»«∀(‖"Ⓟ/CodeGeneratorTemplateArguments"){»
  <TemplateParameter Name="‖"Ⓟ/Name"" «∃(‖"Ⓟ/DefaultValue"){»DefaultValue="◂((String)(⊙)).replace("/",".")▸" «}/∃»GenericLevel="CODE_GENERATOR_TEMPLATE"/>
  ⋮«}/∀»«∀(‖"Ⓟ/ImplementationLanguageTemplateArguments"){»
  <TemplateParameter Name="‖"Ⓟ/Name"" «∃(‖"Ⓟ/DefaultValue"){»DefaultValue="◂((String)(⊙)).replace("/",".")▸" «}/∃»GenericLevel="IMPLEMENTATION_LANGUAGE_TEMPLATE"/>
  ⋮«}/∀»«∀(‖"Ⓟ/Bases"){»
  <Base Parent="◂((String)(⊙)).replace("/",".")▸"/>
  ⋮«}/∀»«¬∅(‖"Ⓟ/Stereotypes"){»
  <Stereotype>«∀(⊙){»◂⊙▸«}/∀»</Stereotype>
  ⋮«}/¬∅»«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" == null){»
  <Attribute Name="‖"Ⓟ/Name"" Type="◂((String)(‖"Ⓟ/Type")).replace("/",".")▸"«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»⊏ ➜ this.Extensions(object, "Attribute") ⊐«}}/∀»«∀(‖"Ⓟ/Operations"){»
  <Operation Name="‖"Ⓟ/Name"" ReturnType="‖"Ⓟ/ReturnType""«¬∅(‖"Ⓟ/Stereotypes"){» Stereotype="«∀(⊙){»◂⊙▸«}/∀»"«}/¬∅»⊏ ➜ this.Extensions(object, "Operation") ⊐«}/∀»⊏ ➜ this.Extensions(object, null) ⊐
</Class>
« if (has_associations) { »«∀(‖"Ⓟ/Attributes"){if(‖"Ⓟ/Association" != null){»
--mimeboundery
Content-type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=‖[wc]"Ⓟ/Name"Association‖"Ⓟ/Name".model

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Association>
  ⋮⊏ ➜ this.Imports(object) ⊐«¬∅(‖"Ⓟ/Stereotypes"){»
  <Stereotype>«∀(⊙){»◂⊙▸«}/∀»</Stereotype>
  ⋮«}/¬∅»
  <Ends>
    <End>
      <Type>‖[wc]"Ⓟ/Name"</Type>
      <Multiplicity>1</Multiplicity>
      <IsNavigable>false</IsNavigable>
      ⋮⊏ ➜ this.Extensions(object, null) ⊐
    </End>
    <End>
      <Role>‖"Ⓟ/Name"</Role>
      <Type>◂((String)(‖"Ⓟ/Type")).replace("/",".")▸</Type>
      <Multiplicity>‖"Ⓟ/Association"</Multiplicity>
      <IsNavigable>true</IsNavigable>
      ⋮⊏ ➜ this.Extensions(object, null) ⊐
    </End>
  </Ends>
  ⋮⊏ ➜ this.Extensions(object, null) ⊐
</Association>
⋮«}}/∀»
« } »
« } catch (Throwable t) { »
ERROR: ◂t▸
« } »
⊏ Ⓣ Extensions(Object object, String element) ⊐«¬∅(‖"Ⓟ/Extensions"){»«➀:(x)»«∀(⊙){»«if(((String)(‖"Ⓟ/Name")).equals("UML")){»«}else{»«➀(x){if(element!=null){»>
         ⋮«}»
    <Extensions>
         ⋮«}/➀»«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»
      <◂((String)(‖"Ⓟ/Name")).replaceFirst("org/xmodel/","")▸>
        ⋮«}else{»
      <Extension CLASS="‖"Ⓟ/Name"">
        ⋮«}»«∀(‖"Ⓟ/Properties"){»
        <‖"Ⓟ/Name">‖"Ⓟ/Value"</‖"Ⓟ/Name">
          ⋮«}/∀»«if(((String)(‖"Ⓟ/Name")).matches("^org/xmodel/[^/]*")){»
      </◂((String)(‖"Ⓟ/Name")).replaceFirst("org/xmodel/","")▸>
        ⋮«}else{»
      </Extension>
        ⋮«}»«}»«}/∀»«¬➀(x){»
    </Extensions>
      ⋮«if(element!=null){»
  </◂element▸>
      ⋮«}»«}∨{if(element!=null){»/>
      ⋮«}»«}/¬➀»«}/¬∅»
⊏ /Ⓣ ⊐
⊏ Ⓣ Imports(Object object) ⊐
  <InternalModelImport>org.uml.stereotypes.*</InternalModelImport>
  <ExternalImport>java.lang.String</ExternalImport>
  <ExternalImport>java.lang.Integer</ExternalImport>
  <ExternalImport>java.lang.Object</ExternalImport>
  <ExternalImport>java.lang.Boolean</ExternalImport>
  <PrimitiveImport>int</PrimitiveImport>
⊏ /Ⓣ ⊐