Commit feab9798 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

* factored out resolveBaseDataType to resolveBaseDataTypeFromContainer for...

* factored out resolveBaseDataType to resolveBaseDataTypeFromContainer for reuse and less duplication and inconsistency, #213, #214

* note that casting up does not seem to work in OCL currently, hence the different name..
parent 5d04d6bb
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -209,7 +209,12 @@
    </eOperations>
    <eOperations name="resolveBaseDataType" eType="#//DataType">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
        <details key="body" value="null"/>
        <details key="body" value="&#xA;&#x9;&#x9;    self.resolveBaseDataTypeFromContainer()&#xA;&#x9;&#x9;    "/>
      </eAnnotations>
    </eOperations>
    <eOperations name="resolveBaseDataTypeFromContainer" eType="#//DataType">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
        <details key="body" value="                    &#xA;&#x9;&#x9;&#x9;--casting up does not work.. casting is implemented weirdly anyhow.. &#xA;&#x9;&#x9;&#x9;if (self.container().oclIsTypeOf(MemberAssignment)) then&#xA;                self.container().oclAsType(MemberAssignment).member.dataType&#xA;            else &#xA;                if (self.container().oclIsTypeOf(ParameterBinding)) then&#xA;                    self.container().oclAsType(ParameterBinding).resolveParameterType()&#xA;                else&#xA;                    if (self.container().oclIsTypeOf(CollectionDataInstance)) then&#xA;                        self.container().oclAsType(CollectionDataInstance).dataType.oclAsType(CollectionDataType).itemType&#xA;                    else&#xA;                        if (self.container().oclIsTypeOf(DataElementUse)) then&#xA;                            if (self.container().oclAsType(DataElementUse).resolveDataType()->isEmpty()) then&#xA;                                null&#xA;                            else&#xA;                                self.container().oclAsType(DataElementUse).resolveDataType().oclAsType(CollectionDataType).itemType&#xA;                            endif&#xA;                        else&#xA;                            if (self.container().oclIsTypeOf(DataInstanceUse)) then&#xA;                                if (self.container().oclAsType(DataInstanceUse).resolveDataType()->isEmpty()) then&#xA;                                    null&#xA;                                else&#xA;                                    self.container().oclAsType(DataInstanceUse).resolveDataType().oclAsType(CollectionDataType).itemType&#xA;                                endif&#xA;                            else&#xA;                                if (self.container().oclIsKindOf(Parameter)) then&#xA;                                    self.container().oclAsType(Parameter).dataType&#xA;                                else&#xA;                                    if (self.container().oclIsTypeOf(SimpleDataInstance)) then&#xA;                                        self.container().oclAsType(SimpleDataInstance).dataType&#xA;                                    else&#xA;                                        null&#xA;                                    endif&#xA;                                endif&#xA;                            endif&#xA;                        endif&#xA;                    endif&#xA;                endif&#xA;            endif&#xA;            "/>
      </eAnnotations>
    </eOperations>
    <eOperations name="isEffectivelyStatic" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
