/** * Delete the triple in {@code srcGraph} from {@code dstGraph} * by checking the contents of {@code dsgGraph} against the {@code srcGraph}. * This involves calling {@code srcGraph.contains}. * @implNote * {@code dstGraph.size()} is used by this method. */ public static void deleteLoopDst(Graph dstGraph, Graph srcGraph) { // Size the list to avoid reallocation on growth. int dstSize = dstGraph.size(); List<Triple> toBeDeleted = new ArrayList<>(dstSize); Iterator<Triple> iter = findAll(dstGraph); for( ; iter.hasNext() ; ) { Triple t = iter.next(); if ( srcGraph.contains(t) ) toBeDeleted.add(t); } deleteIteratorWorkerDirect(dstGraph, toBeDeleted.iterator()); dstGraph.getEventManager().notifyDeleteGraph(dstGraph, srcGraph) ; }
/** * Delete triples in {@code srcGraph} from {@code dstGraph} * by looping on {@code srcGraph}. * */ public static void deleteLoopSrc(Graph dstGraph, Graph srcGraph) { deleteIteratorWorker(dstGraph, findAll(srcGraph)) ; dstGraph.getEventManager().notifyDeleteGraph(dstGraph, srcGraph) ; }
/** * Delete the triple in {@code srcGraph} from {@code dstGraph} * by checking the contents of {@code dsgGraph} against the {@code srcGraph}. * This involves calling {@code srcGraph.contains}. * @implNote * {@code dstGraph.size()} is used by this method. */ public static void deleteLoopDst(Graph dstGraph, Graph srcGraph) { // Size the list to avoid reallocation on growth. int dstSize = dstGraph.size(); List<Triple> toBeDeleted = new ArrayList<>(dstSize); Iterator<Triple> iter = findAll(dstGraph); for( ; iter.hasNext() ; ) { Triple t = iter.next(); if ( srcGraph.contains(t) ) toBeDeleted.add(t); } deleteIteratorWorkerDirect(dstGraph, toBeDeleted.iterator()); dstGraph.getEventManager().notifyDeleteGraph(dstGraph, srcGraph) ; }
/** * Delete triples in {@code srcGraph} from {@code dstGraph} * by looping on {@code srcGraph}. * */ public static void deleteLoopSrc(Graph dstGraph, Graph srcGraph) { deleteIteratorWorker(dstGraph, findAll(srcGraph)) ; dstGraph.getEventManager().notifyDeleteGraph(dstGraph, srcGraph) ; }
/** * Test that deleting a graph is reported as deleting a graph. */ @ContractTest public void testDeleteGraph() { gem.register(L); Graph other = Mockito.mock(Graph.class); gem.notifyDeleteGraph(mockGraph, other); L.assertHas(new Object[] { "deleteGraph", mockGraph, other }); }
/** * Test that deleting a graph is reported as deleting a graph. */ @ContractTest public void testDeleteGraph() { gem.register(L); Graph other = Mockito.mock(Graph.class); gem.notifyDeleteGraph(mockGraph, other); L.assertHas(new Object[] { "deleteGraph", mockGraph, other }); }