Package fj.data.fingertrees
Class Measured<V,A>
java.lang.Object
fj.data.fingertrees.Measured<V,A>
Determines how the elements of a tree are measured and how measures are summed. Consists of a monoid and a
measuring function. Different instances of this class will result in different behaviours for the tree.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA measured instance for digits.measure()
Returns the measuring function.Measures a given element.static <V,
A> Measured <V, A> monoid()
Returns the monoid used to sum measures.A measured instance for nodes.Sums the given measurements with the monoid.zero()
Returns the identity measurement for the monoid.
-
Field Details
-
m
-
measure
-
-
Constructor Details
-
Measured
-
-
Method Details
-
measured
-
monoid
Returns the monoid used to sum measures.- Returns:
- the monoid used to sum measures.
-
measure
Returns the measuring function.- Returns:
- the measuring function.
-
measure
Measures a given element.- Parameters:
a
- An element to measure.- Returns:
- the element's measurement.
-
sum
Sums the given measurements with the monoid.- Parameters:
a
- A measurement to add to another.b
- A measurement to add to another.- Returns:
- The sum of the two measurements.
-
zero
Returns the identity measurement for the monoid.- Returns:
- the identity measurement for the monoid.
-
nodeMeasured
A measured instance for nodes.- Returns:
- A measured instance for nodes.
-
digitMeasured
A measured instance for digits.- Returns:
- A measured instance for digits.
-