From d9c0f68e64be42855ddeea3632810ffdf1d772d9 Mon Sep 17 00:00:00 2001 From: kruland2607 Date: Mon, 4 Feb 2013 14:37:18 -0600 Subject: [PATCH] Remove a bunch of commented out code. --- .../gui/plot/PlotConfiguration.java | 117 +++++------------- 1 file changed, 34 insertions(+), 83 deletions(-) diff --git a/core/src/net/sf/openrocket/gui/plot/PlotConfiguration.java b/core/src/net/sf/openrocket/gui/plot/PlotConfiguration.java index 5556104dd..fc0b5b8f0 100644 --- a/core/src/net/sf/openrocket/gui/plot/PlotConfiguration.java +++ b/core/src/net/sf/openrocket/gui/plot/PlotConfiguration.java @@ -1,6 +1,5 @@ package net.sf.openrocket.gui.plot; -import java.util.Collections; import java.util.EnumSet; import java.util.List; import java.util.Set; @@ -128,8 +127,8 @@ public class PlotConfiguration implements Cloneable { DEFAULT_CONFIGURATIONS = configs.toArray(new PlotConfiguration[0]); } - - + + /** Bonus given for the first type being on the first axis */ private static final double BONUS_FIRST_TYPE_ON_FIRST_AXIS = 1.0; @@ -145,11 +144,11 @@ public class PlotConfiguration implements Cloneable { /** Bonus given for only using a single axis. */ private static final double BONUS_ONLY_ONE_AXIS = 50.0; - + private static final double INCLUDE_ZERO_DISTANCE = 0.3; // 30% of total range - - + + /** The data types to be plotted. */ private ArrayList plotDataTypes = new ArrayList(); @@ -164,14 +163,14 @@ public class PlotConfiguration implements Cloneable { private FlightDataType domainAxisType = null; private Unit domainAxisUnit = null; - + /** All available axes. */ private final int axesCount; private ArrayList allAxes = new ArrayList(); private String name = null; - + public PlotConfiguration() { this(null, FlightDataType.TYPE_TIME); } @@ -191,7 +190,7 @@ public class PlotConfiguration implements Cloneable { } //// Axis - + public FlightDataType getDomainAxisType() { return domainAxisType; } @@ -221,7 +220,7 @@ public class PlotConfiguration implements Cloneable { } //// FlightDataTypes - + public void addPlotDataType(FlightDataType type) { plotDataTypes.add(type); plotDataUnits.add(type.getUnitGroup().getDefaultUnit()); @@ -278,7 +277,7 @@ public class PlotConfiguration implements Cloneable { } - + public FlightDataType getType(int index) { return plotDataTypes.get(index); } @@ -315,9 +314,9 @@ public class PlotConfiguration implements Cloneable { } - - - + + + public List getAllAxes() { List list = new ArrayList(); list.addAll(allAxes); @@ -342,7 +341,7 @@ public class PlotConfiguration implements Cloneable { } - + /** * Find the best combination of the auto-selectable axes. * @@ -357,8 +356,8 @@ public class PlotConfiguration implements Cloneable { } - - + + /** * Recursively search for the best combination of the auto-selectable axes. * This is a brute-force search method. @@ -377,13 +376,13 @@ public class PlotConfiguration implements Cloneable { break; } - + if (autoindex >= plotDataAxes.size()) { // All axes have been assigned, just return since we are already the best return new Pair(copy, copy.getGoodnessValue(data)); } - + // Set the auto-selected index one at a time and choose the best one PlotConfiguration best = null; double bestValue = Double.NEGATIVE_INFINITY; @@ -400,9 +399,9 @@ public class PlotConfiguration implements Cloneable { } - - - + + + /** * Fit the axes to hold the provided data. All of the plotDataAxis elements must * be non-negative. @@ -452,7 +451,7 @@ public class PlotConfiguration implements Cloneable { } } - + // Check whether to use a common zero Axis left = allAxes.get(0); Axis right = allAxes.get(1); @@ -462,8 +461,8 @@ public class PlotConfiguration implements Cloneable { Double.isNaN(left.getMinValue()) || Double.isNaN(right.getMinValue())) return; - - + + //// Compute common zero // TODO: MEDIUM: This algorithm may require tweaking @@ -474,7 +473,7 @@ public class PlotConfiguration implements Cloneable { // Calculate and round scaling factor double scale = Math.max(left.getRangeLength(), right.getRangeLength()) / - Math.min(left.getRangeLength(), right.getRangeLength()); + Math.min(left.getRangeLength(), right.getRangeLength()); //System.out.println("Scale: " + scale); @@ -494,54 +493,6 @@ public class PlotConfiguration implements Cloneable { min2 /= scale; max2 /= scale; - - - // Scale to unit length - // double scale1 = left.getRangeLength(); - // double scale2 = right.getRangeLength(); - // - // double min1 = left.getMinValue() / scale1; - // double max1 = left.getMaxValue() / scale1; - // double min2 = right.getMinValue() / scale2; - // double max2 = right.getMaxValue() / scale2; - // - // // Combine unit ranges - // min1 = MathUtil.min(min1, min2); - // min2 = min1; - // max1 = MathUtil.max(max1, max2); - // max2 = max1; - // - // // Scale up - // min1 *= scale1; - // max1 *= scale1; - // min2 *= scale2; - // max2 *= scale2; - // - // // Compute common scale - // double range1 = max1-min1; - // double range2 = max2-min2; - // - // double scale = MathUtil.max(range1, range2) / MathUtil.min(range1, range2); - // double roundScale = roundScale(scale); - // - // if (range2 < range1) { - // if (roundScale < scale) { - // min2 = min1 / roundScale; - // max2 = max1 / roundScale; - // } else { - // min1 = min2 * roundScale; - // max1 = max2 * roundScale; - // } - // } else { - // if (roundScale > scale) { - // min2 = min1 * roundScale; - // max2 = max1 * roundScale; - // } else { - // min1 = min2 / roundScale; - // max1 = max2 / roundScale; - // } - // } - // Apply scale left.addBound(min1); left.addBound(max1); @@ -551,7 +502,7 @@ public class PlotConfiguration implements Cloneable { } - + private double roundScale(double scale) { double mul = 1; while (scale >= 10) { @@ -580,7 +531,7 @@ public class PlotConfiguration implements Cloneable { } - + @SuppressWarnings("unused") private double roundScaleUp(double scale) { double mul = 1; @@ -633,7 +584,7 @@ public class PlotConfiguration implements Cloneable { } - + /** * Fits the axis ranges to the data and returns the "goodness value" of this * selection of axes. All plotDataAxis elements must be non-null. @@ -675,11 +626,11 @@ public class PlotConfiguration implements Cloneable { goodness += d * 100.0; } - + /* * Add extra points for specific things. */ - + // A little for the first type being on the first axis if (plotDataAxes.get(0) == 0) goodness += BONUS_FIRST_TYPE_ON_FIRST_AXIS; @@ -703,7 +654,7 @@ public class PlotConfiguration implements Cloneable { } - + /** * Reset the units of this configuration to the default units. Returns this * PlotConfiguration. @@ -718,8 +669,8 @@ public class PlotConfiguration implements Cloneable { } - - + + @Override public PlotConfiguration clone() { try { @@ -740,7 +691,7 @@ public class PlotConfiguration implements Cloneable { return copy; - + } catch (CloneNotSupportedException e) { throw new BugException("BUG! Could not clone()."); }