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

org.khelekore.prtree.InternalNodeComparators Maven / Gradle / Ivy

There is a newer version: 1.11
Show newest version
package org.khelekore.prtree;

import java.util.Comparator;

class InternalNodeComparators implements NodeComparators> {
    private final MBRConverter converter;

    public InternalNodeComparators (MBRConverter converter) {
	this.converter = converter;
    }

    public Comparator> getMinComparator (final int axis) {
	return new Comparator> () {
	    public int compare (Node n1, Node n2) {
		double d1 = n1.getMBR (converter).getMin (axis);
		double d2 = n2.getMBR (converter).getMin (axis);
		return Double.compare (d1, d2);
	    }
	};
    }

    public Comparator> getMaxComparator (final int axis) {
	return new Comparator> () {
	    public int compare (Node n1, Node n2) {
		double d1 = n1.getMBR (converter).getMax (axis);
		double d2 = n2.getMBR (converter).getMax (axis);
		return Double.compare (d1, d2);
	    }
	};
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy