public abstract class FingerTree<T,S>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FingerTree.NonEmptyFingerTree<T,S> |
| Modifier and Type | Method and Description |
|---|---|
FingerTree.NonEmptyFingerTree<T,S> |
append(T data) |
abstract java.util.List<T> |
asList()
Returns a list view of this tree.
|
abstract Either<FingerTree<T,S>,FingerTree.NonEmptyFingerTree<T,S>> |
caseEmpty() |
static <T,S> FingerTree<T,S> |
empty(ToSemigroup<? super T,S> statisticsProvider) |
abstract <R> R |
fold(R acc,
java.util.function.BiFunction<? super R,? super T,? extends R> reduction) |
<R> R |
foldBetween(R acc,
java.util.function.BiFunction<? super R,? super T,? extends R> reduction,
int startLeaf,
int endLeaf) |
<R> R |
foldBetween(R acc,
java.util.function.BiFunction<? super R,? super T,? extends R> reduction,
java.util.function.ToIntFunction<? super S> metric,
int startPosition,
int endPosition,
TetraFunction<? super R,? super T,java.lang.Integer,java.lang.Integer,? extends R> rangeReduction) |
Tuple2<T,BiIndex> |
get(java.util.function.ToIntFunction<? super S> metric,
int index) |
<E> E |
get(java.util.function.ToIntFunction<? super S> metric,
int index,
java.util.function.BiFunction<? super T,java.lang.Integer,? extends E> leafAccessor) |
abstract int |
getDepth() |
T |
getLeaf(int index) |
abstract int |
getLeafCount() |
S |
getSummary(S whenEmpty) |
java.util.Optional<S> |
getSummaryBetween(int startLeaf,
int endLeaf) |
java.util.Optional<S> |
getSummaryBetween(java.util.function.ToIntFunction<? super S> metric,
int startPosition,
int endPosition,
TriFunction<? super T,java.lang.Integer,java.lang.Integer,? extends S> subSummary) |
abstract java.util.Optional<S> |
getSummaryOpt() |
FingerTree<T,S> |
insertLeaf(int position,
T data) |
boolean |
isEmpty() |
abstract FingerTree<T,S> |
join(FingerTree<T,S> rightTree) |
BiIndex |
locate(java.util.function.BiFunction<? super S,java.lang.Integer,Either<java.lang.Integer,java.lang.Integer>> navigate,
int position) |
BiIndex |
locateProgressively(java.util.function.ToIntFunction<? super S> metric,
int position) |
BiIndex |
locateRegressively(java.util.function.ToIntFunction<? super S> metric,
int position) |
static <T> FingerTree<T,java.lang.Void> |
mkTree(java.util.List<? extends T> items) |
static <T,S> FingerTree<T,S> |
mkTree(java.util.List<? extends T> items,
ToSemigroup<? super T,S> summaryProvider) |
FingerTree.NonEmptyFingerTree<T,S> |
prepend(T data) |
FingerTree<T,S> |
removeLeafs(int fromLeaf,
int toLeaf) |
Tuple2<FingerTree<T,S>,FingerTree<T,S>> |
split(int beforeLeaf) |
FingerTree.NonEmptyFingerTree<T,S> |
updateLeaf(int index,
T data) |
public static <T,S> FingerTree<T,S> empty(ToSemigroup<? super T,S> statisticsProvider)
public static <T> FingerTree<T,java.lang.Void> mkTree(java.util.List<? extends T> items)
public static <T,S> FingerTree<T,S> mkTree(java.util.List<? extends T> items, ToSemigroup<? super T,S> summaryProvider)
public abstract int getDepth()
public abstract int getLeafCount()
public abstract java.util.Optional<S> getSummaryOpt()
public abstract Either<FingerTree<T,S>,FingerTree.NonEmptyFingerTree<T,S>> caseEmpty()
public final boolean isEmpty()
public T getLeaf(int index)
public <E> E get(java.util.function.ToIntFunction<? super S> metric, int index, java.util.function.BiFunction<? super T,java.lang.Integer,? extends E> leafAccessor)
public FingerTree.NonEmptyFingerTree<T,S> updateLeaf(int index, T data)
public BiIndex locate(java.util.function.BiFunction<? super S,java.lang.Integer,Either<java.lang.Integer,java.lang.Integer>> navigate, int position)
public BiIndex locateProgressively(java.util.function.ToIntFunction<? super S> metric, int position)
public BiIndex locateRegressively(java.util.function.ToIntFunction<? super S> metric, int position)
public abstract <R> R fold(R acc,
java.util.function.BiFunction<? super R,? super T,? extends R> reduction)
public <R> R foldBetween(R acc,
java.util.function.BiFunction<? super R,? super T,? extends R> reduction,
int startLeaf,
int endLeaf)
public <R> R foldBetween(R acc,
java.util.function.BiFunction<? super R,? super T,? extends R> reduction,
java.util.function.ToIntFunction<? super S> metric,
int startPosition,
int endPosition,
TetraFunction<? super R,? super T,java.lang.Integer,java.lang.Integer,? extends R> rangeReduction)
public java.util.Optional<S> getSummaryBetween(int startLeaf, int endLeaf)
public java.util.Optional<S> getSummaryBetween(java.util.function.ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T,java.lang.Integer,java.lang.Integer,? extends S> subSummary)
public Tuple2<FingerTree<T,S>,FingerTree<T,S>> split(int beforeLeaf)
public FingerTree<T,S> removeLeafs(int fromLeaf, int toLeaf)
public FingerTree<T,S> insertLeaf(int position, T data)
public abstract FingerTree<T,S> join(FingerTree<T,S> rightTree)
public FingerTree.NonEmptyFingerTree<T,S> append(T data)
public FingerTree.NonEmptyFingerTree<T,S> prepend(T data)
public abstract java.util.List<T> asList()
size(): O(1);get: O(log(n));subList: O(log(n));subList, i.e. calling subList
on the result of previous subList, up to n times: O(n).