GraphUtil { static int compareSizeTo(Graph graph, int size) { ExtendedIterator<Triple> it = graph.find(); try { int stepsTake = Iter.step(it, size); if ( stepsTake < size ) return CMP_LESS; if ( !it.hasNext()) return CMP_EQUAL; return CMP_GREATER; } finally { it.close(); } } private  GraphUtil(); static ExtendedIterator<Node> listSubjects(Graph g, Node p, Node o); static ExtendedIterator<Node> listPredicates(Graph g, Node s, Node o); static ExtendedIterator<Node> listObjects(Graph g, Node s, Node p); static boolean containsNode(Graph graph, Node node); static ExtendedIterator<Triple> findAll(Graph g); static void add(Graph graph, Triple[] triples); static void add(Graph graph, List<Triple> triples); static void add(Graph graph, Iterator<Triple> it); static void addInto(Graph dstGraph, Graph srcGraph ); static void delete(Graph graph, Triple[] triples); static void delete(Graph graph, List<Triple> triples); static void delete(Graph graph, Iterator<Triple> it); static void remove(Graph g, Node s, Node p, Node o); static void deleteLoopSrc(Graph dstGraph, Graph srcGraph); static void deleteLoopDst(Graph dstGraph, Graph srcGraph); static void deleteFrom(Graph dstGraph, Graph srcGraph);  }
@Test public void compareSizeTo_1() { assertEquals(1, GraphUtil.compareSizeTo(graph2, 0)); assertEquals(1, GraphUtil.compareSizeTo(graph2, 1)); assertEquals(0, GraphUtil.compareSizeTo(graph2, 2)); assertEquals(-1, GraphUtil.compareSizeTo(graph2, 3)); assertEquals(-1, GraphUtil.compareSizeTo(graph2, 4)); }
@Test public void compareSizeTo_2() { assertEquals(1, GraphUtil.compareSizeTo(graph1, 0)); assertEquals(0, GraphUtil.compareSizeTo(graph1, 1)); assertEquals(-1, GraphUtil.compareSizeTo(graph1, 2)); }
@Test public void compareSizeTo_3() { assertEquals(0, GraphUtil.compareSizeTo(graph0, 0)); assertEquals(-1, GraphUtil.compareSizeTo(graph0, 1)); }