public static <C, K extends C, V extends C> Object[] build(Iterable<K> source, UpdateFunction<K, V> updateF) { return buildInternal(source, -1, updateF); }
public static <C, K extends C, V extends C> Object[] build(Iterable<K> source, UpdateFunction<K, V> updateF) { return buildInternal(source, -1, updateF); }
public static <C, K extends C, V extends C> Object[] build(Iterable<K> source, UpdateFunction<K, V> updateF) { return buildInternal(source, -1, updateF); }
public static <C, K extends C, V extends C> Object[] build(Iterable<K> source, UpdateFunction<K, V> updateF) { return buildInternal(source, -1, updateF); }
public static <C, K extends C, V extends C> Object[] build(Collection<K> source, UpdateFunction<K, V> updateF) { return buildInternal(source, source.size(), updateF); }
public static <C, K extends C, V extends C> Object[] build(Collection<K> source, UpdateFunction<K, V> updateF) { return buildInternal(source, source.size(), updateF); }
public static <C, K extends C, V extends C> Object[] build(Collection<K> source, UpdateFunction<K, V> updateF) { return buildInternal(source, source.size(), updateF); }
public static <C, K extends C, V extends C> Object[] build(Collection<K> source, UpdateFunction<K, V> updateF) { return buildInternal(source, source.size(), updateF); }
/** * Creates a BTree containing all of the objects in the provided collection * * @param source the items to build the tree with. MUST BE IN STRICTLY ASCENDING ORDER. * @param size the size of the source iterable * @return a btree representing the contents of the provided iterable */ public static <C, K extends C, V extends C> Object[] build(Iterable<K> source, int size, UpdateFunction<K, V> updateF) { if (size < 0) throw new IllegalArgumentException(Integer.toString(size)); return buildInternal(source, size, updateF); }
/** * Creates a BTree containing all of the objects in the provided collection * * @param source the items to build the tree with. MUST BE IN STRICTLY ASCENDING ORDER. * @param size the size of the source iterable * @return a btree representing the contents of the provided iterable */ public static <C, K extends C, V extends C> Object[] build(Iterable<K> source, int size, UpdateFunction<K, V> updateF) { if (size < 0) throw new IllegalArgumentException(Integer.toString(size)); return buildInternal(source, size, updateF); }
/** * Creates a BTree containing all of the objects in the provided collection * * @param source the items to build the tree with. MUST BE IN STRICTLY ASCENDING ORDER. * @param size the size of the source iterable * @return a btree representing the contents of the provided iterable */ public static <C, K extends C, V extends C> Object[] build(Iterable<K> source, int size, UpdateFunction<K, V> updateF) { if (size < 0) throw new IllegalArgumentException(Integer.toString(size)); return buildInternal(source, size, updateF); }
/** * Creates a BTree containing all of the objects in the provided collection * * @param source the items to build the tree with. MUST BE IN STRICTLY ASCENDING ORDER. * @param size the size of the source iterable * @return a btree representing the contents of the provided iterable */ public static <C, K extends C, V extends C> Object[] build(Iterable<K> source, int size, UpdateFunction<K, V> updateF) { if (size < 0) throw new IllegalArgumentException(Integer.toString(size)); return buildInternal(source, size, updateF); }
/** * Takes a btree and transforms it using the provided function, filtering out any null results. * The result of any transformation must sort identically wrt the other results as their originals */ public static <V> Object[] transformAndFilter(Object[] btree, Function<? super V, ? extends V> function) { if (isEmpty(btree)) return btree; // TODO: can be made more efficient FiltrationTracker<V> wrapped = new FiltrationTracker<>(function); Object[] result = transformAndFilter(btree, wrapped); if (!wrapped.failed) return result; // take the already transformed bits from the head of the partial result Iterable<V> head = iterable(result, 0, wrapped.index - 1, Dir.ASC); // and concatenate with remainder of original tree, with transformation applied Iterable<V> remainder = iterable(btree, wrapped.index + 1, size(btree) - 1, Dir.ASC); remainder = filter(transform(remainder, function), (x) -> x != null); Iterable<V> build = concat(head, remainder); return buildInternal(build, -1, UpdateFunction.<V>noOp()); }
/** * Takes a btree and transforms it using the provided function, filtering out any null results. * The result of any transformation must sort identically wrt the other results as their originals */ public static <V> Object[] transformAndFilter(Object[] btree, Function<? super V, ? extends V> function) { if (isEmpty(btree)) return btree; // TODO: can be made more efficient FiltrationTracker<V> wrapped = new FiltrationTracker<>(function); Object[] result = transformAndFilter(btree, wrapped); if (!wrapped.failed) return result; // take the already transformed bits from the head of the partial result Iterable<V> head = iterable(result, 0, wrapped.index - 1, Dir.ASC); // and concatenate with remainder of original tree, with transformation applied Iterable<V> remainder = iterable(btree, wrapped.index + 1, size(btree) - 1, Dir.ASC); remainder = filter(transform(remainder, function), (x) -> x != null); Iterable<V> build = concat(head, remainder); return buildInternal(build, -1, UpdateFunction.<V>noOp()); }
/** * Takes a btree and transforms it using the provided function, filtering out any null results. * The result of any transformation must sort identically wrt the other results as their originals */ public static <V> Object[] transformAndFilter(Object[] btree, Function<? super V, ? extends V> function) { if (isEmpty(btree)) return btree; // TODO: can be made more efficient FiltrationTracker<V> wrapped = new FiltrationTracker<>(function); Object[] result = transformAndFilter(btree, wrapped); if (!wrapped.failed) return result; // take the already transformed bits from the head of the partial result Iterable<V> head = iterable(result, 0, wrapped.index - 1, Dir.ASC); // and concatenate with remainder of original tree, with transformation applied Iterable<V> remainder = iterable(btree, wrapped.index + 1, size(btree) - 1, Dir.ASC); remainder = filter(transform(remainder, function), (x) -> x != null); Iterable<V> build = concat(head, remainder); return buildInternal(build, -1, UpdateFunction.<V>noOp()); }
/** * Takes a btree and transforms it using the provided function, filtering out any null results. * The result of any transformation must sort identically wrt the other results as their originals */ public static <V> Object[] transformAndFilter(Object[] btree, Function<? super V, ? extends V> function) { if (isEmpty(btree)) return btree; // TODO: can be made more efficient FiltrationTracker<V> wrapped = new FiltrationTracker<>(function); Object[] result = transformAndFilter(btree, wrapped); if (!wrapped.failed) return result; // take the already transformed bits from the head of the partial result Iterable<V> head = iterable(result, 0, wrapped.index - 1, Dir.ASC); // and concatenate with remainder of original tree, with transformation applied Iterable<V> remainder = iterable(btree, wrapped.index + 1, size(btree) - 1, Dir.ASC); remainder = filter(transform(remainder, function), (x) -> x != null); Iterable<V> build = concat(head, remainder); return buildInternal(build, -1, UpdateFunction.<V>noOp()); }