21 package org.matsim.core.utils.collections;
23 import java.util.Collection;
24 import java.util.function.Function;
29 import com.google.common.base.Preconditions;
41 Preconditions.checkArgument(buffer >= 0,
"Only non-negative buffer allowed");
42 Preconditions.checkArgument(!elements.isEmpty(),
"Elements must not be empty");
43 double minX = Double.POSITIVE_INFINITY;
44 double minY = Double.POSITIVE_INFINITY;
45 double maxX = Double.NEGATIVE_INFINITY;
46 double maxY = Double.NEGATIVE_INFINITY;
48 for (E e : elements) {
49 Coord c = coordFunction.apply(e);
50 if (c.
getX() < minX) {
53 if (c.
getY() < minY) {
56 if (c.
getX() > maxX) {
59 if (c.
getY() > maxY) {
65 for (E stop : elements) {
66 Coord c = coordFunction.apply(stop);
boolean put(final double x, final double y, final T value)
static< E > QuadTree< E > createQuadTree(Collection< E > elements, Function< E, Coord > coordFunction, double buffer)
static< E extends BasicLocation > QuadTree< E > createQuadTree(Collection< E > elements)