示例#1
0
    private void  fromJSONTeams(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 Teams of SportsSeriesStatusNewJSON is not an array.");
        }
        int count1 = json_array1.componentCount();

        if (count1 < 2)
        {
            throw new Exception("The value for field Teams of SportsSeriesStatusNewJSON has too few elements.");
        }
        List <SportsTeamNewJSON> vector_Teams1 = new List <SportsTeamNewJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            SportsTeamNewJSON convert_classy = SportsTeamNewJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_Teams1.Add(convert_classy);
        }
        Debug.Assert(vector_Teams1.Count >= 2);
        initTeams();
        for (int num1 = 0; num1 < vector_Teams1.Count; ++num1)
        {
            appendTeams(vector_Teams1[num1]);
        }
        for (int num1 = 0; num1 < vector_Teams1.Count; ++num1)
        {
        }
    }
示例#2
0
    private void  fromJSONTeam(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        SportsTeamNewJSON convert_classy = SportsTeamNewJSON.from_json(json_value, ignore_extras, true);

        setTeam(convert_classy);
    }
示例#3
0
 public void setTeam(SportsTeamNewJSON new_value)
 {
     if (flagHasTeam)
     {
     }
     flagHasTeam = true;
     storeTeam   = new_value;
 }
示例#4
0
 public void appendTeams(SportsTeamNewJSON to_append)
 {
     if (!flagHasTeams)
     {
         flagHasTeams = true;
         storeTeams.Clear();
     }
     Debug.Assert(flagHasTeams);
     storeTeams.Add(to_append);
 }
示例#5
0
    private void  fromJSONValue(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        TypeValue or_result = new TypeValue();
        bool      or_done   = false;

        if (!or_done)
        {
            try
            {
                SportsTeamNewJSON convert_classy = SportsTeamNewJSON.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
            {
                SportsPlayerJSON convert_classy = SportsPlayerJSON.from_json(json_value, ignore_extras, true);
                or_result.u.choice1 = convert_classy;
                or_result.key       = 1;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            throw new Exception("The value for field Value of SportsTeamOrPlayerJSON is not one of the allowed values.");
        }
        setValue(or_result);
        switch (or_result.key)
        {
        case 0:
            break;

        case 1:
            break;

        default:
            Debug.Assert(false);
            break;
        }
    }
示例#6
0
        protected override void finish()
        {
            SportsTeamNewJSON result = new SportsTeamNewJSON();

            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.extraSportsTeamNewAppendPair(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);
        }
示例#7
0
 protected override void handle_result(SportsTeamNewJSON result)
 {
     top.value.Add(result);
 }
示例#8
0
        protected override void handle_result(SportsTeamNewJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
示例#9
0
 protected abstract void handle_result(SportsTeamNewJSON new_result);
示例#10
0
 protected void finish(SportsTeamNewJSON result)
 {
     if (fieldGeneratorName.have_value)
     {
         result.setName(fieldGeneratorName.value);
         fieldGeneratorName.have_value = false;
     }
     else if ((!(result.hasName())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"Name\" field was missing.");
     }
     if (fieldGeneratorNameShort.have_value)
     {
         result.setNameShort(fieldGeneratorNameShort.value);
         fieldGeneratorNameShort.have_value = false;
     }
     if (fieldGeneratorAlias.have_value)
     {
         result.setAlias(fieldGeneratorAlias.value);
         fieldGeneratorAlias.have_value = false;
     }
     if (fieldGeneratorLeague.have_value)
     {
         result.setLeague(fieldGeneratorLeague.value);
         fieldGeneratorLeague.have_value = false;
     }
     else if ((!(result.hasLeague())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"League\" field was missing.");
     }
     if (fieldGeneratorLatitude.have_value)
     {
         result.setLatitudeText(fieldGeneratorLatitude.value);
         fieldGeneratorLatitude.have_value = false;
     }
     if (fieldGeneratorLongitude.have_value)
     {
         result.setLongitudeText(fieldGeneratorLongitude.value);
         fieldGeneratorLongitude.have_value = false;
     }
     if (fieldGeneratorDivision.have_value)
     {
         result.setDivision(fieldGeneratorDivision.value);
         fieldGeneratorDivision.have_value = false;
     }
     if (fieldGeneratorToBeDetermined.have_value)
     {
         result.setToBeDetermined(fieldGeneratorToBeDetermined.value);
         fieldGeneratorToBeDetermined.have_value = false;
     }
     if (fieldGeneratorLogos.have_value)
     {
         result.initLogos();
         int count = fieldGeneratorLogos.value.Count;
         for (int num = 0; num < count; ++num)
         {
             result.appendLogos(fieldGeneratorLogos.value[num]);
         }
         fieldGeneratorLogos.value.Clear();
         fieldGeneratorLogos.have_value = false;
     }
     if (fieldGeneratorID.have_value)
     {
         result.setID(fieldGeneratorID.value);
         fieldGeneratorID.have_value = false;
     }
 }