private void fromJSONValues(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 Values of RandomNumberGeneratorNumberRequestResultJSON is not an array."); } int count1 = json_array1.componentCount(); if (count1 < 1) { throw new Exception("The value for field Values of RandomNumberGeneratorNumberRequestResultJSON has too few elements."); } List <Double> vector_Values1 = new List <Double>(count1); for (int num1 = 0; num1 < count1; ++num1) { JSONRationalValue json_rational = json_array1.component(num1).rational_value(); double the_double; if (json_rational != null) { the_double = json_rational.getDouble(); } else { JSONIntegerValue json_integer = json_array1.component(num1).integer_value(); if (json_integer != null) { the_double = json_integer.getLongInt(); } else { throw new Exception("The value for an element of field Values of RandomNumberGeneratorNumberRequestResultJSON is not a number."); } } vector_Values1.Add(the_double); } Debug.Assert(vector_Values1.Count >= 1); initValues(); for (int num1 = 0; num1 < vector_Values1.Count; ++num1) { appendValues(vector_Values1[num1]); } for (int num1 = 0; num1 < vector_Values1.Count; ++num1) { } }
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; } }
private void fromJSONDelay(JSONValue json_value, bool ignore_extras) { Debug.Assert(json_value != null); TypeDelay or_result = new TypeDelay(); bool or_done = false; 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."); } } or_result.u.choice0 = the_double; or_result.key = 0; or_done = true; } catch (Exception) { } } if (!or_done) { try { or_result.key = 1; or_done = true; } catch (Exception) { } } if (!or_done) { throw new Exception("The value for field Delay of StockFundamentalsJSON is not one of the allowed values."); } setDelay(or_result); switch (or_result.key) { case 0: break; case 1: break; default: Debug.Assert(false); break; } }
private void fromJSONRemoteDelay(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 RemoteDelay of StockRequestedListingJSON is not an array."); } int count1 = json_array1.componentCount(); List <TypeRemoteDelay> vector_RemoteDelay1 = new List <TypeRemoteDelay>(count1); for (int num1 = 0; num1 < count1; ++num1) { TypeRemoteDelay or_result = new TypeRemoteDelay(); bool or_done = false; if (!or_done) { try { JSONRationalValue json_rational = json_array1.component(num1).rational_value(); double the_double; if (json_rational != null) { the_double = json_rational.getDouble(); } else { JSONIntegerValue json_integer = json_array1.component(num1).integer_value(); if (json_integer != null) { the_double = json_integer.getLongInt(); } else { throw new Exception("The value for ??? is not a number."); } } or_result.u.choice0 = the_double; or_result.key = 0; or_done = true; } catch (Exception) { } } if (!or_done) { try { or_result.key = 1; or_done = true; } catch (Exception) { } } if (!or_done) { throw new Exception("The value for an element of field RemoteDelay of StockRequestedListingJSON is not one of the allowed values."); } vector_RemoteDelay1.Add(or_result); } initRemoteDelay(); for (int num1 = 0; num1 < vector_RemoteDelay1.Count; ++num1) { appendRemoteDelay(vector_RemoteDelay1[num1]); } for (int num1 = 0; num1 < vector_RemoteDelay1.Count; ++num1) { switch (vector_RemoteDelay1[num1].key) { case 0: break; case 1: break; default: Debug.Assert(false); break; } } }