econ
Version:
Event Collections
117 lines • 4.54 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var 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 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 std = require("tstl");
var CollectionEvent_1 = require("../basic/CollectionEvent");
var EventDispatcher_1 = require("../basic/EventDispatcher");
require("./internal");
var TreeMultiMap = /** @class */ (function (_super) {
__extends(TreeMultiMap, _super);
function TreeMultiMap() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* @hidden
*/
_this.dispatcher_ = new EventDispatcher_1.EventDispatcher();
return _this;
}
/* ---------------------------------------------------------
CONSTRUCTORS
--------------------------------------------------------- */
// using super.constructor;
TreeMultiMap.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
*/
TreeMultiMap.prototype._Handle_insert = function (first, last) {
_super.prototype._Handle_insert.call(this, first, last);
this.dispatchEvent(new CollectionEvent_1.CollectionEvent("insert", first, last));
};
/**
* @hidden
*/
TreeMultiMap.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
*/
TreeMultiMap.prototype.dispatchEvent = function (event) {
if (this.dispatcher_)
this.dispatcher_.dispatchEvent(event);
};
TreeMultiMap.prototype.refresh = function (first, last) {
if (first === void 0) { first = null; }
if (last === void 0) { last = null; }
if (first == null) {
first = this.begin();
last = this.end();
}
else if (last == null)
last = first.next();
this.dispatchEvent(new CollectionEvent_1.CollectionEvent("refresh", first, last));
};
/* ---------------------------------------------------------
ACCESSORS
-------------------------------------------------------- */
/**
* @inheritDoc
*/
TreeMultiMap.prototype.hasEventListener = function (type) {
return this.dispatcher_.hasEventListener(type);
};
/**
* @inheritDoc
*/
TreeMultiMap.prototype.addEventListener = function (type, listener) {
this.dispatcher_.addEventListener(type, listener);
};
/**
* @inheritDoc
*/
TreeMultiMap.prototype.removeEventListener = function (type, listener) {
this.dispatcher_.removeEventListener(type, listener);
};
return TreeMultiMap;
}(std.TreeMultiMap));
exports.TreeMultiMap = TreeMultiMap;
(function (TreeMultiMap) {
TreeMultiMap.Event = CollectionEvent_1.CollectionEvent;
TreeMultiMap.Iterator = std.TreeMultiMap.Iterator;
TreeMultiMap.ReverseIterator = std.TreeMultiMap.ReverseIterator;
})(TreeMultiMap = exports.TreeMultiMap || (exports.TreeMultiMap = {}));
exports.TreeMultiMap = TreeMultiMap;
var old_swap = std.TreeMultiMap.prototype.swap;
std.TreeMultiMap.prototype.swap = function (obj) {
old_swap.call(this, obj);
if (this instanceof TreeMultiMap)
this.refresh();
if (obj instanceof TreeMultiMap)
obj.refresh();
};
//# sourceMappingURL=TreeMultiMap.js.map
;