private void  fromJSONFlightSegments(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 FlightSegments of FlightBookingInformationNuggetJSON is not an array.");
        }
        int count1 = json_array1.componentCount();
        List <FlightSegmentJSON> vector_FlightSegments1 = new List <FlightSegmentJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            FlightSegmentJSON convert_classy = FlightSegmentJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_FlightSegments1.Add(convert_classy);
        }
        initFlightSegments();
        for (int num2 = 0; num2 < vector_FlightSegments1.Count; ++num2)
        {
            appendFlightSegments(vector_FlightSegments1[num2]);
        }
        for (int num1 = 0; num1 < vector_FlightSegments1.Count; ++num1)
        {
        }
    }
 public void appendFlightSegments(FlightSegmentJSON to_append)
 {
     if (!flagHasFlightSegments)
     {
         flagHasFlightSegments = true;
         storeFlightSegments.Clear();
     }
     Debug.Assert(flagHasFlightSegments);
     storeFlightSegments.Add(to_append);
 }
示例#3
0
        protected override void finish()
        {
            FlightSegmentJSON result = new FlightSegmentJSON();

            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.extraFlightSegmentAppendPair(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);
        }
示例#4
0
 protected abstract void handle_result(FlightSegmentJSON new_result);
示例#5
0
 protected void finish(FlightSegmentJSON result)
 {
     if (fieldGeneratorFlightSegmentID.have_value)
     {
         result.setFlightSegmentID(fieldGeneratorFlightSegmentID.value);
         fieldGeneratorFlightSegmentID.have_value = false;
     }
     else if ((!(result.hasFlightSegmentID())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"FlightSegmentID\" field was missing.");
     }
     if (fieldGeneratorDepartureAirport.have_value)
     {
         result.setDepartureAirport(fieldGeneratorDepartureAirport.value);
         fieldGeneratorDepartureAirport.have_value = false;
     }
     else if ((!(result.hasDepartureAirport())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"DepartureAirport\" field was missing.");
     }
     if (fieldGeneratorArrivalAirport.have_value)
     {
         result.setArrivalAirport(fieldGeneratorArrivalAirport.value);
         fieldGeneratorArrivalAirport.have_value = false;
     }
     else if ((!(result.hasArrivalAirport())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"ArrivalAirport\" field was missing.");
     }
     if (fieldGeneratorDepartureDateTime.have_value)
     {
         result.setDepartureDateTime(fieldGeneratorDepartureDateTime.value);
         fieldGeneratorDepartureDateTime.have_value = false;
     }
     else if ((!(result.hasDepartureDateTime())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"DepartureDateTime\" field was missing.");
     }
     if (fieldGeneratorArrivalDateTime.have_value)
     {
         result.setArrivalDateTime(fieldGeneratorArrivalDateTime.value);
         fieldGeneratorArrivalDateTime.have_value = false;
     }
     else if ((!(result.hasArrivalDateTime())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"ArrivalDateTime\" field was missing.");
     }
     if (fieldGeneratorAirlineFlightNumber.have_value)
     {
         result.setAirlineFlightNumber(fieldGeneratorAirlineFlightNumber.value);
         fieldGeneratorAirlineFlightNumber.have_value = false;
     }
     else if ((!(result.hasAirlineFlightNumber())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"AirlineFlightNumber\" field was missing.");
     }
     if (fieldGeneratorOperatingCarrier.have_value)
     {
         result.setOperatingCarrier(fieldGeneratorOperatingCarrier.value);
         fieldGeneratorOperatingCarrier.have_value = false;
     }
     if (fieldGeneratorFlightDuration.have_value)
     {
         result.setFlightDurationText(fieldGeneratorFlightDuration.value);
         fieldGeneratorFlightDuration.have_value = false;
     }
     else if ((!(result.hasFlightDuration())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"FlightDuration\" field was missing.");
     }
 }
示例#6
0
 protected override void handle_result(FlightSegmentJSON result)
 {
     top.value.Add(result);
 }
示例#7
0
        protected override void handle_result(FlightSegmentJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }