On 18/04/12 15:29, Jörn Kottmann wrote:
On 04/18/2012 04:12 PM, [email protected] wrote:
Ok, anyway, I think it is still too complex. Check how the method
NameFinderME.dropOverlappingSpans is simpler.
Good point, we can just use that one, no need to re-implement it.
Jörn
Ok i see, but that one again uses mutation. it uses lists , collections
and arrays...instead of a for loop i can see an iterator but i can also
see remove methods and stuff like that...
anyway i can see his method is public static so the aggregate can see it
without an instance variable...should i go ahead and use it? If we
assume it works as expected then we 're only left with a fraction of the
code:
-------------------------------------------------------------------------------------------
private Span[] flattenSpanArrays(List<Span[]> allFindings) {
SortedSet<Span> allUnique = new TreeSet<Span>();
for (Span[] k : allFindings)
allUnique.addAll(Arrays.asList(k)); //duplicates will be blocked
return NameFinderME.dropOverlappingSpans(allUnique
.toArray(new Span[allUnique.size()]));
}
-----------------------------------------------------------------------------------------------
what worries me is that we are no longer checking for span length. the
earliest one is kept...
Jim