"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cast_de_nrw_schule_svws_core_data_gost_GostBlockungsdaten = exports.GostBlockungsdaten = void 0; const JavaObject_1 = require("../../../java/lang/JavaObject"); const GostBlockungSchiene_1 = require("../../../core/data/gost/GostBlockungSchiene"); const GostBlockungRegel_1 = require("../../../core/data/gost/GostBlockungRegel"); const Vector_1 = require("../../../java/util/Vector"); const GostBlockungKurs_1 = require("../../../core/data/gost/GostBlockungKurs"); class GostBlockungsdaten extends JavaObject_1.JavaObject { id = -1; name = "Neue Blockung"; gostHalbjahr = 0; schienen = new Vector_1.Vector(); regeln = new Vector_1.Vector(); kurse = new Vector_1.Vector(); constructor() { super(); } isTranspiledInstanceOf(name) { return ['de.nrw.schule.svws.core.data.gost.GostBlockungsdaten'].includes(name); } static transpilerFromJSON(json) { const obj = JSON.parse(json); const result = new GostBlockungsdaten(); if (typeof obj.id === "undefined") throw new Error('invalid json format, missing attribute id'); result.id = obj.id; if (typeof obj.name === "undefined") throw new Error('invalid json format, missing attribute name'); result.name = obj.name; if (typeof obj.gostHalbjahr === "undefined") throw new Error('invalid json format, missing attribute gostHalbjahr'); result.gostHalbjahr = obj.gostHalbjahr; if (!!obj.schienen) { for (let elem of obj.schienen) { result.schienen?.add(GostBlockungSchiene_1.GostBlockungSchiene.transpilerFromJSON(JSON.stringify(elem))); } } if (!!obj.regeln) { for (let elem of obj.regeln) { result.regeln?.add(GostBlockungRegel_1.GostBlockungRegel.transpilerFromJSON(JSON.stringify(elem))); } } if (!!obj.kurse) { for (let elem of obj.kurse) { result.kurse?.add(GostBlockungKurs_1.GostBlockungKurs.transpilerFromJSON(JSON.stringify(elem))); } } return result; } static transpilerToJSON(obj) { let result = '{'; result += '"id" : ' + obj.id + ','; result += '"name" : ' + '"' + obj.name.valueOf() + '"' + ','; result += '"gostHalbjahr" : ' + obj.gostHalbjahr + ','; if (!obj.schienen) { result += '[]'; } else { result += '[ '; for (let i = 0; i < obj.schienen.size(); i++) { let elem = obj.schienen.get(i); result += GostBlockungSchiene_1.GostBlockungSchiene.transpilerToJSON(elem); if (i < obj.schienen.size() - 1) result += ','; } result += ' ]' + ','; } if (!obj.regeln) { result += '[]'; } else { result += '[ '; for (let i = 0; i < obj.regeln.size(); i++) { let elem = obj.regeln.get(i); result += GostBlockungRegel_1.GostBlockungRegel.transpilerToJSON(elem); if (i < obj.regeln.size() - 1) result += ','; } result += ' ]' + ','; } if (!obj.kurse) { result += '[]'; } else { result += '[ '; for (let i = 0; i < obj.kurse.size(); i++) { let elem = obj.kurse.get(i); result += GostBlockungKurs_1.GostBlockungKurs.transpilerToJSON(elem); if (i < obj.kurse.size() - 1) result += ','; } result += ' ]' + ','; } result = result.slice(0, -1); result += '}'; return result; } static transpilerToJSONPatch(obj) { let result = '{'; if (typeof obj.id !== "undefined") { result += '"id" : ' + obj.id + ','; } if (typeof obj.name !== "undefined") { result += '"name" : ' + '"' + obj.name.valueOf() + '"' + ','; } if (typeof obj.gostHalbjahr !== "undefined") { result += '"gostHalbjahr" : ' + obj.gostHalbjahr + ','; } if (typeof obj.schienen !== "undefined") { if (!obj.schienen) { result += '[]'; } else { result += '[ '; for (let i = 0; i < obj.schienen.size(); i++) { let elem = obj.schienen.get(i); result += GostBlockungSchiene_1.GostBlockungSchiene.transpilerToJSON(elem); if (i < obj.schienen.size() - 1) result += ','; } result += ' ]' + ','; } } if (typeof obj.regeln !== "undefined") { if (!obj.regeln) { result += '[]'; } else { result += '[ '; for (let i = 0; i < obj.regeln.size(); i++) { let elem = obj.regeln.get(i); result += GostBlockungRegel_1.GostBlockungRegel.transpilerToJSON(elem); if (i < obj.regeln.size() - 1) result += ','; } result += ' ]' + ','; } } if (typeof obj.kurse !== "undefined") { if (!obj.kurse) { result += '[]'; } else { result += '[ '; for (let i = 0; i < obj.kurse.size(); i++) { let elem = obj.kurse.get(i); result += GostBlockungKurs_1.GostBlockungKurs.transpilerToJSON(elem); if (i < obj.kurse.size() - 1) result += ','; } result += ' ]' + ','; } } result = result.slice(0, -1); result += '}'; return result; } } exports.GostBlockungsdaten = GostBlockungsdaten; function cast_de_nrw_schule_svws_core_data_gost_GostBlockungsdaten(obj) { return obj; } exports.cast_de_nrw_schule_svws_core_data_gost_GostBlockungsdaten = cast_de_nrw_schule_svws_core_data_gost_GostBlockungsdaten; //# sourceMappingURL=GostBlockungsdaten.js.map