UNPKG

ts-collection

Version:

This is re-write of the java collection classes in typescript. There is some tweak as typescript templates are not as equivalent as Java.

97 lines (96 loc) 4.55 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 NavigableSubSet_1 = require("./NavigableSubSet"); var illegalargumentexception_1 = require("../../lang/illegalargumentexception"); var DescendingSubSet_1 = require("./DescendingSubSet"); var DescendingSubSetIterator_1 = require("./DescendingSubSetIterator"); var AscendingTreeSetIterator_1 = require("./AscendingTreeSetIterator"); var AscendingSubSet = /** @class */ (function (_super) { __extends(AscendingSubSet, _super); function AscendingSubSet(treeSet, fromStart, lo, loInclusive, toEnd, hi, hiInclusive) { return _super.call(this, treeSet, fromStart, lo, loInclusive, toEnd, hi, hiInclusive) || this; } AscendingSubSet.prototype.comparator = function () { return this.m_TreeSet.comparator(); }; AscendingSubSet.prototype.iterator = function () { return new AscendingTreeSetIterator_1.AscendingSubSetIterator(this.m_TreeSet, this.absLowest(), this.absHighFence()); }; AscendingSubSet.prototype.subSet = function (fromElement, fromInclusiveOrToElement, param2, param3) { var fromInclusive = true; var toElement = null; var toInclusive = false; if (typeof fromInclusiveOrToElement === 'boolean') { fromInclusive = fromInclusiveOrToElement; toElement = param2; toInclusive = param3; } else { toElement = fromInclusiveOrToElement; } if (!this.inRange(fromElement, fromInclusive)) { throw new illegalargumentexception_1.IllegalArgumentException('fromElement out of range'); } if (!this.inRange(toElement, toInclusive)) { throw new illegalargumentexception_1.IllegalArgumentException('toElement out of range'); } return new AscendingSubSet(this.m_TreeSet, false, fromElement, fromInclusive, false, toElement, toInclusive); }; AscendingSubSet.prototype.headSet = function (toElement, inclusive) { if (inclusive === undefined) { inclusive = false; } if (!this.inRange(toElement, inclusive)) { throw new illegalargumentexception_1.IllegalArgumentException('toElement out of range'); } return new AscendingSubSet(this.m_TreeSet, this.m_FromStart, this.m_Lo, this.m_LoInclusive, false, toElement, inclusive); }; AscendingSubSet.prototype.tailSet = function (fromElement, inclusive) { if (inclusive === undefined) { inclusive = true; } if (!this.inRange(fromElement, inclusive)) { throw new illegalargumentexception_1.IllegalArgumentException('fromElement out of range'); } return new AscendingSubSet(this.m_TreeSet, false, fromElement, inclusive, this.m_ToEnd, this.m_Hi, this.m_HiInclusive); }; AscendingSubSet.prototype.descendingIterator = function () { return new DescendingSubSetIterator_1.DescendingSubSetIterator(this.m_TreeSet, this.absHighest(), this.absLowest()); }; AscendingSubSet.prototype.descendingSet = function () { return new DescendingSubSet_1.DescendingSubSet(this.m_TreeSet, this.m_FromStart, this.m_Lo, this.m_LoInclusive, this.m_ToEnd, this.m_Hi, this.m_HiInclusive); }; AscendingSubSet.prototype.subLowest = function () { return this.absLowest(); }; AscendingSubSet.prototype.subHighest = function () { return this.absHighest(); }; AscendingSubSet.prototype.subCeiling = function (e) { return this.absCeiling(e); }; AscendingSubSet.prototype.subHigher = function (e) { return this.absHigher(e); }; AscendingSubSet.prototype.subFloor = function (e) { return this.absFloor(e); }; AscendingSubSet.prototype.subLower = function (e) { return this.absLower(e); }; return AscendingSubSet; }(NavigableSubSet_1.NavigableSubSet)); exports.AscendingSubSet = AscendingSubSet;