public static boolean contains(GNode gnode, Node item) { return index(gnode, item) >= 0 ; }
private static QueryIterator findIndex(Graph graph, Binding binding, Node listNode, Var var, Node member, ExecutionContext execCxt) { // Find index of member. int i = GraphList.index(new GNode(graph, listNode), member) ; if ( i < 0 ) return IterLib.noResults(execCxt) ; Node idx = NodeFactoryExtra.intToNode(i) ; return IterLib.oneResult(binding, var, idx, execCxt) ; }
@Test public void testListIndex_1() { assertEquals(0, GraphList.index(list4, node1)) ; }
@Test public void testListIndex_2() { assertEquals(1, GraphList.index(list4, node2)) ; }
@Test public void testListIndex_4() { assertEquals(3, GraphList.index(list4, node4)) ; }
@Test public void testListIndex_7() { assertEquals(0, GraphList.index(list22, node1)) ; }
@Test public void testListIndex_8() { assertEquals(1, GraphList.index(list22, node2)) ; }
@Test public void testListIndex_3() { assertEquals(2, GraphList.index(list4, node3)) ; }
@Test public void testListIndex_5() { assertEquals(-1, GraphList.index(list4, node0)) ; }
@Test public void testListIndex_6() { assertEquals(-1, GraphList.index(emptyList, node1)) ; }