LinkedCollectionDescendingIterator.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.cast_de_nrw_schule_svws_core_adt_collection_LinkedCollectionDescendingIterator = exports.LinkedCollectionDescendingIterator = void 0;
  4. const JavaObject_1 = require("../../../java/lang/JavaObject");
  5. const ConcurrentModificationException_1 = require("../../../java/util/ConcurrentModificationException");
  6. const NoSuchElementException_1 = require("../../../java/util/NoSuchElementException");
  7. const UnsupportedOperationException_1 = require("../../../java/lang/UnsupportedOperationException");
  8. class LinkedCollectionDescendingIterator extends JavaObject_1.JavaObject {
  9. _collection;
  10. _current = null;
  11. _expModCount;
  12. /**
  13. * Erzeugt einen neuen LinkedCollectionIterator. Dabei wird die Referenz auf
  14. * die {@link LinkedCollection} übergeben.
  15. *
  16. * @param collection die zum Iterator zugehörige {@link LinkedCollection}
  17. */
  18. constructor(collection) {
  19. super();
  20. this._collection = collection;
  21. this._expModCount = collection._modCount;
  22. this._current = collection._tail;
  23. }
  24. hasNext() {
  25. if (this._collection._modCount !== this._expModCount)
  26. throw new ConcurrentModificationException_1.ConcurrentModificationException();
  27. return (this._current !== null);
  28. }
  29. next() {
  30. if (this._collection._modCount !== this._expModCount)
  31. throw new ConcurrentModificationException_1.ConcurrentModificationException();
  32. if (this._current === null)
  33. throw new NoSuchElementException_1.NoSuchElementException();
  34. let result = this._current.getValue();
  35. this._current = this._current.getPrev();
  36. return result;
  37. }
  38. remove() {
  39. throw new UnsupportedOperationException_1.UnsupportedOperationException("remove");
  40. }
  41. isTranspiledInstanceOf(name) {
  42. return ['de.nrw.schule.svws.core.adt.collection.LinkedCollectionDescendingIterator', 'java.util.Iterator'].includes(name);
  43. }
  44. }
  45. exports.LinkedCollectionDescendingIterator = LinkedCollectionDescendingIterator;
  46. function cast_de_nrw_schule_svws_core_adt_collection_LinkedCollectionDescendingIterator(obj) {
  47. return obj;
  48. }
  49. exports.cast_de_nrw_schule_svws_core_adt_collection_LinkedCollectionDescendingIterator = cast_de_nrw_schule_svws_core_adt_collection_LinkedCollectionDescendingIterator;
  50. //# sourceMappingURL=LinkedCollectionDescendingIterator.js.map