Package org.reactfx.util
Class FingerTree<T,S>
java.lang.Object
org.reactfx.util.FingerTree<T,S>
- Direct Known Subclasses:
FingerTree.Empty
,FingerTree.NonEmptyFingerTree
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
private static class
static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasList()
Returns a list view of this tree.private static <T,
S> FingerTree.Branch <T, S> branch
(FingerTree.NonEmptyFingerTree<T, S> left, FingerTree.NonEmptyFingerTree<T, S> right) private static <T,
S> FingerTree.Branch <T, S> branch
(FingerTree.NonEmptyFingerTree<T, S> left, FingerTree.NonEmptyFingerTree<T, S> middle, FingerTree.NonEmptyFingerTree<T, S> right) private static <T,
S> FingerTree.Branch <T, S> branch
(LL.Cons<FingerTree.NonEmptyFingerTree<T, S>> children) abstract Either
<FingerTree<T, S>, FingerTree.NonEmptyFingerTree<T, S>> private static <T,
S> FingerTree <T, S> concat
(LL.Cons<? extends FingerTree<T, S>> nodes) (package private) FingerTree.Empty
<T, S> empty()
static <T,
S> FingerTree <T, S> empty
(ToSemigroup<? super T, S> statisticsProvider) abstract <R> R
fold
(R acc, BiFunction<? super R, ? super T, ? extends R> reduction) <R> R
foldBetween
(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, int startLeaf, int endLeaf) <R> R
foldBetween
(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, ToIntFunction<? super S> metric, int startPosition, int endPosition, TetraFunction<? super R, ? super T, Integer, Integer, ? extends R> rangeReduction) (package private) abstract <R> R
foldBetween0
(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, int startLeaf, int endLeaf) (package private) abstract <R> R
foldBetween0
(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, ToIntFunction<? super S> metric, int startPosition, int endPosition, TetraFunction<? super R, ? super T, Integer, Integer, ? extends R> rangeReduction) get
(ToIntFunction<? super S> metric, int index) <E> E
get
(ToIntFunction<? super S> metric, int index, BiFunction<? super T, Integer, ? extends E> leafAccessor) (package private) abstract T
getData()
abstract int
getDepth()
getLeaf
(int index) (package private) abstract T
getLeaf0
(int index) abstract int
getSummary
(S whenEmpty) getSummaryBetween
(int startLeaf, int endLeaf) getSummaryBetween
(ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T, Integer, Integer, ? extends S> subSummary) (package private) abstract S
getSummaryBetween0
(int startLeaf, int endLeaf) (package private) abstract S
getSummaryBetween0
(ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T, Integer, Integer, ? extends S> subSummary) FingerTree
<T, S> insertLeaf
(int position, T data) final boolean
isEmpty()
abstract FingerTree
<T, S> join
(FingerTree<T, S> rightTree) (package private) FingerTree.Leaf
<T, S> locateProgressively
(ToIntFunction<? super S> metric, int position) locateRegressively
(ToIntFunction<? super S> metric, int position) (package private) final int
measure
(ToIntFunction<? super S> metric) static <T> FingerTree
<T, Void> static <T,
S> FingerTree <T, S> mkTree
(List<? extends T> items, ToSemigroup<? super T, S> summaryProvider) FingerTree
<T, S> removeLeafs
(int fromLeaf, int toLeaf) Tuple2
<FingerTree<T, S>, FingerTree<T, S>> split
(int beforeLeaf) (package private) abstract Tuple2
<FingerTree<T, S>, FingerTree<T, S>> split0
(int beforeLeaf) updateLeaf
(int index, T data) (package private) abstract FingerTree.NonEmptyFingerTree
<T, S> updateLeaf0
(int index, T data)
-
Field Details
-
semigroup
-
-
Constructor Details
-
FingerTree
-
-
Method Details
-
empty
-
mkTree
-
mkTree
public static <T,S> FingerTree<T,S> mkTree(List<? extends T> items, ToSemigroup<? super T, S> summaryProvider) -
branch
private static <T,S> FingerTree.Branch<T,S> branch(FingerTree.NonEmptyFingerTree<T, S> left, FingerTree.NonEmptyFingerTree<T, S> right) -
branch
private static <T,S> FingerTree.Branch<T,S> branch(FingerTree.NonEmptyFingerTree<T, S> left, FingerTree.NonEmptyFingerTree<T, S> middle, FingerTree.NonEmptyFingerTree<T, S> right) -
branch
private static <T,S> FingerTree.Branch<T,S> branch(LL.Cons<FingerTree.NonEmptyFingerTree<T, S>> children) -
concat
-
getDepth
public abstract int getDepth() -
getLeafCount
public abstract int getLeafCount() -
getSummaryOpt
-
caseEmpty
-
isEmpty
public final boolean isEmpty() -
getSummary
-
getLeaf
-
getLeaf0
-
get
-
get
public <E> E get(ToIntFunction<? super S> metric, int index, BiFunction<? super T, Integer, ? extends E> leafAccessor) -
updateLeaf
-
updateLeaf0
-
locate
-
locateProgressively
-
locateRegressively
-
fold
-
foldBetween
public <R> R foldBetween(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, int startLeaf, int endLeaf) -
foldBetween0
abstract <R> R foldBetween0(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, int startLeaf, int endLeaf) -
foldBetween
public <R> R foldBetween(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, ToIntFunction<? super S> metric, int startPosition, int endPosition, TetraFunction<? super R, ? super T, Integer, Integer, ? extends R> rangeReduction) -
foldBetween0
abstract <R> R foldBetween0(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, ToIntFunction<? super S> metric, int startPosition, int endPosition, TetraFunction<? super R, ? super T, Integer, Integer, ? extends R> rangeReduction) -
getSummaryBetween
-
getSummaryBetween0
-
getSummaryBetween
public Optional<S> getSummaryBetween(ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T, Integer, Integer, ? extends S> subSummary) -
getSummaryBetween0
abstract S getSummaryBetween0(ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T, Integer, Integer, ? extends S> subSummary) -
split
-
split0
-
removeLeafs
-
insertLeaf
-
join
-
append
-
prepend
-
asList
Returns a list view of this tree. Complexity of operations on the returned list:size()
: O(1);get
: O(log(n));- iteration: O(n) in either direction, with O(log(n)) total allocations;
subList
: O(log(n));- iterative
subList
, i.e. callingsubList
on the result of previoussubList
, up to n times: O(n).
-
getData
-
empty
FingerTree.Empty<T,S> empty() -
leaf
-
measure
-