GostBlockungsdaten.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.cast_de_nrw_schule_svws_core_data_gost_GostBlockungsdaten = exports.GostBlockungsdaten = void 0;
  4. const JavaObject_1 = require("../../../java/lang/JavaObject");
  5. const GostBlockungSchiene_1 = require("../../../core/data/gost/GostBlockungSchiene");
  6. const GostBlockungRegel_1 = require("../../../core/data/gost/GostBlockungRegel");
  7. const Vector_1 = require("../../../java/util/Vector");
  8. const GostBlockungKurs_1 = require("../../../core/data/gost/GostBlockungKurs");
  9. class GostBlockungsdaten extends JavaObject_1.JavaObject {
  10. id = -1;
  11. name = "Neue Blockung";
  12. gostHalbjahr = 0;
  13. schienen = new Vector_1.Vector();
  14. regeln = new Vector_1.Vector();
  15. kurse = new Vector_1.Vector();
  16. constructor() {
  17. super();
  18. }
  19. isTranspiledInstanceOf(name) {
  20. return ['de.nrw.schule.svws.core.data.gost.GostBlockungsdaten'].includes(name);
  21. }
  22. static transpilerFromJSON(json) {
  23. const obj = JSON.parse(json);
  24. const result = new GostBlockungsdaten();
  25. if (typeof obj.id === "undefined")
  26. throw new Error('invalid json format, missing attribute id');
  27. result.id = obj.id;
  28. if (typeof obj.name === "undefined")
  29. throw new Error('invalid json format, missing attribute name');
  30. result.name = obj.name;
  31. if (typeof obj.gostHalbjahr === "undefined")
  32. throw new Error('invalid json format, missing attribute gostHalbjahr');
  33. result.gostHalbjahr = obj.gostHalbjahr;
  34. if (!!obj.schienen) {
  35. for (let elem of obj.schienen) {
  36. result.schienen?.add(GostBlockungSchiene_1.GostBlockungSchiene.transpilerFromJSON(JSON.stringify(elem)));
  37. }
  38. }
  39. if (!!obj.regeln) {
  40. for (let elem of obj.regeln) {
  41. result.regeln?.add(GostBlockungRegel_1.GostBlockungRegel.transpilerFromJSON(JSON.stringify(elem)));
  42. }
  43. }
  44. if (!!obj.kurse) {
  45. for (let elem of obj.kurse) {
  46. result.kurse?.add(GostBlockungKurs_1.GostBlockungKurs.transpilerFromJSON(JSON.stringify(elem)));
  47. }
  48. }
  49. return result;
  50. }
  51. static transpilerToJSON(obj) {
  52. let result = '{';
  53. result += '"id" : ' + obj.id + ',';
  54. result += '"name" : ' + '"' + obj.name.valueOf() + '"' + ',';
  55. result += '"gostHalbjahr" : ' + obj.gostHalbjahr + ',';
  56. if (!obj.schienen) {
  57. result += '[]';
  58. }
  59. else {
  60. result += '[ ';
  61. for (let i = 0; i < obj.schienen.size(); i++) {
  62. let elem = obj.schienen.get(i);
  63. result += GostBlockungSchiene_1.GostBlockungSchiene.transpilerToJSON(elem);
  64. if (i < obj.schienen.size() - 1)
  65. result += ',';
  66. }
  67. result += ' ]' + ',';
  68. }
  69. if (!obj.regeln) {
  70. result += '[]';
  71. }
  72. else {
  73. result += '[ ';
  74. for (let i = 0; i < obj.regeln.size(); i++) {
  75. let elem = obj.regeln.get(i);
  76. result += GostBlockungRegel_1.GostBlockungRegel.transpilerToJSON(elem);
  77. if (i < obj.regeln.size() - 1)
  78. result += ',';
  79. }
  80. result += ' ]' + ',';
  81. }
  82. if (!obj.kurse) {
  83. result += '[]';
  84. }
  85. else {
  86. result += '[ ';
  87. for (let i = 0; i < obj.kurse.size(); i++) {
  88. let elem = obj.kurse.get(i);
  89. result += GostBlockungKurs_1.GostBlockungKurs.transpilerToJSON(elem);
  90. if (i < obj.kurse.size() - 1)
  91. result += ',';
  92. }
  93. result += ' ]' + ',';
  94. }
  95. result = result.slice(0, -1);
  96. result += '}';
  97. return result;
  98. }
  99. static transpilerToJSONPatch(obj) {
  100. let result = '{';
  101. if (typeof obj.id !== "undefined") {
  102. result += '"id" : ' + obj.id + ',';
  103. }
  104. if (typeof obj.name !== "undefined") {
  105. result += '"name" : ' + '"' + obj.name.valueOf() + '"' + ',';
  106. }
  107. if (typeof obj.gostHalbjahr !== "undefined") {
  108. result += '"gostHalbjahr" : ' + obj.gostHalbjahr + ',';
  109. }
  110. if (typeof obj.schienen !== "undefined") {
  111. if (!obj.schienen) {
  112. result += '[]';
  113. }
  114. else {
  115. result += '[ ';
  116. for (let i = 0; i < obj.schienen.size(); i++) {
  117. let elem = obj.schienen.get(i);
  118. result += GostBlockungSchiene_1.GostBlockungSchiene.transpilerToJSON(elem);
  119. if (i < obj.schienen.size() - 1)
  120. result += ',';
  121. }
  122. result += ' ]' + ',';
  123. }
  124. }
  125. if (typeof obj.regeln !== "undefined") {
  126. if (!obj.regeln) {
  127. result += '[]';
  128. }
  129. else {
  130. result += '[ ';
  131. for (let i = 0; i < obj.regeln.size(); i++) {
  132. let elem = obj.regeln.get(i);
  133. result += GostBlockungRegel_1.GostBlockungRegel.transpilerToJSON(elem);
  134. if (i < obj.regeln.size() - 1)
  135. result += ',';
  136. }
  137. result += ' ]' + ',';
  138. }
  139. }
  140. if (typeof obj.kurse !== "undefined") {
  141. if (!obj.kurse) {
  142. result += '[]';
  143. }
  144. else {
  145. result += '[ ';
  146. for (let i = 0; i < obj.kurse.size(); i++) {
  147. let elem = obj.kurse.get(i);
  148. result += GostBlockungKurs_1.GostBlockungKurs.transpilerToJSON(elem);
  149. if (i < obj.kurse.size() - 1)
  150. result += ',';
  151. }
  152. result += ' ]' + ',';
  153. }
  154. }
  155. result = result.slice(0, -1);
  156. result += '}';
  157. return result;
  158. }
  159. }
  160. exports.GostBlockungsdaten = GostBlockungsdaten;
  161. function cast_de_nrw_schule_svws_core_data_gost_GostBlockungsdaten(obj) {
  162. return obj;
  163. }
  164. exports.cast_de_nrw_schule_svws_core_data_gost_GostBlockungsdaten = cast_de_nrw_schule_svws_core_data_gost_GostBlockungsdaten;
  165. //# sourceMappingURL=GostBlockungsdaten.js.map