Package org.reactfx.util
Class FingerTree.Branch<T,S>
java.lang.Object
org.reactfx.util.FingerTree<T,S>
org.reactfx.util.FingerTree.NonEmptyFingerTree<T,S>
org.reactfx.util.FingerTree.Branch<T,S>
- Enclosing class:
FingerTree<T,
S>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.reactfx.util.FingerTree
FingerTree.NonEmptyFingerTree<T,
S> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LL.Cons
<FingerTree.NonEmptyFingerTree<T, S>> private final int
private final int
private final S
Fields inherited from class org.reactfx.util.FingerTree
semigroup
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Branch
(LL.Cons<FingerTree.NonEmptyFingerTree<T, S>> children) -
Method Summary
Modifier and TypeMethodDescription(package private) Either
<FingerTree.Branch<T, S>, Tuple2<FingerTree.NonEmptyFingerTree<T, S>, FingerTree.NonEmptyFingerTree<T, S>>> appendLte
(FingerTree<T, S> suffix) asList()
Returns a list view of this tree.final <R> R
fold
(R acc, BiFunction<? super R, ? super T, ? extends R> reduction) (package private) final <R> R
foldBetween0
(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, int startLeaf, int endLeaf) private <R> R
foldBetween0
(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, int startLeaf, int endLeaf, LL<? extends FingerTree<T, S>> nodes) (package private) final <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) private <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, LL<? extends FingerTree<T, S>> nodes) (package private) final T
getData()
int
getDepth()
(package private) final T
getLeaf0
(int index) private T
getLeaf0
(int index, LL<? extends FingerTree<T, S>> nodes) int
(package private) final S
getSummaryBetween0
(int startLeaf, int endLeaf) private S
getSummaryBetween0
(int startLeaf, int endLeaf, LL<? extends FingerTree<T, S>> nodes) (package private) final S
getSummaryBetween0
(ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T, Integer, Integer, ? extends S> subSummary) private S
getSummaryBetween0
(ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T, Integer, Integer, ? extends S> subSummary, LL<? extends FingerTree<T, S>> nodes) (package private) BiIndex
private BiIndex
locate0
(BiFunction<? super S, Integer, Either<Integer, Integer>> navigate, int position, LL<? extends FingerTree.NonEmptyFingerTree<T, S>> nodes) (package private) final BiIndex
locateProgressively0
(ToIntFunction<? super S> metric, int position) private BiIndex
locateProgressively0
(ToIntFunction<? super S> metric, int position, LL<? extends FingerTree.NonEmptyFingerTree<T, S>> nodes) (package private) final BiIndex
locateRegressively0
(ToIntFunction<? super S> metric, int position) private BiIndex
locateRegressively0
(ToIntFunction<? super S> metric, int position, LL<? extends FingerTree.NonEmptyFingerTree<T, S>> nodes) (package private) Either
<FingerTree.Branch<T, S>, Tuple2<FingerTree.NonEmptyFingerTree<T, S>, FingerTree.NonEmptyFingerTree<T, S>>> prependLte
(FingerTree<T, S> prefix) (package private) Tuple2
<FingerTree<T, S>, FingerTree<T, S>> split0
(int beforeLeaf) private Tuple2
<FingerTree<T, S>, FingerTree<T, S>> split0
(int beforeLeaf, LL<? extends FingerTree<T, S>> nodes) subList
(int from, int to) Complexity of calling once: O(log(n)).subList0
(int from, int to) toString()
(package private) FingerTree.NonEmptyFingerTree
<T, S> updateLeaf0
(int index, T data) private LL.Cons
<FingerTree.NonEmptyFingerTree<T, S>> updateLeaf0
(int index, T data, LL<? extends FingerTree.NonEmptyFingerTree<T, S>> nodes) Methods inherited from class org.reactfx.util.FingerTree.NonEmptyFingerTree
appendTree, caseEmpty, join, locate, locateProgressively, locateRegressively, prependTree, split, split, splitAt
Methods inherited from class org.reactfx.util.FingerTree
append, empty, empty, foldBetween, foldBetween, get, get, getLeaf, getSummary, getSummaryBetween, getSummaryBetween, insertLeaf, isEmpty, leaf, measure, mkTree, mkTree, prepend, removeLeafs, split, updateLeaf
-
Field Details
-
children
-
depth
private final int depth -
leafCount
private final int leafCount -
summary
-
-
Constructor Details
-
Branch
-
-
Method Details
-
toString
-
getDepth
public int getDepth()- Specified by:
getDepth
in classFingerTree<T,
S>
-
getLeafCount
public int getLeafCount()- Specified by:
getLeafCount
in classFingerTree<T,
S>
-
asList
Description copied from class:FingerTree
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).
- Specified by:
asList
in classFingerTree<T,
S>
-
subList
Complexity of calling once: O(log(n)). Complexity of calling subList recursively on the resulting list, i.e.tree.asList().subList(...).subList(...). ... .subList(...)
up to n times: O(n). When the resulting list has size m, it may prevent up to m additional elements of the original tree from being garbage collected. -
subList0
-
getData
- Specified by:
getData
in classFingerTree<T,
S>
-
getLeaf0
- Specified by:
getLeaf0
in classFingerTree<T,
S>
-
getLeaf0
-
updateLeaf0
- Specified by:
updateLeaf0
in classFingerTree<T,
S>
-
updateLeaf0
private LL.Cons<FingerTree.NonEmptyFingerTree<T,S>> updateLeaf0(int index, T data, LL<? extends FingerTree.NonEmptyFingerTree<T, S>> nodes) -
locateProgressively0
- Specified by:
locateProgressively0
in classFingerTree.NonEmptyFingerTree<T,
S>
-
locateProgressively0
private BiIndex locateProgressively0(ToIntFunction<? super S> metric, int position, LL<? extends FingerTree.NonEmptyFingerTree<T, S>> nodes) -
locateRegressively0
- Specified by:
locateRegressively0
in classFingerTree.NonEmptyFingerTree<T,
S>
-
locateRegressively0
private BiIndex locateRegressively0(ToIntFunction<? super S> metric, int position, LL<? extends FingerTree.NonEmptyFingerTree<T, S>> nodes) -
fold
- Specified by:
fold
in classFingerTree<T,
S>
-
foldBetween0
final <R> R foldBetween0(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, int startLeaf, int endLeaf) - Specified by:
foldBetween0
in classFingerTree<T,
S>
-
foldBetween0
private <R> R foldBetween0(R acc, BiFunction<? super R, ? super T, ? extends R> reduction, int startLeaf, int endLeaf, LL<? extends FingerTree<T, S>> nodes) -
foldBetween0
final <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) - Specified by:
foldBetween0
in classFingerTree<T,
S>
-
foldBetween0
private <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, LL<? extends FingerTree<T, S>> nodes) -
getSummary
- Specified by:
getSummary
in classFingerTree.NonEmptyFingerTree<T,
S>
-
getSummaryOpt
- Specified by:
getSummaryOpt
in classFingerTree<T,
S>
-
getSummaryBetween0
- Specified by:
getSummaryBetween0
in classFingerTree<T,
S>
-
getSummaryBetween0
-
getSummaryBetween0
final S getSummaryBetween0(ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T, Integer, Integer, ? extends S> subSummary) - Specified by:
getSummaryBetween0
in classFingerTree<T,
S>
-
getSummaryBetween0
private S getSummaryBetween0(ToIntFunction<? super S> metric, int startPosition, int endPosition, TriFunction<? super T, Integer, Integer, ? extends S> subSummary, LL<? extends FingerTree<T, S>> nodes) -
appendLte
Either<FingerTree.Branch<T,S>, appendLteTuple2<FingerTree.NonEmptyFingerTree<T, S>, FingerTree.NonEmptyFingerTree<T, S>>> (FingerTree<T, S> suffix) - Specified by:
appendLte
in classFingerTree.NonEmptyFingerTree<T,
S>
-
prependLte
Either<FingerTree.Branch<T,S>, prependLteTuple2<FingerTree.NonEmptyFingerTree<T, S>, FingerTree.NonEmptyFingerTree<T, S>>> (FingerTree<T, S> prefix) - Specified by:
prependLte
in classFingerTree.NonEmptyFingerTree<T,
S>
-
split0
- Specified by:
split0
in classFingerTree<T,
S>
-
split0
private Tuple2<FingerTree<T,S>, split0FingerTree<T, S>> (int beforeLeaf, LL<? extends FingerTree<T, S>> nodes) -
locate0
- Specified by:
locate0
in classFingerTree.NonEmptyFingerTree<T,
S>
-
locate0
-