typescript-dotnet-amd
Version:
A JavaScript-Friendly .NET Based TypeScript Library.
6 lines • 3.82 kB
JavaScript
/*!
* @author electricessence / https://github.com/electricessence/
* Licensing: MIT https://github.com/electricessence/TypeScript.NET/blob/master/LICENSE.md
*/
define(["require","exports","./LinkedNodeList","../Exceptions/ArgumentNullException","./Enumeration/Enumerator","./Enumeration/EmptyEnumerator","../Disposable/dispose","../Compare","./CollectionBase","../../extends"],function(t,e,n,r,i,o,s,u,c,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var f=a["default"],p=void 0,h="other",l=function(t){function e(e){var n=t.call(this,p,u.areEqual)||this;return n._importEntries(e),n}return f(e,t),e.prototype._getSet=function(){var t=this._set;return t||(this._set=t=new n.LinkedNodeList),t},e.prototype.getCount=function(){return this._set?this._set.unsafeCount:0},e.prototype.exceptWith=function(t){var e=this;if(!t)throw new r.ArgumentNullException(h);i.forEach(t,function(t){e._removeInternal(t)&&e._incrementModified()}),e._signalModification()},e.prototype.intersectWith=function(t){if(!t)throw new r.ArgumentNullException(h);var n=this;if(t instanceof e){var i=n._set;i&&i.forEach(function(e){!t.contains(e.value)&&n._removeInternal(e.value)&&n._incrementModified()},!0),n._signalModification()}else s.using(n.newUsing(t),function(t){return n.intersectWith(t)})},e.prototype.isProperSubsetOf=function(t){var n=this;if(!t)throw new r.ArgumentNullException(h);return t instanceof e?t.isProperSupersetOf(this):s.using(this.newUsing(t),function(t){return t.isProperSupersetOf(n)})},e.prototype.isProperSupersetOf=function(t){var n=this;if(!t)throw new r.ArgumentNullException(h);var o,u=!0;return t instanceof e?(u=this.isSupersetOf(t),o=t.getCount()):o=s.using(this.newUsing(),function(e){return i.forEach(t,function(t){return e.add(t),u=n.contains(t)}),e.getCount()}),u&&this.getCount()>o},e.prototype.isSubsetOf=function(t){var n=this;if(!t)throw new r.ArgumentNullException(h);return t instanceof e?t.isSupersetOf(this):s.using(this.newUsing(t),function(t){return t.isSupersetOf(n)})},e.prototype.isSupersetOf=function(t){var e=this;if(!t)throw new r.ArgumentNullException(h);var n=!0;return i.forEach(t,function(t){return n=e.contains(t)}),n},e.prototype.overlaps=function(t){var e=this;if(!t)throw new r.ArgumentNullException(h);var n=!1;return i.forEach(t,function(t){return!(n=e.contains(t))}),n},e.prototype.setEquals=function(t){if(!t)throw new r.ArgumentNullException(h);return this.getCount()==(t instanceof e?t.getCount():s.using(this.newUsing(t),function(t){return t.getCount()}))&&this.isSubsetOf(t)},e.prototype.symmetricExceptWith=function(t){if(!t)throw new r.ArgumentNullException(h);var n=this;t instanceof e?(i.forEach(t,function(t){n.contains(t)?n._removeInternal(t)&&n._incrementModified():n._addInternal(t)&&n._incrementModified()}),n._signalModification()):s.using(this.newUsing(t),function(t){return n.symmetricExceptWith(t)})},e.prototype.unionWith=function(t){this.importEntries(t)},e.prototype._clearInternal=function(){var t=this._set;return t?t.clear():0},e.prototype._onDispose=function(){t.prototype._onDispose.call(this),this._set=null},e.prototype.contains=function(t){return!(!this.getCount()||!this._getNode(t))},e.prototype.getEnumerator=function(){var t=this;t.throwIfDisposed();var e=t._set;return e&&t.getCount()?n.LinkedNodeList.valueEnumeratorFrom(e):o.EmptyEnumerator},e.prototype.forEach=function(e,n){return n?t.prototype.forEach.call(this,e,n):this._set?this._set.forEach(function(t,n){return e(t.value,n)}):0},e.prototype._removeNode=function(t){return!!t&&0!=this.remove(t.value)},e.prototype.removeFirst=function(){var t=this._set;return this._removeNode(t&&t.first)},e.prototype.removeLast=function(){var t=this._set;return this._removeNode(t&&t.last)},e}(c.CollectionBase);e.SetBase=l,e["default"]=l});
//# sourceMappingURL=SetBase.js.map