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

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

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

import java.util.Comparator;

class DataComparators implements NodeComparators {
    private final MBRConverter converter;

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

    public Comparator getMinComparator (final int axis) {
	return new Comparator () {
	    public int compare (T t1, T t2) {
		double d1 = converter.getMin (axis, t1);
		double d2 = converter.getMin (axis, t2);
		return Double.compare (d1, d2);
	    }
	};
    }

    public Comparator getMaxComparator (final int axis) {
	return new Comparator () {
	    public int compare (T t1, T t2) {
		double d1 = converter.getMax (axis, t1);
		double d2 = converter.getMax (axis, t2);
		return Double.compare (d1, d2);
	    }
	};
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy