On 18/04/12 15:51, Jim - FooBar(); wrote:
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

We are also not checking for same/different type when using this "NameFinderME.dropOverlappingSpans" method... anyway i don't think that this will occur often so if you're happy with this solution then I'm happy as well... :)

Jim

Reply via email to