From: plaa Date: Sat, 31 Dec 2011 17:51:20 +0000 (+0000) Subject: added G unit for acceleration X-Git-Tag: upstream/12.03~1^2~216 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=0d09ecb0159228dbf6929b1439004d7950974108;p=debian%2Fopenrocket added G unit for acceleration git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@254 180e2498-e6e9-4542-8430-84ac67f01cd8 --- diff --git a/src/net/sf/openrocket/unit/UnitGroup.java b/src/net/sf/openrocket/unit/UnitGroup.java index ce380da5..f72f22a9 100644 --- a/src/net/sf/openrocket/unit/UnitGroup.java +++ b/src/net/sf/openrocket/unit/UnitGroup.java @@ -65,10 +65,10 @@ public class UnitGroup { // public static final UnitGroup UNITS_FREQUENCY; - + public static final Map UNITS; - + /* * Note: Units may not use HTML tags. * @@ -109,7 +109,7 @@ public class UnitGroup { UNITS_AREA.addUnit(new GeneralUnit(pow2(0.3048), "ft" + SQUARED)); UNITS_AREA.setDefaultUnit(1); - + UNITS_STABILITY = new UnitGroup(); UNITS_STABILITY.addUnit(new GeneralUnit(0.001, "mm")); UNITS_STABILITY.addUnit(new GeneralUnit(0.01, "cm")); @@ -120,7 +120,7 @@ public class UnitGroup { UNITS_STABILITY_CALIBERS = new UnitGroup(); UNITS_STABILITY_CALIBERS.addUnit(new GeneralUnit(1, "cal")); - + UNITS_VELOCITY = new UnitGroup(); UNITS_VELOCITY.addUnit(new GeneralUnit(1, "m/s")); UNITS_VELOCITY.addUnit(new GeneralUnit(1 / 3.6, "km/h")); @@ -130,6 +130,7 @@ public class UnitGroup { UNITS_ACCELERATION = new UnitGroup(); UNITS_ACCELERATION.addUnit(new GeneralUnit(1, "m/s" + SQUARED)); UNITS_ACCELERATION.addUnit(new GeneralUnit(0.3048, "ft/s" + SQUARED)); + UNITS_ACCELERATION.addUnit(new GeneralUnit(9.80665, "G")); UNITS_MASS = new UnitGroup(); UNITS_MASS.addUnit(new GeneralUnit(0.001, "g")); @@ -222,16 +223,16 @@ public class UnitGroup { // UNITS_RELATIVE.addUnit(new FixedPrecisionUnit("" + PERMILLE, 1, 0.001)); UNITS_RELATIVE.setDefaultUnit(1); - + UNITS_ROUGHNESS = new UnitGroup(); UNITS_ROUGHNESS.addUnit(new GeneralUnit(0.000001, MICRO + "m")); UNITS_ROUGHNESS.addUnit(new GeneralUnit(0.0000254, "mil")); - + UNITS_COEFFICIENT = new UnitGroup(); UNITS_COEFFICIENT.addUnit(new FixedPrecisionUnit("" + ZWSP, 0.01)); // zero-width space - + // This is not used by OpenRocket, and not extensively tested: // UNITS_FREQUENCY = new UnitGroup(); // UNITS_FREQUENCY.addUnit(new GeneralUnit(1, "s")); @@ -241,7 +242,7 @@ public class UnitGroup { // UNITS_FREQUENCY.addUnit(new FrequencyUnit(1000, "kHz")); // UNITS_FREQUENCY.setDefaultUnit(3); - + HashMap map = new HashMap(); map.put("NONE", UNITS_NONE); map.put("LENGTH", UNITS_LENGTH); @@ -358,7 +359,7 @@ public class UnitGroup { ////////////////////////////////////////////////////// - + protected ArrayList units = new ArrayList(); protected int defaultUnit = 0; @@ -382,7 +383,7 @@ public class UnitGroup { } - + /** * Find a unit by approximate unit name. Only letters and (ordinary) numbers are * considered in the matching. This method is mainly means for testing, allowing @@ -466,9 +467,9 @@ public class UnitGroup { } - - - + + + /** * Creates a new Value object with the specified value and the default unit of this group. * @@ -480,8 +481,8 @@ public class UnitGroup { } - - + + private static final Pattern STRING_PATTERN = Pattern.compile("^\\s*([0-9.,-]+)(.*?)$"); /** @@ -529,7 +530,7 @@ public class UnitGroup { /////////////////////////// - + /** * A private class that switches the CaliberUnit to a rocket-specific CaliberUnit. * All other methods are passed through to UNITS_STABILITY.