merge more fast
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/nlphub@165145 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
24ff49d294
commit
b2c98580da
|
@ -98,7 +98,7 @@ mergeAll = function(indices) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
var end = false;
|
||||
var counter = 1;
|
||||
while(!end) {
|
||||
|
@ -110,5 +110,27 @@ mergeAll = function(indices) {
|
|||
if(counter == 100)
|
||||
end = true;
|
||||
}
|
||||
return m.sort(compareSegments);
|
||||
return m.sort(compareSegments);*/
|
||||
|
||||
m = m.sort(compareSegments);
|
||||
var m2 = [];
|
||||
var current = m[0];
|
||||
for(var i=0; i<m.length; i++) {
|
||||
var cfr = compareSegment(current, m[i]);
|
||||
switch(cfr) {
|
||||
case 0:
|
||||
case -1:
|
||||
current = mergeSegment(current, m[i])[0];
|
||||
break;
|
||||
default:
|
||||
var s = mergeSegment(current, m[i]);
|
||||
m2[m2.length] = s[0];
|
||||
current = s[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if((current[0] != m2[m2.length-1][0]) || (current[1] != m2[m2.length-1][1]))
|
||||
m2[m2.length] = current;
|
||||
return m2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue