flatten-interval-tree
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -0,0 +0,0 @@ /*global document */ |
@@ -0,0 +0,0 @@ |
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", | ||
/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); |
@@ -0,0 +0,0 @@ var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; |
@@ -232,5 +232,5 @@ /** | ||
// remove cut_node from parent | ||
if (fix_node != nil_node) { | ||
/*if (fix_node != nil_node) {*/ | ||
fix_node.parent = cut_node.parent; | ||
} | ||
/*}*/ | ||
@@ -261,3 +261,3 @@ if (cut_node == this.root) { | ||
if (fix_node != nil_node && cut_node.color == RB_TREE_COLOR_BLACK) { | ||
if (/*fix_node != nil_node && */cut_node.color == RB_TREE_COLOR_BLACK) { | ||
this.delete_fixup(fix_node); | ||
@@ -264,0 +264,0 @@ } |
{ | ||
"name": "flatten-interval-tree", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Interval Tree implementation as augmented extention of binary red-black tree", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -87,2 +87,30 @@ /** | ||
}); | ||
it('Same black height property preserved while nodes deleted', function () { | ||
let tree = new IntervalTree(); | ||
let ints = [[6,8],[1,2],[7,12],[1,1],[5,7]]; | ||
for (let i=0; i < ints.length; i++) tree.insert(ints[i],"val"+i) | ||
let height = (tree) => { | ||
return tree.testBlackHeightProperty(tree.root); | ||
}; | ||
let h; | ||
tree.remove([1,1],"val3"); | ||
// h = height(tree); | ||
expect(height(tree)).to.equal(3); | ||
expect(tree.testRedBlackProperty()).to.equal(true); | ||
tree.remove([5,7],"val4"); | ||
expect(height(tree)).to.equal(3); | ||
expect(tree.testRedBlackProperty()).to.equal(true); | ||
tree.remove([1,2],"val1"); | ||
expect(tree.testRedBlackProperty()).to.equal(true); | ||
expect(height(tree)).to.equal(2); | ||
tree.remove([6,8],"val0"); | ||
expect(tree.testRedBlackProperty()).to.equal(true); | ||
expect(height(tree)).to.equal(2); | ||
tree.remove([7,12],"val2"); | ||
expect(tree.testRedBlackProperty()).to.equal(true); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
54
1541
1531926