UNPKG

ecol

Version:
117 lines 4.68 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var TreeSet_1 = require("tstl/container/TreeSet"); var CollectionEvent_1 = require("../basic/CollectionEvent"); var EventDispatcher_1 = require("../basic/EventDispatcher"); var TreeSetCollection = /** @class */ (function (_super) { __extends(TreeSetCollection, _super); function TreeSetCollection() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * @hidden */ _this.dispatcher_ = new EventDispatcher_1.EventDispatcher(); return _this; } /* --------------------------------------------------------- CONSTRUCTORS --------------------------------------------------------- */ // using super.constructor TreeSetCollection.prototype.clear = function () { var first = this.begin(); var last = this.end(); _super.prototype.clear.call(this); this.dispatchEvent(new CollectionEvent_1.CollectionEvent("erase", first, last)); }; /* --------------------------------------------------------- ELEMENTS I/O --------------------------------------------------------- */ /** * @hidden */ TreeSetCollection.prototype._Handle_insert = function (first, last) { _super.prototype._Handle_insert.call(this, first, last); this.dispatchEvent(new CollectionEvent_1.CollectionEvent("insert", first, last)); }; /** * @hidden */ TreeSetCollection.prototype._Handle_erase = function (first, last) { this._Handle_erase(first, last); this.dispatchEvent(new CollectionEvent_1.CollectionEvent("erase", first, last)); }; /* ========================================================= EVENT DISPATCHER - NOTIFIERS - ACCESSORS ============================================================ NOTIFIERS --------------------------------------------------------- */ /** * @inheritDoc */ TreeSetCollection.prototype.dispatchEvent = function (event) { if (this.dispatcher_) this.dispatcher_.dispatchEvent(event); }; TreeSetCollection.prototype.refresh = function (first, last) { if (first === undefined) { first = this.begin(); last = this.end(); } else if (last === undefined) last = first.next(); this.dispatchEvent(new CollectionEvent_1.CollectionEvent("refresh", first, last)); }; /* --------------------------------------------------------- ACCESSORS --------------------------------------------------------- */ /** * @inheritDoc */ TreeSetCollection.prototype.hasEventListener = function (type) { return this.dispatcher_.hasEventListener(type); }; /** * @inheritDoc */ TreeSetCollection.prototype.addEventListener = function (type, listener) { this.dispatcher_.addEventListener(type, listener); }; /** * @inheritDoc */ TreeSetCollection.prototype.removeEventListener = function (type, listener) { this.dispatcher_.removeEventListener(type, listener); }; return TreeSetCollection; }(TreeSet_1.TreeSet)); exports.TreeSetCollection = TreeSetCollection; (function (TreeSetCollection) { TreeSetCollection.Event = CollectionEvent_1.CollectionEvent; TreeSetCollection.Iterator = TreeSet_1.TreeSet.Iterator; TreeSetCollection.ReverseIterator = TreeSet_1.TreeSet.ReverseIterator; })(TreeSetCollection = exports.TreeSetCollection || (exports.TreeSetCollection = {})); exports.TreeSetCollection = TreeSetCollection; var old_swap = TreeSet_1.TreeSet.prototype.swap; TreeSet_1.TreeSet.prototype.swap = function (obj) { old_swap.call(this, obj); if (this instanceof TreeSetCollection) this.refresh(); if (obj instanceof TreeSetCollection) obj.refresh(); }; //# sourceMappingURL=TreeSetCollection.js.map