45 |
|
private TreeSet<Integer> populatedSet(int n) { |
46 |
|
TreeSet<Integer> q = new TreeSet<Integer>(); |
47 |
|
assertTrue(q.isEmpty()); |
48 |
< |
for (int i = n-1; i >= 0; i -= 2) |
48 |
> |
for (int i = n - 1; i >= 0; i -= 2) |
49 |
|
assertTrue(q.add(new Integer(i))); |
50 |
|
for (int i = (n & 1); i < n; i += 2) |
51 |
|
assertTrue(q.add(new Integer(i))); |
290 |
|
assertTrue(q.contains(i)); |
291 |
|
assertTrue(q.remove(i)); |
292 |
|
assertFalse(q.contains(i)); |
293 |
< |
assertTrue(q.contains(i-1)); |
293 |
> |
assertTrue(q.contains(i - 1)); |
294 |
|
} |
295 |
|
for (int i = 0; i < SIZE; i += 2) { |
296 |
|
assertTrue(q.contains(i)); |
297 |
|
assertTrue(q.remove(i)); |
298 |
|
assertFalse(q.contains(i)); |
299 |
< |
assertFalse(q.remove(i+1)); |
300 |
< |
assertFalse(q.contains(i+1)); |
299 |
> |
assertFalse(q.remove(i + 1)); |
300 |
> |
assertFalse(q.contains(i + 1)); |
301 |
|
} |
302 |
|
assertTrue(q.isEmpty()); |
303 |
|
} |
903 |
|
else if (element > max) |
904 |
|
return -1; |
905 |
|
int result = bs.nextSetBit(element); |
906 |
< |
return result > max ? -1 : result; |
906 |
> |
return (result > max) ? -1 : result; |
907 |
|
} |
908 |
|
int higherAscending(int element) { |
909 |
|
return ceilingAscending(element + 1); |
910 |
|
} |
911 |
|
private int firstAscending() { |
912 |
|
int result = ceilingAscending(min); |
913 |
< |
return result > max ? -1 : result; |
913 |
> |
return (result > max) ? -1 : result; |
914 |
|
} |
915 |
|
private int lastAscending() { |
916 |
|
int result = floorAscending(max); |
917 |
< |
return result < min ? -1 : result; |
917 |
> |
return (result < min) ? -1 : result; |
918 |
|
} |
919 |
|
} |
920 |
|
ReferenceSet rs = new ReferenceSet(); |
975 |
|
} |
976 |
|
|
977 |
|
static boolean eq(Integer i, int j) { |
978 |
< |
return i == null ? j == -1 : i == j; |
978 |
> |
return (i == null) ? j == -1 : i == j; |
979 |
|
} |
980 |
|
|
981 |
|
} |