AVLSet.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.cast_de_nrw_schule_svws_core_adt_set_AVLSet = exports.AVLSet = void 0;
  4. const JavaObject_1 = require("../../../java/lang/JavaObject");
  5. const SortedSet_1 = require("../../../java/util/SortedSet");
  6. const AVLMap_1 = require("../../../core/adt/map/AVLMap");
  7. const Comparator_1 = require("../../../java/util/Comparator");
  8. class AVLSet extends JavaObject_1.JavaObject {
  9. _set;
  10. /**
  11. * Implementation for method overloads of 'constructor'
  12. */
  13. constructor(__param0) {
  14. super();
  15. if ((typeof __param0 === "undefined")) {
  16. let map = new AVLMap_1.AVLMap();
  17. map.allowKeyAlone(true);
  18. this._set = map.navigableKeySet();
  19. }
  20. else if (((typeof __param0 !== "undefined") && ((typeof __param0 !== 'undefined') && (__param0 instanceof Object) && (__param0 !== null) && ('compare' in __param0) && (typeof __param0.compare === 'function')) || (__param0 === null))) {
  21. let comparator = (0, Comparator_1.cast_java_util_Comparator)(__param0);
  22. let map = new AVLMap_1.AVLMap(comparator);
  23. map.allowKeyAlone(true);
  24. this._set = map.navigableKeySet();
  25. }
  26. else if (((typeof __param0 !== "undefined") && ((__param0 instanceof JavaObject_1.JavaObject) && (__param0.isTranspiledInstanceOf('java.util.SortedSet'))) || (__param0 === null))) {
  27. let set = (0, SortedSet_1.cast_java_util_SortedSet)(__param0);
  28. let map = new AVLMap_1.AVLMap();
  29. map.allowKeyAlone(true);
  30. this._set = map.navigableKeySet();
  31. this._set.addAll(set);
  32. }
  33. else
  34. throw new Error('invalid method overload');
  35. }
  36. comparator() {
  37. return this._set.comparator();
  38. }
  39. first() {
  40. return this._set.first();
  41. }
  42. last() {
  43. return this._set.last();
  44. }
  45. size() {
  46. return this._set.size();
  47. }
  48. isEmpty() {
  49. return this._set.isEmpty();
  50. }
  51. contains(o) {
  52. return this._set.contains(o);
  53. }
  54. /**
  55. * Implementation for method overloads of 'toArray'
  56. */
  57. toArray(__param0) {
  58. if ((typeof __param0 === "undefined")) {
  59. return this._set.toArray();
  60. }
  61. else if (((typeof __param0 !== "undefined") && Array.isArray(__param0))) {
  62. let a = __param0;
  63. return this._set.toArray(a);
  64. }
  65. else
  66. throw new Error('invalid method overload');
  67. }
  68. add(e) {
  69. return this._set.add(e);
  70. }
  71. remove(o) {
  72. return this._set.remove(o);
  73. }
  74. containsAll(c) {
  75. return this._set.containsAll(c);
  76. }
  77. addAll(c) {
  78. return this._set.addAll(c);
  79. }
  80. retainAll(c) {
  81. return this._set.retainAll(c);
  82. }
  83. removeAll(c) {
  84. return this._set.removeAll(c);
  85. }
  86. clear() {
  87. this._set.clear();
  88. }
  89. lower(e) {
  90. return this._set.lower(e);
  91. }
  92. floor(e) {
  93. return this._set.floor(e);
  94. }
  95. ceiling(e) {
  96. return this._set.ceiling(e);
  97. }
  98. higher(e) {
  99. return this._set.higher(e);
  100. }
  101. pollFirst() {
  102. return this._set.pollFirst();
  103. }
  104. pollLast() {
  105. return this._set.pollLast();
  106. }
  107. iterator() {
  108. return this._set.iterator();
  109. }
  110. descendingSet() {
  111. return this._set.descendingSet();
  112. }
  113. descendingIterator() {
  114. return this._set.descendingIterator();
  115. }
  116. /**
  117. * Implementation for method overloads of 'subSet'
  118. */
  119. subSet(__param0, __param1, __param2, __param3) {
  120. if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean") && ((typeof __param2 !== "undefined") && (typeof __param2 !== "undefined")) && ((typeof __param3 !== "undefined") && typeof __param3 === "boolean")) {
  121. let fromElement = __param0;
  122. let fromInclusive = __param1;
  123. let toElement = __param2;
  124. let toInclusive = __param3;
  125. return this._set.subSet(fromElement, fromInclusive, toElement, toInclusive);
  126. }
  127. else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && (typeof __param1 !== "undefined")) && (typeof __param2 === "undefined") && (typeof __param3 === "undefined")) {
  128. let fromElement = __param0;
  129. let toElement = __param1;
  130. return this._set.subSet(fromElement, toElement);
  131. }
  132. else
  133. throw new Error('invalid method overload');
  134. }
  135. /**
  136. * Implementation for method overloads of 'headSet'
  137. */
  138. headSet(__param0, __param1) {
  139. if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
  140. let toElement = __param0;
  141. let inclusive = __param1;
  142. return this._set.headSet(toElement, inclusive);
  143. }
  144. else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
  145. let toElement = __param0;
  146. return this._set.headSet(toElement);
  147. }
  148. else
  149. throw new Error('invalid method overload');
  150. }
  151. /**
  152. * Implementation for method overloads of 'tailSet'
  153. */
  154. tailSet(__param0, __param1) {
  155. if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
  156. let fromElement = __param0;
  157. let inclusive = __param1;
  158. return this._set.tailSet(fromElement, inclusive);
  159. }
  160. else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
  161. let fromElement = __param0;
  162. return this._set.tailSet(fromElement);
  163. }
  164. else
  165. throw new Error('invalid method overload');
  166. }
  167. isTranspiledInstanceOf(name) {
  168. return ['java.util.SortedSet', 'java.util.Collection', 'de.nrw.schule.svws.core.adt.set.AVLSet', 'java.util.Set', 'java.util.NavigableSet', 'java.lang.Iterable'].includes(name);
  169. }
  170. [Symbol.iterator]() {
  171. let iter = this.iterator();
  172. const result = {
  173. next() {
  174. if (iter.hasNext())
  175. return { value: iter.next(), done: false };
  176. return { value: null, done: true };
  177. }
  178. };
  179. return result;
  180. }
  181. }
  182. exports.AVLSet = AVLSet;
  183. function cast_de_nrw_schule_svws_core_adt_set_AVLSet(obj) {
  184. return obj;
  185. }
  186. exports.cast_de_nrw_schule_svws_core_adt_set_AVLSet = cast_de_nrw_schule_svws_core_adt_set_AVLSet;
  187. //# sourceMappingURL=AVLSet.js.map