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
-
Constructor Details
-
BoundsCalculator
public BoundsCalculator()Constructs a new instance with initially empty bounds.
-
-
Method Details
-
accept
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
Getter.- Returns:
- the calculated bounds
-