Package at.jku.ssw.fp.sect07_4
Class ConstantCollector
- java.lang.Object
-
- at.jku.ssw.fp.sect07_4.ConstantCollector
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.stream.Collector
Collector.Characteristics
-
-
Field Summary
Fields Modifier and Type Field Description private static double
MAX_DIFF
Constant for the maximum difference between values which are regarded to be equal.
-
Constructor Summary
Constructors Constructor Description ConstantCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BiConsumer<Deque<List<Double>>,Double>
accumulator()
A function that adds a value.private double
avrg(List<Double> l)
Set<Collector.Characteristics>
characteristics()
Returns an empty set of characteristics.BinaryOperator<Deque<List<Double>>>
combiner()
A function that accepts two partial results and merges them.Function<Deque<List<Double>>,List<Double>>
finisher()
Performs the final transformation.private boolean
smallDiff(List<Double> q, double msnt)
private boolean
smallDiff(List<Double> q1, List<Double> q2)
Supplier<Deque<List<Double>>>
supplier()
A function that creates and returns a new queue of lists as mutable result container.
-
-
-
Field Detail
-
MAX_DIFF
private static final double MAX_DIFF
Constant for the maximum difference between values which are regarded to be equal.- See Also:
- Constant Field Values
-
-
Method Detail
-
supplier
public Supplier<Deque<List<Double>>> supplier()
A function that creates and returns a new queue of lists as mutable result container.
-
accumulator
public BiConsumer<Deque<List<Double>>,Double> accumulator()
A function that adds a value. When the difference to the previous values is small, the value is added to the last list; Otherwise a new list with this value is created and added to the queue of lists.
-
combiner
public BinaryOperator<Deque<List<Double>>> combiner()
A function that accepts two partial results and merges them.
-
finisher
public Function<Deque<List<Double>>,List<Double>> finisher()
Performs the final transformation. Each list in the queue of lists is processed by computing the average of values. The result is a list of average values.
-
characteristics
public Set<Collector.Characteristics> characteristics()
Returns an empty set of characteristics.
-
-