/** * Merge an existing annotation with old annotations, removing the old annotations. * * @param existingAnnotation The annotation which exists and is to be left in the document * (merged) * @param annotations Annotation(s) which have been merged wiht existingAnnotation and then * removed */ public void mergeWithExisting(Annotation existingAnnotation, Annotation... annotations) { mergeWithExisting(existingAnnotation, Arrays.asList(annotations)); }
/** * Merge an existing annotation with old annotations, removing the old annotations. * * @param existingAnnotation The annotation which exists and is to be left in the document * (merged) * @param annotations Annotation(s) which have been merged wiht existingAnnotation and then * removed */ public void mergeWithExisting(Annotation existingAnnotation, Annotation... annotations) { mergeWithExisting(existingAnnotation, Arrays.asList(annotations)); }
/** * Add a new annotation, which is merged from the old annotations, removing the old annotations. * * @param existingAnnotation The annotation which exists and is to be left in the document * (merged) * @param annotations Annotation(s) which have been merged wiht existingAnnotation and then * removed */ protected void mergeWithExisting( Annotation existingAnnotation, Collection<? extends Annotation> annotations) { getSupport().mergeWithExisting(existingAnnotation, annotations); }
/** * Add a new annotation, which is merged from the old annotations, removing the old annotations. * * @param newAnnotation The annotation which is to be added to the document as the merged result * of the old annotations * @param annotations Annotation(s) which have been merged and should be removed */ public void mergeWithNew(Annotation newAnnotation, Collection<? extends Annotation> annotations) { add(newAnnotation); mergeWithExisting(newAnnotation, annotations); }
/** * Add a new annotation, which is merged from the old annotations, removing the old annotations. * * @param existingAnnotation The annotation which exists and is to be left in the document * (merged) * @param annotations Annotation(s) which have been merged wiht existingAnnotation and then * removed */ protected void mergeWithExisting( Annotation existingAnnotation, Collection<? extends Annotation> annotations) { getSupport().mergeWithExisting(existingAnnotation, annotations); }
/** * Merge an existing annotation with old annotations, removing the old annotations. * * @param existingAnnotation The annotation which exists and is to be left in the document * (merged) * @param annotations Annotation(s) which have been merged wiht existingAnnotation and then * removed */ protected void mergeWithExisting(Annotation existingAnnotation, Annotation... annotations) { getSupport().mergeWithExisting(existingAnnotation, annotations); }
/** * Add a new annotation, which is merged from the old annotations, removing the old annotations. * * @param newAnnotation The annotation which is to be added to the document as the merged result * of the old annotations * @param annotations Annotation(s) which have been merged and should be removed */ public void mergeWithNew(Annotation newAnnotation, Collection<? extends Annotation> annotations) { add(newAnnotation); mergeWithExisting(newAnnotation, annotations); }
/** * Merge an existing annotation with old annotations, removing the old annotations. * * @param existingAnnotation The annotation which exists and is to be left in the document * (merged) * @param annotations Annotation(s) which have been merged wiht existingAnnotation and then * removed */ protected void mergeWithExisting(Annotation existingAnnotation, Annotation... annotations) { getSupport().mergeWithExisting(existingAnnotation, annotations); }
@Test public void testMergeWithExistingAnnotationAnnotationArray() { UimaSupport support = new UimaSupport(PIPELINE, UimaSupportTest.class, history, monitor, false); Location l = new Location(jCas); l.setBegin(0); l.setEnd(0); l.addToIndexes(); Metadata md2 = new Metadata(jCas); md2.setBegin(0); md2.setEnd(0); md2.addToIndexes(); support.mergeWithExisting(l, location); support.mergeWithExisting(md2, md); List<Location> locations = new ArrayList<>(JCasUtil.select(jCas, Location.class)); List<Metadata> mds = new ArrayList<>(JCasUtil.select(jCas, Metadata.class)); assertEquals(1, locations.size()); assertEquals(l, locations.get(0)); assertEquals(1, mds.size()); assertEquals(md2, mds.get(0)); assertFalse(support.getDocumentHistory(jCas).getHistory(l.getInternalId()).isEmpty()); }
r.addToIndexes(); support.mergeWithExisting(p1, p2);
md2.addToIndexes(); support.mergeWithExisting(locationRT2Again, location, locationRT1, locationRT2); support.mergeWithExisting(md2, md);
md2.addToIndexes(); support.mergeWithExisting(locationRT2Again, location, locationRT1, locationRT2); support.mergeWithExisting(md2, md);
verify(support, only()).mergeWithExisting(existingAnnotation, annotation); resetMocked(); verify(support, only()).mergeWithExisting(existingAnnotation, list); resetMocked();