Sorter refactoring

This commit is contained in:
Gonzalo Bellver
2012-01-10 20:01:36 -03:00
parent 765162d2a5
commit d7817a6f2c
5 changed files with 70 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
mindplot.nlayout.BalancedSorter = new Class({
Extends: mindplot.nlayout.ChildrenSorterStrategy,
Extends: mindplot.nlayout.AbstractBasicSorter,
initialize: function() {
@@ -91,23 +91,6 @@ mindplot.nlayout.BalancedSorter = new Class({
node.setOrder(0);
},
_getSortedChildren:function(treeSet, node) {
var result = treeSet.getChildren(node);
result.sort(function(a, b) {
return a.getOrder() - b.getOrder();
});
return result;
},
verify:function(treeSet, node) {
// Check that all is consistent ...
var children = this._getSortedChildren(treeSet, node);
for (var i = 0; i < children.length; i++) {
$assert(children[i].getOrder() == i, "missing order elements");
}
},
computeOffsets:function(treeSet, node) {
$assert(treeSet, "treeSet can no be null.");
$assert(node, "node can no be null.");