private void  fromJSONPayment(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        MoneyJSON convert_classy = MoneyJSON.from_json(json_value, ignore_extras, true);

        setPayment(convert_classy);
    }
Ejemplo n.º 2
0
 protected void finish(MoneyJSON result)
 {
     if (fieldGeneratorCode.have_value)
     {
         result.setCode(fieldGeneratorCode.value);
         fieldGeneratorCode.have_value = false;
     }
     else if ((!(result.hasCode())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Code\" field was missing.");
     }
     if (fieldGeneratorSymbol.have_value)
     {
         result.setSymbol(fieldGeneratorSymbol.value);
         fieldGeneratorSymbol.have_value = false;
     }
     else if ((!(result.hasSymbol())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Symbol\" field was missing.");
     }
     if (fieldGeneratorAmount.have_value)
     {
         result.setAmountText(fieldGeneratorAmount.value);
         fieldGeneratorAmount.have_value = false;
     }
     else if ((!(result.hasAmount())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Amount\" field was missing.");
     }
 }
    private void  fromJSONInputValue(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 InputValue of CurrencyConversionJSON is not an array.");
        }
        int count1 = json_array1.componentCount();

        if (count1 < 1)
        {
            throw new Exception("The value for field InputValue of CurrencyConversionJSON has too few elements.");
        }
        List <MoneyJSON> vector_InputValue1 = new List <MoneyJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            MoneyJSON convert_classy = MoneyJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_InputValue1.Add(convert_classy);
        }
        Debug.Assert(vector_InputValue1.Count >= 1);
        initInputValue();
        for (int num1 = 0; num1 < vector_InputValue1.Count; ++num1)
        {
            appendInputValue(vector_InputValue1[num1]);
        }
        for (int num1 = 0; num1 < vector_InputValue1.Count; ++num1)
        {
        }
    }
 public void setPayment(MoneyJSON new_value)
 {
     if (flagHasPayment)
     {
     }
     flagHasPayment = true;
     storePayment   = new_value;
 }
Ejemplo n.º 5
0
 public void setMonetaryAmount(MoneyJSON new_value)
 {
     if (flagHasMonetaryAmount)
     {
     }
     flagHasMonetaryAmount = true;
     storeMonetaryAmount   = new_value;
 }
 public void setHomeValue(MoneyJSON new_value)
 {
     if (flagHasHomeValue)
     {
     }
     flagHasHomeValue = true;
     storeHomeValue   = new_value;
 }
Ejemplo n.º 7
0
        protected override void finish()
        {
            MoneyJSON result = new MoneyJSON();

            Debug.Assert(result != null);
            finish(result);
            handle_result(result);
        }
Ejemplo n.º 8
0
 public void setPrincipal(MoneyJSON new_value)
 {
     if (flagHasPrincipal)
     {
     }
     flagHasPrincipal = true;
     storePrincipal   = new_value;
 }
 public void setConvertedValue(MoneyJSON new_value)
 {
     if (flagHasConvertedValue)
     {
     }
     flagHasConvertedValue = true;
     storeConvertedValue   = new_value;
 }
 public void appendInputValue(MoneyJSON to_append)
 {
     if (!flagHasInputValue)
     {
         flagHasInputValue = true;
         storeInputValue.Clear();
     }
     Debug.Assert(flagHasInputValue);
     storeInputValue.Add(to_append);
 }
    private void  fromJSONDownPayment(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        TypeDownPayment or_result = new TypeDownPayment();
        bool            or_done   = false;

        if (!or_done)
        {
            try
            {
                MoneyJSON convert_classy = MoneyJSON.from_json(json_value, ignore_extras, true);
                or_result.u.choice0 = convert_classy;
                or_result.key       = 0;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            try
            {
                JSONRationalValue json_rational = json_value.rational_value();
                double            the_double;
                if (json_rational != null)
                {
                    the_double = json_rational.getDouble();
                }
                else
                {
                    JSONIntegerValue json_integer = json_value.integer_value();
                    if (json_integer != null)
                    {
                        the_double = json_integer.getLongInt();
                    }
                    else
                    {
                        throw new Exception("The value for ??? is not a number.");
                    }
                }
                if (the_double < 0)
                {
                    throw new Exception("The value for ??? is less than the lower bound (0) for that field.");
                }
                or_result.u.choice1 = the_double;
                or_result.key       = 1;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            throw new Exception("The value for field DownPayment of MortgageCalculatorInputVariableDownPaymentJSON is not one of the allowed values.");
        }
        setDownPayment(or_result);
        switch (or_result.key)
        {
        case 0:
            break;

        case 1:
            break;

        default:
            Debug.Assert(false);
            break;
        }
    }
Ejemplo n.º 12
0
 protected override void handle_result(MoneyJSON result)
 {
     top.value.Add(result);
 }
Ejemplo n.º 13
0
        protected override void handle_result(MoneyJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
Ejemplo n.º 14
0
 protected abstract void handle_result(MoneyJSON new_result);