protected override void finish(int winning_index) { TypeDownPayment result = new TypeDownPayment(); result.key = winning_index; switch (winning_index) { case 0: { Debug.Assert(field0.have_value); result.u.choice0 = field0.value; break; } case 1: { Debug.Assert(field1.have_value); result.u.choice1 = Double.Parse(field1.value); break; } default: { Debug.Assert(false); break; } } handle_result(result); }
public HolderDownPayment(HolderDownPayment other) { have_data = other.haveData(); data = other.referenced(); if (have_data) { } }
public HolderDownPayment(TypeDownPayment init_data) { have_data = true; data = init_data; if (have_data) { } }
public void setDownPayment(TypeDownPayment new_value) { switch (new_value.key) { case 0: break; case 1: break; default: Debug.Assert(false); break; } if (flagHasDownPayment) { switch (storeDownPayment.key) { case 0: break; case 1: break; default: Debug.Assert(false); break; } } flagHasDownPayment = true; switch (new_value.key) { case 0: break; case 1: if (new_value.u.choice1 < 0) { throw new Exception("The value for case 1 of field DownPayment of MortgageCalculatorInputVariableDownPaymentJSON is less than the lower bound (0) for that field."); } break; default: Debug.Assert(false); break; } storeDownPayment = new_value; }
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; } }
protected override void handle_result(TypeDownPayment result) { top.value.Add(result); }
protected override void handle_result(TypeDownPayment result) { //@@@ Debug.Assert(!have_value); have_value = true; value = new HolderDownPayment(result); }
protected abstract void handle_result(TypeDownPayment result);