protected void finish(FlightSegmentGroupJSON result)
 {
     if (fieldGeneratorTotalTravelDuration.have_value)
     {
         result.setTotalTravelDurationText(fieldGeneratorTotalTravelDuration.value);
         fieldGeneratorTotalTravelDuration.have_value = false;
     }
     else if ((!(result.hasTotalTravelDuration())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"TotalTravelDuration\" field was missing.");
     }
     if (fieldGeneratorTotalFlightDuration.have_value)
     {
         result.setTotalFlightDurationText(fieldGeneratorTotalFlightDuration.value);
         fieldGeneratorTotalFlightDuration.have_value = false;
     }
     else if ((!(result.hasTotalFlightDuration())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"TotalFlightDuration\" field was missing.");
     }
     if (fieldGeneratorTotalLayoverDuration.have_value)
     {
         result.setTotalLayoverDurationText(fieldGeneratorTotalLayoverDuration.value);
         fieldGeneratorTotalLayoverDuration.have_value = false;
     }
     else if ((!(result.hasTotalLayoverDuration())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"TotalLayoverDuration\" field was missing.");
     }
     if (fieldGeneratorNumberOfStops.have_value)
     {
         result.setNumberOfStops(fieldGeneratorNumberOfStops.value);
         fieldGeneratorNumberOfStops.have_value = false;
     }
     else if ((!(result.hasNumberOfStops())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"NumberOfStops\" field was missing.");
     }
     if (fieldGeneratorFlightSegmentDetails.have_value)
     {
         result.initFlightSegmentDetails();
         int count = fieldGeneratorFlightSegmentDetails.value.Count;
         for (int num = 0; num < count; ++num)
         {
             result.appendFlightSegmentDetails(fieldGeneratorFlightSegmentDetails.value[num]);
         }
         fieldGeneratorFlightSegmentDetails.value.Clear();
         fieldGeneratorFlightSegmentDetails.have_value = false;
     }
     else if ((!(result.hasFlightSegmentDetails())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"FlightSegmentDetails\" field was missing.");
     }
 }
        protected override void finish()
        {
            FlightSegmentGroupJSON result = new FlightSegmentGroupJSON();

            Debug.Assert(result != null);
            finish(result);
            int extra_count = unknownFieldGenerator.field_names.Count;

            Debug.Assert(extra_count == unknownFieldGenerator.field_values.Count);
            for (int extra_num = 0; extra_num < extra_count; ++extra_num)
            {
                result.extraFlightSegmentGroupAppendPair(unknownFieldGenerator.field_names[extra_num], unknownFieldGenerator.field_values[extra_num]);
            }
            unknownFieldGenerator.field_names.Clear();
            unknownFieldGenerator.field_values.Clear();
            unknownFieldGenerator.index = new Dictionary <string, JSONValue>();
            handle_result(result);
        }
        protected override void handle_result(FlightSegmentGroupJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
 protected abstract void handle_result(FlightSegmentGroupJSON new_result);
 protected override void handle_result(FlightSegmentGroupJSON result)
 {
     top.value.Add(result);
 }