示例#1
0
    private void  fromJSONOutputValue(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        JSONArrayValue json_array1 = json_value.array_value();

        if (json_array1 == null)
        {
            throw new Exception("The value for field OutputValue of UnitConverterQueryStateJSON is not an array.");
        }
        int count1 = json_array1.componentCount();
        List <MeasuredAmountJSON> vector_OutputValue1 = new List <MeasuredAmountJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            MeasuredAmountJSON convert_classy = MeasuredAmountJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_OutputValue1.Add(convert_classy);
        }
        initOutputValue();
        for (int num2 = 0; num2 < vector_OutputValue1.Count; ++num2)
        {
            appendOutputValue(vector_OutputValue1[num2]);
        }
        for (int num1 = 0; num1 < vector_OutputValue1.Count; ++num1)
        {
        }
    }
示例#2
0
        protected override void finish()
        {
            MeasuredAmountJSON result = new MeasuredAmountJSON();

            Debug.Assert(result != null);
            finish(result);
            handle_result(result);
        }
示例#3
0
 public void appendOutputValue(MeasuredAmountJSON to_append)
 {
     if (!flagHasOutputValue)
     {
         flagHasOutputValue = true;
         storeOutputValue.Clear();
     }
     Debug.Assert(flagHasOutputValue);
     storeOutputValue.Add(to_append);
 }
示例#4
0
 protected override void handle_result(MeasuredAmountJSON result)
 {
     top.value.Add(result);
 }
示例#5
0
        protected override void handle_result(MeasuredAmountJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
示例#6
0
 protected abstract void handle_result(MeasuredAmountJSON new_result);
示例#7
0
 protected void finish(MeasuredAmountJSON result)
 {
     if (fieldGeneratorUnit.have_value)
     {
         result.setUnit(fieldGeneratorUnit.value);
         fieldGeneratorUnit.have_value = false;
     }
     else if ((!(result.hasUnit())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Unit\" field was missing.");
     }
     if (fieldGeneratorSingularName.have_value)
     {
         result.setSingularName(fieldGeneratorSingularName.value);
         fieldGeneratorSingularName.have_value = false;
     }
     else if ((!(result.hasSingularName())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"SingularName\" field was missing.");
     }
     if (fieldGeneratorPluralName.have_value)
     {
         result.setPluralName(fieldGeneratorPluralName.value);
         fieldGeneratorPluralName.have_value = false;
     }
     else if ((!(result.hasPluralName())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"PluralName\" field was missing.");
     }
     if (fieldGeneratorAbbreviatedName.have_value)
     {
         result.setAbbreviatedName(fieldGeneratorAbbreviatedName.value);
         fieldGeneratorAbbreviatedName.have_value = false;
     }
     if (fieldGeneratorReferenceUnitsPerUnit.have_value)
     {
         result.setReferenceUnitsPerUnitText(fieldGeneratorReferenceUnitsPerUnit.value);
         fieldGeneratorReferenceUnitsPerUnit.have_value = false;
     }
     else if ((!(result.hasReferenceUnitsPerUnit())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"ReferenceUnitsPerUnit\" field was missing.");
     }
     if (fieldGeneratorUnitsPerReferenceUnit.have_value)
     {
         result.setUnitsPerReferenceUnitText(fieldGeneratorUnitsPerReferenceUnit.value);
         fieldGeneratorUnitsPerReferenceUnit.have_value = false;
     }
     else if ((!(result.hasUnitsPerReferenceUnit())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"UnitsPerReferenceUnit\" field was missing.");
     }
     if (fieldGeneratorValue.have_value)
     {
         result.setValueText(fieldGeneratorValue.value);
         fieldGeneratorValue.have_value = false;
     }
     else if ((!(result.hasValue())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Value\" field was missing.");
     }
 }