@@ -351,17 +356,11 @@
    <eLiterals name="Tester" value="1"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="OmitValue" eSuperTypes="#//SpecialValueUse"/>
  <eClassifiers xsi:type="ecore:EClass" name="SpecialValueUse" abstract="true" eSuperTypes="#//StaticDataUse">
    <eOperations name="resolveBaseDataType" eType="#//DataType">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
        <details key="body" value="&#xA;                    if (self.container().oclIsTypeOf(MemberAssignment)) then&#xA;                        self.container().oclAsType(MemberAssignment).member.dataType&#xA;                    else &#xA;                        if (self.container().oclIsTypeOf(ParameterBinding)) then&#xA;                            self.container().oclAsType(ParameterBinding).parameter.dataType&#xA;                        else &#xA;                            if (self.container().oclIsTypeOf(Interaction) and &#xA;                                self.oclIsTypeOf(AnyValue)) then&#xA;                                self.oclAsType(AnyValue).dataType&#xA;                            else&#xA;                                null&#xA;                            endif&#xA;                        endif&#xA;                    endif&#xA;                "/>
      </eAnnotations>
    </eOperations>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="SpecialValueUse" abstract="true" eSuperTypes="#//StaticDataUse"/>
  <eClassifiers xsi:type="ecore:EClass" name="AnyValue" eSuperTypes="#//SpecialValueUse">
    <eOperations name="resolveBaseDataType" eType="#//DataType">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
        <details key="body" value="&#xA;                    if (not self.dataType.oclIsUndefined()) then&#xA;                        self.dataType&#xA;                    else &#xA;                        if (self.container().oclIsTypeOf(MemberAssignment)) then&#xA;                            self.container().oclAsType(MemberAssignment).member.dataType&#xA;                        else &#xA;                            if (self.container().oclIsTypeOf(ParameterBinding)) then&#xA;                                self.container().oclAsType(ParameterBinding).parameter.dataType&#xA;                            else&#xA;                                if (self.container().oclIsTypeOf(CollectionDataInstance)) then&#xA;                                    self.container().oclAsType(CollectionDataInstance).dataType.oclAsType(CollectionDataType).itemType&#xA;                                else&#xA;                                    if (self.container().oclIsTypeOf(DataElementUse)) then&#xA;                                        self.container().oclAsType(DataElementUse).resolveDataType().oclAsType(CollectionDataType).itemType&#xA;                                    else&#xA;                                        if (self.container().oclIsTypeOf(DataInstanceUse)) then&#xA;                                            self.container().oclAsType(DataInstanceUse).resolveDataType().oclAsType(CollectionDataType).itemType&#xA;                                        else&#xA;                                            if (self.container().oclIsKindOf(Parameter)) then&#xA;                                                self.container().oclAsType(Parameter).dataType&#xA;                                            else&#xA;                                                if (self.container().oclIsTypeOf(SimpleDataInstance)) then&#xA;                                                    self.container().oclAsType(SimpleDataInstance).dataType&#xA;                                                else&#xA;                                                    null&#xA;                                                endif&#xA;                                            endif&#xA;                                        endif&#xA;                                    endif&#xA;                                endif&#xA;                            endif&#xA;                        endif&#xA;                    endif&#xA;                "/>
        <details key="body" value="&#xA;                if (not self.dataType.oclIsUndefined()) then&#xA;                    self.dataType&#xA;                else &#xA;        &#x9;&#x9;&#x9;self.resolveBaseDataTypeFromContainer()&#xA;                endif&#xA;            "/>
      </eAnnotations>
    </eOperations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="dataType" eType="#//DataType"/>
@@ -370,7 +369,7 @@
  <eClassifiers xsi:type="ecore:EClass" name="DataInstanceUse" eSuperTypes="#//StaticDataUse">
    <eOperations name="resolveBaseDataType" eType="#//DataType">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
        <details key="body" value="&#xA;                if (not self.dataInstance.oclIsUndefined()) then&#xA;                    self.dataInstance.dataType&#xA;                else &#xA;                    if (not self.dataType.oclIsUndefined()) then&#xA;                        self.dataType&#xA;                    else &#xA;                        if (self.container().oclIsTypeOf(MemberAssignment)) then&#xA;                            self.container().oclAsType(MemberAssignment).member.dataType&#xA;                        else &#xA;                            if (self.container().oclIsTypeOf(ParameterBinding)) then&#xA;                                self.container().oclAsType(ParameterBinding).parameter.dataType&#xA;                            else&#xA;                                if (self.container().oclIsTypeOf(CollectionDataInstance)) then&#xA;                                    self.container().oclAsType(CollectionDataInstance).dataType.oclAsType(CollectionDataType).itemType&#xA;                                else&#xA;                                    if (self.container().oclIsTypeOf(DataElementUse)) then&#xA;                                        self.container().oclAsType(DataElementUse).resolveDataType().oclAsType(CollectionDataType).itemType&#xA;                                    else&#xA;                                        if (self.container().oclIsTypeOf(DataInstanceUse)) then&#xA;                                            self.container().oclAsType(DataInstanceUse).resolveDataType().oclAsType(CollectionDataType).itemType&#xA;                                        else&#xA;                                            if (self.container().oclIsKindOf(Parameter)) then&#xA;                                                self.container().oclAsType(Parameter).dataType&#xA;                                            else&#xA;                                                null&#xA;                                            endif&#xA;                                        endif&#xA;                                    endif&#xA;                                endif&#xA;                            endif&#xA;                        endif&#xA;                    endif&#xA;                endif&#xA;                "/>
        <details key="body" value="&#xA;                if (not self.dataInstance.oclIsUndefined()) then&#xA;                    self.dataInstance.dataType&#xA;                else &#xA;                    if (not self.dataType.oclIsUndefined()) then&#xA;                        self.dataType&#xA;                    else &#xA;                        self.resolveBaseDataTypeFromContainer()&#xA;                    endif&#xA;                endif&#xA;                "/>
      </eAnnotations>
    </eOperations>
    <eStructuralFeatures xsi:type="ecore:EReference" name="dataInstance" eType="#//DataInstance"/>
