1 package net.sf.openrocket.optimization.general.multidim;
3 import java.util.Comparator;
5 import net.sf.openrocket.optimization.general.FunctionCache;
6 import net.sf.openrocket.optimization.general.Point;
9 * A comparator that orders Points in a function value order, smallest first.
11 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
13 public class FunctionCacheComparator implements Comparator<Point> {
15 private final FunctionCache cache;
17 public FunctionCacheComparator(FunctionCache cache) {
22 public int compare(Point o1, Point o2) {
23 double v1 = cache.getValue(o1);
24 double v2 = cache.getValue(o2);
26 return Double.compare(v1, v2);