1 package net.sf.openrocket.optimization;
3 import java.util.Comparator;
6 * A comparator that orders Points in a function value order, smallest first.
8 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
10 public class FunctionCacheComparator implements Comparator<Point> {
12 private final FunctionCache cache;
14 public FunctionCacheComparator(FunctionCache cache) {
19 public int compare(Point o1, Point o2) {
20 double v1 = cache.getValue(o1);
21 double v2 = cache.getValue(o2);
23 return Double.compare(v1, v2);