RBLL { public LibBasedNode getIntervalContaining(int elem) { LibBasedNode forComparison = new LibBasedNode(elem, elem); LibBasedNode firstUnder = tree.floor(forComparison); if (firstUnder == null) { return null; } LibBasedNode curr = firstUnder; while (curr.end < elem) { if (curr.next == null) { return null; } curr = curr.next; } return curr; }  @Override boolean equals(Object o); @Override int hashCode(); boolean containsInt(int elem); LibBasedNode getIntervalContaining(int elem); @Override String toString(); int size(); void clear(); void addInterval(int start, int end); static void main(String[] args);  }
@Test public void testGetIntervalContaining() throws Exception { assertNull(rbll.getIntervalContaining(3)); rbll.addInterval(0, 2); assertNull(rbll.getIntervalContaining(3)); assertEquals(new RBLL.LibBasedNode(0, 2), rbll.getIntervalContaining(1)); }