
com.jamieswhiteshirt.rtree3i.Group Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rtree-3i-lite Show documentation
Show all versions of rtree-3i-lite Show documentation
Immutable map applying a spatial index to keys based on R-Trees
The newest version!
package com.jamieswhiteshirt.rtree3i;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* A list of values with a minimum bounding box containing all entries.
* @param type of values in the group
*/
public final class Group {
private final List entries;
private final Box box;
/**
* Returns a group containing the entries with a minimum bounding box by applying the box mapper to entries.
* @param entries group entries
* @param boxMapper box mapper applied to entries
* @param type of values in the group
* @return a group containing the entries with a minimum bounding box by applying the box mapper to entries
*/
public static Group of(List entries, Function boxMapper) {
return new Group<>(entries, Util.mbb(entries.stream().map(boxMapper).collect(Collectors.toList())));
}
/**
* Constructs a group containing the entries with the minimum bounding box.
* @param entries group entries
* @param box minimum bounding box
*/
public Group(List entries, Box box) {
this.entries = entries;
this.box = box;
}
/**
* Returns the group entries.
* @return the group entries
*/
public List getEntries() {
return entries;
}
/**
* Returns the minimum bounding box containing all entries.
* @return the minimum bounding box containing all entries
*/
public Box getBox() {
return box;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy