Paste: manually edited JetBrains MPS model

Author: avodonosov
Mode: xml
Date: Mon, 5 Jan 2009 01:10:45
Plain Text |
<?xml version="1.0" encoding="UTF-8"?>
<model modelUID="r:3a01c714-3bb5-49c6-b0be-032775218f87(mpscalc.sandbox.sandbox)">
  <persistence version="3" />
  <refactoringHistory />
  <language namespace="5b3d4e19-b169-4fd5-8138-ce9d8b35da37(mpscalc)" />
  <language namespace="f3061a53-9226-4cc5-a443-f952ceaf5816(jetbrains.mps.baseLanguage)" />
  <languageAspect modelUID="r:00000000-0000-4000-0000-011c89590402(jetbrains.mps.baseLanguage.strings.structure)" version="9" />
  <languageAspect modelUID="r:00000000-0000-4000-0000-011c895902ca(jetbrains.mps.baseLanguage.structure)" version="1" />
  <languageAspect modelUID="r:00000000-0000-4000-0000-011c89590283(jetbrains.mps.lang.core.constraints)" version="2" />
  <languageAspect modelUID="r:00000000-0000-4000-0000-011c89590288(jetbrains.mps.lang.core.structure)" version="0" />
  <languageAspect modelUID="r:00000000-0000-4000-0000-011c895902db(jetbrains.mps.baseLanguage.blTypes.constraints)" version="0" />
  <languageAspect modelUID="r:00000000-0000-4000-0000-011c895902c1(jetbrains.mps.baseLanguage.constraints)" version="83" />
  <languageAspect modelUID="r:00000000-0000-4000-0000-011c895903fe(jetbrains.mps.baseLanguage.strings.constraints)" version="1" />
  <maxImportIndex value="5" />
  <import index="1" modelUID="f:java_stub#javax.swing.text(javax.swing.text@java_stub)" version="-1" />
  <import index="2" modelUID="f:java_stub#javax.swing.event(javax.swing.event@java_stub)" version="-1" />
  <import index="3" modelUID="f:java_stub#java.lang(java.lang@java_stub)" version="-1" />
  <import index="4" modelUID="f:java_stub#javax.swing(javax.swing@java_stub)" version="-1" />
  <import index="5" modelUID="f:java_stub#java.awt(java.awt@java_stub)" version="-1" />
  <node type="mpscalc.structure.Calculator" id="1230442046160">
    <property name="name" value="MyCalc2" />
    <node role="outputField" type="mpscalc.structure.OutputField" id="1230442097037">
      <node role="expression" type="jetbrains.mps.baseLanguage.structure.MulExpression" id="1230443439701">
        <node role="leftExpression" type="mpscalc.structure.InputFieldReference" id="1230443438997">
          <link role="inputFieldx" targetNodeId="1230442675269" resolveInfo="count" />
        </node>
        <node role="rightExpression" type="mpscalc.structure.InputFieldReference" id="1230443443783">
          <link role="inputFieldx" targetNodeId="1230442658783" resolveInfo="price" />
        </node>
      </node>
    </node>
    <node role="inputField" type="mpscalc.structure.InputField" id="1230442658783">
      <property name="name" value="price" />
    </node>
    <node role="inputField" type="mpscalc.structure.InputField" id="1230442675269">
      <property name="name" value="count" />
    </node>
    
    <!-- 
         ==================================
          the code below is added manually 
         ==================================
     -->
    <node role="inputField" type="mpscalc.structure.InputField" id="7777777777701">
      <property name="name" value="distance" />
    </node>
    <node role="inputField" type="mpscalc.structure.InputField" id="7777777777702">
      <property name="name" value="distanceFactor" />
    </node>

    <!-- Output = distance * distanceFactor / (count == 0 || price == 0 ? 1 : price * count) -->
    <node role="outputField" type="mpscalc.structure.OutputField" id="7777777777703">

      <node role="expression" type="jetbrains.mps.baseLanguage.structure.DivExpression" id="7777777777707">
      
       <!-- distance * distanceFactor -->
        <node role="leftExpression" type="jetbrains.mps.baseLanguage.structure.MulExpression" id="7777777777704">
          <node role="leftExpression" type="mpscalc.structure.InputFieldReference" id="7777777777705">
            <link role="inputFieldx" targetNodeId="7777777777701" resolveInfo="distance" />
          </node>
          <node role="rightExpression" type="mpscalc.structure.InputFieldReference" id="7777777777706">
            <link role="inputFieldx" targetNodeId="7777777777702" resolveInfo="price" />
          </node>
        </node>

        <node role="rightExpression" type="jetbrains.mps.baseLanguage.structure.TernaryOperatorExpression" id="7777777777715">

            <!--  count == 0 || price == 0 -->
            <node role="condition" type="jetbrains.mps.baseLanguage.structure.OrExpression" id="7777777777716">

                <!-- count == 0 -->
                <node role="leftExpression" type="jetbrains.mps.baseLanguage.structure.EqualsExpression" id="7777777777711">
                  <node role="leftExpression" type="mpscalc.structure.InputFieldReference" id="7777777777712">
                    <link role="inputFieldx" targetNodeId="1230442675269" resolveInfo="count" />
                  </node>
                  <node role="rightExpression" type="jetbrains.mps.baseLanguage.structure.IntegerConstant" id="7777777777713">
                    <property name="value" value="0"/>
                  </node>
                </node>

                <!-- price == 0 -->
                <node role="rightExpression" type="jetbrains.mps.baseLanguage.structure.EqualsExpression" id="7777777777717">
                  <node role="leftExpression" type="mpscalc.structure.InputFieldReference" id="7777777777718">
                    <link role="inputFieldx" targetNodeId="1230442658783" resolveInfo="price" />
                  </node>
                  <node role="rightExpression" type="jetbrains.mps.baseLanguage.structure.IntegerConstant" id="7777777777719">
                    <property name="value" value="0"/>
                  </node>
                </node>
            </node>

            <!-- 1 -->
            <node role="ifTrue" type="jetbrains.mps.baseLanguage.structure.IntegerConstant" id="7777777777714">
              <property name="value" value="1"/>
            </node>

            <!-- price * count -->
            <node role="ifFalse" type="jetbrains.mps.baseLanguage.structure.MulExpression" id="7777777777708">
              <node role="leftExpression" type="mpscalc.structure.InputFieldReference" id="7777777777709">
                <link role="inputFieldx" targetNodeId="1230442675269" resolveInfo="count" />
              </node>
              <node role="rightExpression" type="mpscalc.structure.InputFieldReference" id="7777777777710">
                <link role="inputFieldx" targetNodeId="1230442658783" resolveInfo="price" />
              </node>
            </node>
        </node>
      </node>
      
    </node>

  </node>
</model>

New Annotation

Summary:
Author:
Mode:
Body: