java.lang.Object
org.jhotdraw8.geom.BoundsCalculator
A state object for finding the combined bounds of a stream of Bounds objects.
This class is designed to work with a (parallel) stream of Bounds objects with:
Stream<Bounds> boundsStream = ... ;
BoundsCalculator stats = boundsStream.collect(BoundsCalculator::new,
BoundsCalculator::accept,
BoundsCalculator::combine);
The BoundsCalculator can be used as a reduction
BoundsCalculator stats = figures.stream()
.collect(BoundsCalculator.collectBounds(Figure::getBoundsInWorld));
- Author:
- Werner Randelshofer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(javafx.geometry.Bounds value) Adds another value to the bounds.voidcombine(BoundsCalculator other) Combines the state of anotherBoundsCalculatorinto this one.javafx.geometry.BoundsGetter.
-
Constructor Details
-
BoundsCalculator
public BoundsCalculator()Constructs a new instance with initially empty bounds.
-
-
Method Details
-
accept
public void accept(javafx.geometry.Bounds value) Adds another value to the bounds.- Parameters:
value- the input value
-
combine
Combines the state of anotherBoundsCalculatorinto this one.- Parameters:
other- anotherBoundsCalculator- Throws:
NullPointerException- ifotheris null
-
getBounds
public javafx.geometry.Bounds getBounds()Getter.- Returns:
- the calculated bounds
-