@@ -846,7 +845,7 @@
  <eClassifiers xsi:type="ecore:EClass" name="LiteralValueUse" eSuperTypes="#//StaticDataUse">
    <eOperations name="resolveBaseDataType" eType="#//DataType">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
        <details key="body" value="&#xA;                if (not self.dataType.oclIsUndefined()) then&#xA;                    self.dataType&#xA;                else &#xA;                    if (not self.intValue.oclIsUndefined()) then&#xA;                        SimpleDataType.allInstances()->select(t | t.name = 'Integer')->asOrderedSet()->first()&#xA;                    else&#xA;                        if (not self.boolValue.oclIsUndefined()) then&#xA;                            SimpleDataType.allInstances()->select(t | t.name = 'Boolean')->asOrderedSet()->first()&#xA;                        else &#xA;&#x9;                        if (not self.value.oclIsUndefined()) then&#xA;&#x9;                            SimpleDataType.allInstances()->select(t | t.name = 'String')->asOrderedSet()->first()&#xA;&#x9;                        else &#xA;&#x9;&#x9;&#x9;                    if (self.container().oclIsTypeOf(MemberAssignment)) then&#xA;&#x9;&#x9;&#x9;                        self.container().oclAsType(MemberAssignment).member.dataType&#xA;&#x9;&#x9;&#x9;                    else &#xA;&#x9;&#x9;&#x9;                        if (self.container().oclIsTypeOf(ParameterBinding)) then&#xA;&#x9;&#x9;&#x9;                            self.container().oclAsType(ParameterBinding).parameter.dataType&#xA;&#x9;                                else&#xA;&#x9;                                    null&#xA;&#x9;&#x9;&#x9;                        endif&#xA;&#x9;&#x9;&#x9;                    endif&#xA;&#x9;&#x9;                    endif&#xA;                        endif&#xA;                    endif&#xA;                endif&#xA;                "/>
        <details key="body" value="&#xA;                if (not self.dataType.oclIsUndefined()) then&#xA;                    self.dataType&#xA;                else &#xA;                    if (not self.intValue.oclIsUndefined()) then&#xA;                        SimpleDataType.allInstances()->select(t | t.name = 'Integer')->asOrderedSet()->first()&#xA;                    else&#xA;                        if (not self.boolValue.oclIsUndefined()) then&#xA;                            SimpleDataType.allInstances()->select(t | t.name = 'Boolean')->asOrderedSet()->first()&#xA;                        else &#xA;&#x9;                        if (not self.value.oclIsUndefined()) then&#xA;&#x9;                            SimpleDataType.allInstances()->select(t | t.name = 'String')->asOrderedSet()->first()&#xA;&#x9;                        else &#xA;                                self.resolveBaseDataTypeFromContainer()&#xA;&#x9;&#x9;                    endif&#xA;                        endif&#xA;                    endif&#xA;                endif&#xA;                "/>
      </eAnnotations>
    </eOperations>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
