All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jamieswhiteshirt.rtree3i.MinimalVolumeIncreaseSelector Maven / Gradle / Ivy

The newest version!
package com.jamieswhiteshirt.rtree3i;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * A selector that selects the node which has the minimal amount of increase in volume on insertion.
 */
public final class MinimalVolumeIncreaseSelector implements Selector {

    @Override
    public  Node select(Box box, List> nodes) {
        Comparator boxComparator = Comparators.volumeIncreaseComparator(box).thenComparing(Comparators.volumeComparator(box));
        return Collections.min(nodes, Comparator.comparing(Node::getBox, boxComparator));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy