Class Digit<V,A>
java.lang.Object
fj.data.fingertrees.Digit<V,A>
A digit is a vector of 1-4 elements. Serves as a pointer to the prefix or suffix of a finger tree.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <B> BFolds this digit to the left using the given function and the given initial value.abstract <B> BFolds this digit to the right using the given function and the given initial value.init()abstract intlength()Maps a function across the elements of this digit, measuring with the given measurement.abstract <B> BStructural pattern matching on digits.final Vmeasure()Returns the sum of the measurements of this digit according to the monoid.measured()final AFolds this digit to the right using the given function.final AFolds this digit to the right using the given function.tail()toStream()toString()final FingerTree<V, A> toTree()Returns the tree representation of this digit.
-
Field Details
-
m
-
-
Constructor Details
-
Digit
-
-
Method Details
-
foldRight
Folds this digit to the right using the given function and the given initial value.- Parameters:
f- A function with which to fold this digit.z- An initial value to apply at the rightmost end of the fold.- Returns:
- The right reduction of this digit with the given function and the given initial value.
-
foldLeft
Folds this digit to the left using the given function and the given initial value.- Parameters:
f- A function with which to fold this digit.z- An initial value to apply at the leftmost end of the fold.- Returns:
- The left reduction of this digit with the given function and the given initial value.
-
reduceRight
-
reduceLeft
-
map
Maps a function across the elements of this digit, measuring with the given measurement.- Parameters:
f- A function to map across the elements of this digit.m- A measuring for the function's domain (destination type).- Returns:
- A new digit with the same structure as this digit, but with all elements transformed with the given function and measured with the given measuring.
-
match
public abstract <B> B match(F<One<V, A>, B> one, F<Two<V, A>, B> two, F<Three<V, A>, B> three, F<Four<V, A>, B> four) Structural pattern matching on digits. Applies the function that matches the structure of this digit.- Parameters:
one- A function to apply to this digit if it's One.two- A function to apply to this digit if it's Two.three- A function to apply to this digit if it's Three.four- A function to apply to this digit if it's Four.- Returns:
- The result of applying the function matching this Digit.
-
measured
-
measure
Returns the sum of the measurements of this digit according to the monoid.- Returns:
- the sum of the measurements of this digit according to the monoid.
-
toTree
Returns the tree representation of this digit.- Returns:
- the tree representation of this digit.
-
tail
-
init
-
split1
-
lookup
-
length
public abstract int length() -
toString
-
toStream
-