Esempio n. 1
0
    private void  fromJSONSunkShip(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        BattleshipShipTypeJSON convert_classy = BattleshipShipTypeJSON.from_json(json_value, ignore_extras, true);

        setSunkShip(convert_classy);
    }
Esempio n. 2
0
    private void  fromJSONShipLocations(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 ShipLocations of BattleshipPlayerDataJSON is not an array.");
        }
        int count1 = json_array1.componentCount();
        List <BattleshipShipTypeJSON> vector_ShipLocations1 = new List <BattleshipShipTypeJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            BattleshipShipTypeJSON convert_classy = BattleshipShipTypeJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_ShipLocations1.Add(convert_classy);
        }
        initShipLocations();
        for (int num2 = 0; num2 < vector_ShipLocations1.Count; ++num2)
        {
            appendShipLocations(vector_ShipLocations1[num2]);
        }
        for (int num1 = 0; num1 < vector_ShipLocations1.Count; ++num1)
        {
        }
    }
 protected void finish(BattleshipShipTypeJSON result)
 {
     if (fieldGeneratorShipName.have_value)
     {
         result.setShipName(fieldGeneratorShipName.value);
         fieldGeneratorShipName.have_value = false;
     }
     else if ((!(result.hasShipName())) && !allow_incomplete)
     {
         error("When parsing the object for %what%, the \"ShipName\" field was missing.");
     }
     if (fieldGeneratorDirection.have_value)
     {
         result.setDirection(fieldGeneratorDirection.value);
         fieldGeneratorDirection.have_value = false;
     }
     if (fieldGeneratorLength.have_value)
     {
         result.setLength(fieldGeneratorLength.value);
         fieldGeneratorLength.have_value = false;
     }
     if (fieldGeneratorShipCoordinate.have_value)
     {
         result.setShipCoordinate(fieldGeneratorShipCoordinate.value);
         fieldGeneratorShipCoordinate.have_value = false;
     }
 }
Esempio n. 4
0
 public void setSunkShip(BattleshipShipTypeJSON new_value)
 {
     if (flagHasSunkShip)
     {
     }
     flagHasSunkShip = true;
     storeSunkShip   = new_value;
 }
Esempio n. 5
0
 public void appendShipLocations(BattleshipShipTypeJSON to_append)
 {
     if (!flagHasShipLocations)
     {
         flagHasShipLocations = true;
         storeShipLocations.Clear();
     }
     Debug.Assert(flagHasShipLocations);
     storeShipLocations.Add(to_append);
 }
        protected override void finish()
        {
            BattleshipShipTypeJSON result = new BattleshipShipTypeJSON();

            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.extraBattleshipShipTypeAppendPair(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(BattleshipShipTypeJSON result)
 {
     top.value.Add(result);
 }
        protected override void handle_result(BattleshipShipTypeJSON result)
        {
//@@@            Debug.Assert(!have_value);
            have_value = true;
            value      = result;
        }
 protected abstract void handle_result(BattleshipShipTypeJSON new_result);