1 package net.sf.openrocket.gui.dialogs.motor.thrustcurve;
3 import java.util.Comparator;
5 import net.sf.openrocket.motor.ThrustCurveMotor;
8 * Compares two ThrustCurveMotor objects for quality.
10 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
12 public class ThrustCurveMotorComparator implements Comparator<ThrustCurveMotor> {
16 public int compare(ThrustCurveMotor o1, ThrustCurveMotor o2) {
17 return calculateGoodness(o2) - calculateGoodness(o1);
21 private int calculateGoodness(ThrustCurveMotor motor) {
23 * 10 chars of comments correspond to one thrust point, max ten points.
25 int commentLength = Math.min(motor.getDescription().length(), 100);
26 return motor.getTimePoints().length * 10 + commentLength;