@Override public SortedKeyIndex subIndex(int lb, int ub) { Preconditions.checkArgument(lb >= lowerBound && lb <= upperBound, "lower bound out of range"); Preconditions.checkArgument(lb <= ub, "range is negative"); Preconditions.checkArgument(ub >= lowerBound && ub <= upperBound, "upper bound out of range"); return new FullSortedKeyIndex(keys, lb, ub); } }
/** * Wrap a key array (with a specified size) into a key set. * @param keys The key array. This array must be sorted, and must not contain duplicates. For * efficiency, this condition is not checked unless assertions are enabled. Since * this method is only intended to be used when implementing test cases or other * data structures, callers of this method should ensure sortedness and * throw the appropriate exception. * @param size The length of the array to actually use. * @return The key set. */ public static SortedKeyIndex wrap(long[] keys, int size) { Preconditions.checkArgument(size <= keys.length, "size too large"); assert MoreArrays.isSorted(keys, 0, size); return new FullSortedKeyIndex(keys, 0, size); }
return new FullSortedKeyIndex(keyArray, 0, size); } else { assert smallKeyArray != null;
@Override public SortedKeyIndex subIndex(int lb, int ub) { Preconditions.checkArgument(lb >= lowerBound && lb <= upperBound, "lower bound out of range"); Preconditions.checkArgument(lb <= ub, "range is negative"); Preconditions.checkArgument(ub >= lowerBound && ub <= upperBound, "upper bound out of range"); return new FullSortedKeyIndex(keys, lb, ub); } }
/** * Wrap a key array (with a specified size) into a key set. * @param keys The key array. This array must be sorted, and must not contain duplicates. For * efficiency, this condition is not checked unless assertions are enabled. Since * this method is only intended to be used when implementing test cases or other * data structures, callers of this method should ensure sortedness and * throw the appropriate exception. * @param size The length of the array to actually use. * @return The key set. */ public static SortedKeyIndex wrap(long[] keys, int size) { Preconditions.checkArgument(size <= keys.length, "size too large"); assert MoreArrays.isSorted(keys, 0, size); return new FullSortedKeyIndex(keys, 0, size); }
return new FullSortedKeyIndex(keyArray, 0, size); } else { assert smallKeyArray != null;