Class FingerTree<T,​S>

    • Constructor Detail

      • FingerTree

        private FingerTree​(ToSemigroup<? super T,​S> semigroup)
    • Method Detail

      • empty

        public static <T,​S> FingerTree<T,​S> empty​(ToSemigroup<? super T,​S> statisticsProvider)
      • mkTree

        public static <T> FingerTree<T,​java.lang.Void> mkTree​(java.util.List<? extends T> items)
      • mkTree

        public static <T,​S> FingerTree<T,​S> mkTree​(java.util.List<? extends T> items,
                                                               ToSemigroup<? super T,​S> summaryProvider)
      • getDepth

        public abstract int getDepth()
      • getLeafCount

        public abstract int getLeafCount()
      • getSummaryOpt

        public abstract java.util.Optional<S> getSummaryOpt()
      • isEmpty

        public final boolean isEmpty()
      • getSummary

        public S getSummary​(S whenEmpty)
      • getLeaf

        public T getLeaf​(int index)
      • getLeaf0

        abstract T getLeaf0​(int index)
      • get

        public Tuple2<T,​BiIndex> get​(java.util.function.ToIntFunction<? super S> metric,
                                           int index)
      • get

        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)
      • locate

        public BiIndex locate​(java.util.function.BiFunction<? super S,​java.lang.Integer,​Either<java.lang.Integer,​java.lang.Integer>> navigate,
                              int position)
      • locateProgressively

        public BiIndex locateProgressively​(java.util.function.ToIntFunction<? super S> metric,
                                           int position)
      • locateRegressively

        public BiIndex locateRegressively​(java.util.function.ToIntFunction<? super S> metric,
                                          int position)
      • fold

        public abstract <R> R fold​(R acc,
                                   java.util.function.BiFunction<? super R,​? super T,​? extends R> reduction)
      • foldBetween

        public <R> R foldBetween​(R acc,
                                 java.util.function.BiFunction<? super R,​? super T,​? extends R> reduction,
                                 int startLeaf,
                                 int endLeaf)
      • foldBetween0

        abstract <R> R foldBetween0​(R acc,
                                    java.util.function.BiFunction<? super R,​? super T,​? extends R> reduction,
                                    int startLeaf,
                                    int endLeaf)
      • foldBetween

        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)
      • foldBetween0

        abstract <R> R foldBetween0​(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)
      • getSummaryBetween

        public java.util.Optional<S> getSummaryBetween​(int startLeaf,
                                                       int endLeaf)
      • getSummaryBetween0

        abstract S getSummaryBetween0​(int startLeaf,
                                      int endLeaf)
      • getSummaryBetween

        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)
      • getSummaryBetween0

        abstract S getSummaryBetween0​(java.util.function.ToIntFunction<? super S> metric,
                                      int startPosition,
                                      int endPosition,
                                      TriFunction<? super T,​java.lang.Integer,​java.lang.Integer,​? extends S> subSummary)
      • removeLeafs

        public FingerTree<T,​S> removeLeafs​(int fromLeaf,
                                                 int toLeaf)
      • insertLeaf

        public FingerTree<T,​S> insertLeaf​(int position,
                                                T data)
      • asList

        public abstract java.util.List<T> 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. calling subList on the result of previous subList, up to n times: O(n).
      • getData

        abstract T getData()
      • measure

        final int measure​(java.util.function.ToIntFunction<? super S> metric)