@@ -871,7 +870,7 @@
  <eClassifiers xsi:type="ecore:EClass" name="DataElementUse" eSuperTypes="#//DataUse">
    <eOperations name="resolveBaseDataType" eType="#//DataType">
      <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
        <details key="body" value="&#xA;                if (not self.dataElement.oclIsUndefined()) then&#xA;                    if (self.dataElement.oclIsKindOf(DataType)) then&#xA;                        self.dataElement.oclAsType(DataType)&#xA;                    else&#xA;                        if (self.dataElement.oclIsKindOf(DataInstance)) then&#xA;                            self.dataElement.oclAsType(DataInstance).dataType&#xA;                        else &#xA;                            if (self.dataElement.oclIsTypeOf(FormalParameter)) then&#xA;                                self.dataElement.oclAsType(FormalParameter).dataType&#xA;                            else &#xA;                                if (self.dataElement.oclIsTypeOf(Function)) then&#xA;                                    self.dataElement.oclAsType(Function).returnType&#xA;                                else&#xA;&#x9;                                if (self.dataElement.oclIsTypeOf(Variable)) then&#xA;&#x9;                                    self.dataElement.oclAsType(Variable).dataType&#xA;&#x9;                                else&#xA;                                    &#x9;null&#xA;                                    endif&#xA;                                endif&#xA;                            endif &#xA;                        endif&#xA;                    endif&#xA;                else &#xA;                    if (self.container().oclIsTypeOf(MemberAssignment)) then&#xA;                        self.container().oclAsType(MemberAssignment).member.dataType&#xA;                    else &#xA;                        if (self.container().oclIsTypeOf(ParameterBinding)) then&#xA;                        &#x9;self.container().oclAsType(ParameterBinding).resolveParameterType()&#xA;                        else&#xA;                            if (self.container().oclIsTypeOf(CollectionDataInstance)) then&#xA;                                self.container().oclAsType(CollectionDataInstance).dataType.oclAsType(CollectionDataType).itemType&#xA;                            else&#xA;                                if (self.container().oclIsTypeOf(DataElementUse)) then&#xA;                                &#x9;if (self.container().oclAsType(DataElementUse).resolveDataType()->isEmpty()) then&#xA;                                &#x9;&#x9;null&#xA;                                &#x9;else&#xA;                                    &#x9;self.container().oclAsType(DataElementUse).resolveDataType().oclAsType(CollectionDataType).itemType&#xA;                                &#x9;endif&#xA;                                else&#xA;                                    if (self.container().oclIsTypeOf(DataInstanceUse)) then&#xA;&#x9;                                &#x9;if (self.container().oclAsType(DataInstanceUse).resolveDataType()->isEmpty()) then&#xA;&#x9;                                &#x9;&#x9;null&#xA;&#x9;                                &#x9;else&#xA;                                        &#x9;self.container().oclAsType(DataInstanceUse).resolveDataType().oclAsType(CollectionDataType).itemType&#xA;&#x9;                                &#x9;endif&#xA;                                    else&#xA;                                        if (self.container().oclIsKindOf(Parameter)) then&#xA;                                            self.container().oclAsType(Parameter).dataType&#xA;                                        else&#xA;                                            if (self.container().oclIsTypeOf(SimpleDataInstance)) then&#xA;                                                self.container().oclAsType(SimpleDataInstance).dataType&#xA;                                            else&#xA;                                                null&#xA;                                            endif&#xA;                                        endif&#xA;                                    endif&#xA;                                endif&#xA;                            endif&#xA;                        endif&#xA;                    endif&#xA;                endif&#xA;                "/>
        <details key="body" value="&#xA;                if (not self.dataElement.oclIsUndefined()) then&#xA;                    if (self.dataElement.oclIsKindOf(DataType)) then&#xA;                        self.dataElement.oclAsType(DataType)&#xA;                    else&#xA;                        if (self.dataElement.oclIsKindOf(DataInstance)) then&#xA;                            self.dataElement.oclAsType(DataInstance).dataType&#xA;                        else &#xA;                            if (self.dataElement.oclIsTypeOf(FormalParameter)) then&#xA;                                self.dataElement.oclAsType(FormalParameter).dataType&#xA;                            else &#xA;                                if (self.dataElement.oclIsTypeOf(Function)) then&#xA;                                    self.dataElement.oclAsType(Function).returnType&#xA;                                else&#xA;&#x9;                                if (self.dataElement.oclIsTypeOf(Variable)) then&#xA;&#x9;                                    self.dataElement.oclAsType(Variable).dataType&#xA;&#x9;                                else&#xA;                                    &#x9;null&#xA;                                    endif&#xA;                                endif&#xA;                            endif &#xA;                        endif&#xA;                    endif&#xA;                else &#xA;                    self.resolveBaseDataTypeFromContainer()                &#xA;                endif&#xA;                "/>
      </eAnnotations>
    </eOperations>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="unassignedMember" eType="#//UnassignedMemberTreatment"/>