-
Notifications
You must be signed in to change notification settings - Fork 10
/
sorted-set.js.map
1 lines (1 loc) · 41.7 KB
/
sorted-set.js.map
1
{"version":3,"file":"sorted-set.js","sources":["src/SortedSet/AbstractSortedSet.js","src/SortedSet/ArrayStrategy.js","src/SortedSet/BinaryTreeIterator.js","src/SortedSet/AbstractBinaryTreeStrategy.js","src/SortedSet/BinaryTreeStrategy.js","src/SortedSet/RedBlackTreeStrategy.js","src/SortedSet/InsertConflictResolvers.js","src/SortedSet.js"],"sourcesContent":["\nclass AbstractSortedSet {\n constructor(options) {\n if ((options != null ? options.strategy : void 0) == null) {\n throw 'Must pass options.strategy, a strategy';\n }\n if ((options != null ? options.comparator : void 0) == null) {\n throw 'Must pass options.comparator, a comparator';\n }\n if ((options != null ? options.onInsertConflict : void 0) == null) {\n throw 'Must pass options.onInsertConflict, a function';\n }\n this.priv = new options.strategy(options);\n this.length = 0;\n }\n\n insert(value) {\n this.priv.insert(value);\n this.length += 1;\n return this;\n }\n\n remove(value) {\n this.priv.remove(value);\n this.length -= 1;\n return this;\n }\n\n clear() {\n this.priv.clear();\n this.length = 0;\n return this;\n }\n\n contains(value) {\n return this.priv.contains(value);\n }\n\n // Returns this set as an Array\n toArray() {\n return this.priv.toArray();\n }\n\n forEach(callback, thisArg) {\n this.priv.forEachImpl(callback, this, thisArg);\n return this;\n }\n\n map(callback, thisArg) {\n const ret = [];\n this.forEach(function(value, index, self) {\n return ret.push(callback.call(thisArg, value, index, self));\n });\n return ret;\n }\n\n filter(callback, thisArg) {\n const ret = [];\n this.forEach(function(value, index, self) {\n if (callback.call(thisArg, value, index, self)) {\n return ret.push(value);\n }\n });\n return ret;\n }\n\n every(callback, thisArg) {\n let ret = true;\n this.forEach(function(value, index, self) {\n if (ret && !callback.call(thisArg, value, index, self)) {\n ret = false;\n }\n });\n return ret;\n }\n\n some(callback, thisArg) {\n let ret = false;\n this.forEach(function(value, index, self) {\n if (!ret && callback.call(thisArg, value, index, self)) {\n ret = true;\n }\n });\n return ret;\n }\n\n // An iterator is similar to a C++ iterator: it points _before_ a value.\n\n // So in this sorted set:\n\n // | 1 | 2 | 3 | 4 | 5 |\n // ^a ^b ^c\n\n // `a` is a pointer to the beginning of the iterator. `a.value()` returns\n // `3`. `a.previous()` returns `null`. `a.setValue()` works, if\n // `options.allowSetValue` is true.\n\n // `b` is a pointer to the value `3`. `a.previous()` and `a.next()` both do\n // the obvious.\n\n // `c` is a pointer to the `null` value. `c.previous()` works; `c.next()`\n // returns null. `c.setValue()` throws an exception, even if\n // `options.allowSetValue` is true.\n\n // Iterators have `hasNext()` and `hasPrevious()` methods, too.\n\n // Iterators are immutible. `iterator.next()` returns a new iterator.\n\n // Iterators become invalid as soon as `insert()` or `remove()` is called.\n findIterator(value) {\n return this.priv.findIterator(value);\n }\n\n // Finds an iterator pointing to the lowest possible value.\n beginIterator() {\n return this.priv.beginIterator();\n }\n\n // Finds an iterator pointing to the `null` value.\n endIterator() {\n return this.priv.endIterator();\n }\n\n};\n\nexport default AbstractSortedSet;\n\n","\nclass Iterator {\n constructor(priv, index1) {\n this.priv = priv;\n this.index = index1;\n this.data = this.priv.data;\n }\n\n hasNext() {\n return this.index < this.data.length;\n }\n\n hasPrevious() {\n return this.index > 0;\n }\n\n value() {\n if (this.index < this.data.length) {\n return this.data[this.index];\n } else {\n return null;\n }\n }\n\n setValue(value) {\n if (!this.priv.options.allowSetValue) {\n throw 'Must set options.allowSetValue';\n }\n if (!this.hasNext()) {\n throw 'Cannot set value at end of set';\n }\n return this.data[this.index] = value;\n }\n\n next() {\n if (this.index >= this.data.length) {\n return null;\n } else {\n return new Iterator(this.priv, this.index + 1);\n }\n }\n\n previous() {\n if (this.index <= 0) {\n return null;\n } else {\n return new Iterator(this.priv, this.index - 1);\n }\n }\n\n};\n\nconst binarySearchForIndex = (array, value, comparator) => {\n let low = 0;\n let high = array.length;\n while (low < high) {\n const mid = (low + high) >>> 1;\n if (comparator(array[mid], value) < 0) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return low;\n};\n\nclass ArrayStrategy {\n constructor(options) {\n this.options = options;\n this.onInsertConflict = this.options.onInsertConflict;\n this.comparator = this.options.comparator;\n this.data = [];\n }\n\n toArray() {\n return this.data;\n }\n\n insert(value) {\n const index = binarySearchForIndex(this.data, value, this.comparator);\n if (this.data[index] !== void 0 && this.comparator(this.data[index], value) === 0) {\n return this.data.splice(index, 1, this.onInsertConflict(this.data[index], value));\n } else {\n return this.data.splice(index, 0, value);\n }\n }\n\n remove(value) {\n const index = binarySearchForIndex(this.data, value, this.comparator);\n if (this.comparator(this.data[index], value) !== 0) {\n throw 'Value not in set';\n }\n return this.data.splice(index, 1);\n }\n\n clear() {\n return this.data.length = 0;\n }\n\n contains(value) {\n const index = binarySearchForIndex(this.data, value, this.comparator);\n return this.index !== this.data.length && this.comparator(this.data[index], value) === 0;\n }\n\n forEachImpl(callback, sortedSet, thisArg) {\n const data = this.data;\n const len = data.length;\n for (let i = 0; i < len; i++) {\n callback.call(thisArg, data[i], i, sortedSet);\n }\n }\n\n findIterator(value) {\n const index = binarySearchForIndex(this.data, value, this.comparator);\n return new Iterator(this, index);\n }\n\n beginIterator() {\n return new Iterator(this, 0);\n }\n\n endIterator() {\n return new Iterator(this, this.data.length);\n }\n};\n\nexport default ArrayStrategy;\n","const descendAllTheWay = (leftOrRight, node) => {\n // Assumes node._iteratorParentNode is set\n while (node[leftOrRight] !== null) {\n const parent = node;\n node = node[leftOrRight];\n node._iteratorParentNode = parent;\n }\n return node;\n};\n\nconst moveCursor = (leftOrRight, node) => {\n let parent, rightOrLeft;\n if (node[leftOrRight] !== null) {\n parent = node;\n node = node[leftOrRight];\n node._iteratorParentNode = parent;\n rightOrLeft = leftOrRight === 'left' ? 'right' : 'left';\n node = descendAllTheWay(rightOrLeft, node);\n } else {\n while ((parent = node._iteratorParentNode) !== null && parent[leftOrRight] === node) {\n node = parent;\n }\n node = parent; // either null or the correct-direction parent\n }\n return node;\n};\n\n// The BinaryTreeIterator actually writes to the tree: it maintains a\n// \"_iteratorParentNode\" variable on each node. Please ignore this.\nclass BinaryTreeIterator {\n constructor(tree1, node1) {\n this.tree = tree1;\n this.node = node1;\n }\n\n next() {\n if (this.node === null) {\n return null;\n } else {\n const node = moveCursor('right', this.node);\n return new BinaryTreeIterator(this.tree, node);\n }\n }\n\n previous() {\n if (this.node === null) {\n if (this.tree.root === null) {\n return null;\n } else {\n this.tree.root._iteratorParentNode = null;\n const node = descendAllTheWay('right', this.tree.root);\n return new BinaryTreeIterator(this.tree, node);\n }\n } else {\n const node = moveCursor('left', this.node);\n if (node === null) {\n return null;\n } else {\n return new BinaryTreeIterator(this.tree, node);\n }\n }\n }\n\n hasNext() {\n return this.node !== null;\n }\n\n hasPrevious() {\n return this.previous() !== null;\n }\n\n value() {\n if (this.node === null) {\n return null;\n } else {\n return this.node.value;\n }\n }\n\n setValue(value) {\n if (!this.tree.options.allowSetValue) {\n throw 'Must set options.allowSetValue';\n }\n if (!this.hasNext()) {\n throw 'Cannot set value at end of set';\n }\n return this.node.value = value;\n }\n\n};\n\nBinaryTreeIterator.find = function(tree, value, comparator) {\n const root = tree.root;\n if (root != null) {\n root._iteratorParentNode = null;\n }\n let node = root;\n let nextNode = null; // For finding an in-between node\n while (node !== null) {\n const cmp = comparator(value, node.value);\n if (cmp === 0) {\n break;\n } else if (cmp < 0) {\n if (node.left === null) {\n break;\n }\n nextNode = node; // If we descend all right after this until there are\n // no more right nodes, we want to return an\n // \"in-between\" iterator ... pointing here.\n node.left._iteratorParentNode = node;\n node = node.left;\n } else {\n if (node.right !== null) {\n node.right._iteratorParentNode = node;\n node = node.right;\n } else {\n node = nextNode;\n break;\n }\n }\n }\n return new BinaryTreeIterator(tree, node);\n};\n\nBinaryTreeIterator.left = (tree) => {\n if (tree.root === null) {\n return new BinaryTreeIterator(tree, null);\n } else {\n tree.root._iteratorParentNode = null;\n const node = descendAllTheWay('left', tree.root);\n return new BinaryTreeIterator(tree, node);\n }\n};\n\nBinaryTreeIterator.right = (tree) => {\n return new BinaryTreeIterator(tree, null);\n};\n\nexport default BinaryTreeIterator;\n","\nimport BinaryTreeIterator from './BinaryTreeIterator';\n\nconst binaryTreeTraverse = (node, callback) => {\n if (node !== null) {\n binaryTreeTraverse(node.left, callback);\n callback(node.value);\n binaryTreeTraverse(node.right, callback);\n }\n};\n\n// An AbstractBinaryTree has a @root. @root is null or an object with\n// `.left`, `.right` and `.value` properties.\nclass AbstractBinaryTree {\n toArray() {\n const ret = [];\n binaryTreeTraverse(this.root, function(value) {\n return ret.push(value);\n });\n return ret;\n }\n\n clear() {\n return this.root = null;\n }\n\n forEachImpl(callback, sortedSet, thisArg) {\n let i = 0;\n binaryTreeTraverse(this.root, function(value) {\n callback.call(thisArg, value, i, sortedSet);\n i += 1;\n });\n }\n\n contains(value) {\n const comparator = this.comparator;\n let node = this.root;\n while (node !== null) {\n const cmp = comparator(value, node.value);\n if (cmp === 0) {\n break;\n } else if (cmp < 0) {\n node = node.left;\n } else {\n node = node.right;\n }\n }\n return node !== null && comparator(node.value, value) === 0;\n }\n\n findIterator(value) {\n return BinaryTreeIterator.find(this, value, this.comparator);\n }\n\n beginIterator() {\n return BinaryTreeIterator.left(this);\n }\n\n endIterator() {\n return BinaryTreeIterator.right(this);\n }\n\n};\n\nexport default AbstractBinaryTree;\n\n","import AbstractBinaryTreeStrategy from './AbstractBinaryTreeStrategy';\n\nclass Node {\n constructor(value) {\n this.value = value;\n this.left = null;\n this.right = null;\n }\n};\n\nconst nodeAllTheWay = (node, leftOrRight) => {\n while (node[leftOrRight] !== null) {\n node = node[leftOrRight];\n }\n return node;\n};\n\n// Returns the subtree, minus value\nconst binaryTreeDelete = (node, value, comparator) => {\n if (node === null) {\n throw 'Value not in set';\n }\n const cmp = comparator(value, node.value);\n if (cmp < 0) {\n node.left = binaryTreeDelete(node.left, value, comparator);\n } else if (cmp > 0) {\n node.right = binaryTreeDelete(node.right, value, comparator); // This is the value we want to remove\n } else {\n if (node.left === null && node.right === null) {\n node = null;\n } else if (node.right === null) {\n node = node.left;\n } else if (node.left === null) {\n node = node.right;\n } else {\n const nextNode = nodeAllTheWay(node.right, 'left');\n node.value = nextNode.value;\n node.right = binaryTreeDelete(node.right, nextNode.value, comparator);\n }\n }\n return node;\n};\n\nclass BinaryTreeStrategy extends AbstractBinaryTreeStrategy {\n constructor(options) {\n super();\n this.options = options;\n this.comparator = this.options.comparator;\n this.onInsertConflict = this.options.onInsertConflict;\n this.root = null;\n }\n\n insert(value) {\n const compare = this.comparator;\n if (this.root !== null) {\n let parent = this.root;\n let leftOrRight = null;\n while (true) {\n const cmp = compare(value, parent.value);\n if (cmp === 0) {\n parent.value = this.onInsertConflict(parent.value, value);\n return;\n } else {\n leftOrRight = cmp < 0 ? 'left' : 'right';\n if (parent[leftOrRight] === null) {\n break;\n }\n parent = parent[leftOrRight];\n }\n }\n return parent[leftOrRight] = new Node(value);\n } else {\n return this.root = new Node(value);\n }\n }\n\n remove(value) {\n return this.root = binaryTreeDelete(this.root, value, this.comparator);\n }\n\n};\n\nexport default BinaryTreeStrategy;\n","\nimport AbstractBinaryTreeStrategy from './AbstractBinaryTreeStrategy';\n\n// An implementation of Left-Leaning Red-Black trees.\n\n// It's copied from http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf.\n// It's practically a copy-paste job, minus the semicolons. missing bits were\n// filled in with hints from\n// http://www.teachsolaisgames.com/articles/balanced_left_leaning.html\n\n// Here are some differences:\n// * This isn't a map structure: it's just a tree. There are no keys: the\n// comparator applies to the values.\n// * We use the passed comparator.\nclass Node {\n constructor(value1) {\n this.value = value1;\n this.left = null;\n this.right = null;\n this.isRed = true; // null nodes -- leaves -- are black\n }\n\n};\n\nconst rotateLeft = (h) => {\n const x = h.right;\n h.right = x.left;\n x.left = h;\n x.isRed = h.isRed;\n h.isRed = true;\n return x;\n};\n\nconst rotateRight = (h) => {\n const x = h.left;\n h.left = x.right;\n x.right = h;\n x.isRed = h.isRed;\n h.isRed = true;\n return x;\n};\n\nconst colorFlip = (h) => {\n h.isRed = !h.isRed;\n h.left.isRed = !h.left.isRed;\n h.right.isRed = !h.right.isRed;\n};\n\nconst moveRedLeft = (h) => {\n //throw 'Preconditions failed' if !(!h.left.isRed && !h.left.left?.isRed)\n colorFlip(h);\n if (h.right !== null && h.right.left !== null && h.right.left.isRed) {\n h.right = rotateRight(h.right);\n h = rotateLeft(h);\n colorFlip(h);\n }\n return h;\n};\n\nconst moveRedRight = (h) => {\n //throw 'Preconditions failed' if !(!h.right.isRed && !h.right.left?.isRed)\n colorFlip(h);\n if (h.left !== null && h.left.left !== null && h.left.left.isRed) {\n h = rotateRight(h);\n colorFlip(h);\n }\n return h;\n};\n\nconst insertInNode = (h, value, compare, onInsertConflict) => {\n if (h === null) {\n return new Node(value);\n }\n //if h.left isnt null && h.left.isRed && h.right isnt null && h.right.isRed\n // colorFlip(h)\n const cmp = compare(value, h.value);\n if (cmp === 0) {\n h.value = onInsertConflict(h.value, value);\n } else if (cmp < 0) {\n h.left = insertInNode(h.left, value, compare, onInsertConflict);\n } else {\n h.right = insertInNode(h.right, value, compare, onInsertConflict);\n }\n if (h.right !== null && h.right.isRed && !(h.left !== null && h.left.isRed)) {\n h = rotateLeft(h);\n }\n if (h.left !== null && h.left.isRed && h.left.left !== null && h.left.left.isRed) {\n h = rotateRight(h);\n }\n // Put this here -- I couldn't get the whole thing to work otherwise :(\n if (h.left !== null && h.left.isRed && h.right !== null && h.right.isRed) {\n colorFlip(h);\n }\n return h;\n};\n\nconst findMinNode = (h) => {\n while (h.left !== null) {\n h = h.left;\n }\n return h;\n};\n\nconst fixUp = (h) => {\n // Fix right-leaning red nodes\n if (h.right !== null && h.right.isRed) {\n h = rotateLeft(h);\n }\n // Handle a 4-node that traverses down the left\n if (h.left !== null && h.left.isRed && h.left.left !== null && h.left.left.isRed) {\n h = rotateRight(h);\n }\n // split 4-nodes\n if (h.left !== null && h.left.isRed && h.right !== null && h.right.isRed) {\n colorFlip(h);\n }\n return h;\n};\n\nconst removeMinNode = (h) => {\n if (h.left === null) {\n return null;\n }\n if (!h.left.isRed && !(h.left.left !== null && h.left.left.isRed)) {\n h = moveRedLeft(h);\n }\n h.left = removeMinNode(h.left);\n return fixUp(h);\n};\n\nconst removeFromNode = (h, value, compare) => {\n if (h === null) {\n throw 'Value not in set';\n }\n if (compare(value, h.value) < 0) {\n if (h.left === null) {\n throw 'Value not in set';\n }\n if (!h.left.isRed && !(h.left.left !== null && h.left.left.isRed)) {\n h = moveRedLeft(h);\n }\n h.left = removeFromNode(h.left, value, compare);\n } else {\n if (h.left !== null && h.left.isRed) {\n h = rotateRight(h);\n }\n if (h.right === null) {\n if (compare(value, h.value) === 0) {\n return null; // leaf node; LLRB assures no left value here\n } else {\n throw 'Value not in set';\n }\n }\n if (!h.right.isRed && !(h.right.left !== null && h.right.left.isRed)) {\n h = moveRedRight(h);\n }\n if (compare(value, h.value) === 0) {\n h.value = findMinNode(h.right).value;\n h.right = removeMinNode(h.right);\n } else {\n h.right = removeFromNode(h.right, value, compare);\n }\n }\n if (h !== null) {\n h = fixUp(h);\n }\n return h;\n};\n\nclass RedBlackTreeStrategy extends AbstractBinaryTreeStrategy {\n constructor(options) {\n super();\n this.options = options;\n this.comparator = this.options.comparator;\n this.onInsertConflict = this.options.onInsertConflict;\n this.root = null;\n }\n\n insert(value) {\n this.root = insertInNode(this.root, value, this.comparator, this.onInsertConflict);\n this.root.isRed = false; // always\n }\n\n remove(value) {\n this.root = removeFromNode(this.root, value, this.comparator);\n if (this.root !== null) {\n this.root.isRed = false;\n }\n }\n\n};\n\nexport default RedBlackTreeStrategy;\n","const InsertConflictResolvers = {\n OnInsertConflictThrow: (oldValue, newValue) => { throw new Error(\"Value already in set\") },\n OnInsertConflictReplace: (oldValue, newValue) => newValue,\n OnInsertConflictIgnore: (oldValue, newValue) => oldValue,\n};\nexport default InsertConflictResolvers;\n","import AbstractSortedSet from './SortedSet/AbstractSortedSet';\nimport ArrayStrategy from './SortedSet/ArrayStrategy';\nimport BinaryTreeStrategy from './SortedSet/BinaryTreeStrategy';\nimport RedBlackTreeStrategy from './SortedSet/RedBlackTreeStrategy';\nimport InsertConflictResolvers from './SortedSet/InsertConflictResolvers';\n\nclass SortedSet extends AbstractSortedSet {\n constructor(options) {\n options || (options = {});\n options.strategy || (options.strategy = RedBlackTreeStrategy);\n options.comparator || (options.comparator = function(a, b) {\n return (a || 0) - (b || 0);\n });\n options.onInsertConflict || (options.onInsertConflict = InsertConflictResolvers.OnInsertConflictThrow);\n super(options);\n }\n};\n\nSortedSet.ArrayStrategy = ArrayStrategy;\nSortedSet.BinaryTreeStrategy = BinaryTreeStrategy;\nSortedSet.RedBlackTreeStrategy = RedBlackTreeStrategy;\n\nObject.assign(SortedSet, InsertConflictResolvers);\n\nexport default SortedSet;\n\n"],"names":["AbstractSortedSet","constructor","options","strategy","comparator","onInsertConflict","priv","length","insert","value","remove","clear","contains","toArray","forEach","callback","thisArg","forEachImpl","map","ret","index","self","push","call","filter","every","some","findIterator","beginIterator","endIterator","Iterator","index1","data","hasNext","hasPrevious","setValue","allowSetValue","next","previous","binarySearchForIndex","array","low","high","mid","ArrayStrategy","splice","sortedSet","len","i","descendAllTheWay","leftOrRight","node","parent","_iteratorParentNode","moveCursor","rightOrLeft","BinaryTreeIterator","tree1","node1","tree","root","find","nextNode","cmp","left","right","binaryTreeTraverse","AbstractBinaryTree","Node","nodeAllTheWay","binaryTreeDelete","BinaryTreeStrategy","AbstractBinaryTreeStrategy","compare","value1","isRed","rotateLeft","h","x","rotateRight","colorFlip","moveRedLeft","moveRedRight","insertInNode","findMinNode","fixUp","removeMinNode","removeFromNode","RedBlackTreeStrategy","InsertConflictResolvers","OnInsertConflictThrow","oldValue","newValue","Error","OnInsertConflictReplace","OnInsertConflictIgnore","SortedSet","a","b","Object","assign"],"mappings":";;;;;;EACA,MAAMA,iBAAN,CAAwB;EACtBC,EAAAA,WAAW,CAACC,OAAD,EAAU;EACnB,QAAI,CAACA,OAAO,IAAI,IAAX,GAAk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