Add an interface to allow export of pvc motors
authorBill Kuker <bkuker@billkuker.com>
Sun, 26 Jun 2011 21:52:11 +0000 (21:52 +0000)
committerBill Kuker <bkuker@billkuker.com>
Sun, 26 Jun 2011 21:52:11 +0000 (21:52 +0000)
src/com/billkuker/rocketry/motorsim/CylindricalChamber.java
src/com/billkuker/rocketry/motorsim/ICylindricalChamber.java [new file with mode: 0644]
src/com/billkuker/rocketry/motorsim/cases/Schedule40.java
src/com/billkuker/rocketry/motorsim/cases/Schedule80.java
src/com/billkuker/rocketry/motorsim/io/ENGExporter.java

index 5ed318e42107f79d5d149ade9071c00511a31788..8405456ac5c04069e5200c86bea2e95b15186cfc 100644 (file)
@@ -11,7 +11,7 @@ import javax.measure.unit.SI;
 \r
 import org.jscience.physics.amount.Amount;\r
 \r
-public class CylindricalChamber implements Chamber {\r
+public class CylindricalChamber implements Chamber, ICylindricalChamber {\r
        \r
        private Amount<Length> length = Amount.valueOf(200, SI.MILLIMETER);\r
        private Amount<Length> oD = Amount.valueOf(31, SI.MILLIMETER);\r
diff --git a/src/com/billkuker/rocketry/motorsim/ICylindricalChamber.java b/src/com/billkuker/rocketry/motorsim/ICylindricalChamber.java
new file mode 100644 (file)
index 0000000..93e85f5
--- /dev/null
@@ -0,0 +1,15 @@
+package com.billkuker.rocketry.motorsim;\r
+\r
+import javax.measure.quantity.Length;\r
+\r
+import org.jscience.physics.amount.Amount;\r
+\r
+public interface ICylindricalChamber {\r
+       public Amount<Length> getLength();\r
+\r
+\r
+       public Amount<Length> getID();\r
+\r
+       \r
+       public Amount<Length> getOD();\r
+}\r
index 2a2beebc207babb12c74ae05ca5a8c77e9d3ce23..89797462a5eccae84c5fbe5990084003155a3185 100644 (file)
@@ -11,9 +11,10 @@ import org.jscience.physics.amount.Amount;
 \r
 import com.billkuker.rocketry.motorsim.Chamber;\r
 import com.billkuker.rocketry.motorsim.CylindricalChamber;\r
+import com.billkuker.rocketry.motorsim.ICylindricalChamber;\r
 import com.billkuker.rocketry.motorsim.RocketScience;\r
 \r
-public class Schedule40 implements Chamber {\r
+public class Schedule40 implements Chamber, ICylindricalChamber {\r
        public static enum Size {               \r
                \r
                //Dimensions: http://www.harvel.com/pipepvc-sch40-80-dim.asp\r
index b47fc89d924c50eac643ce0eb5c96ead0f31d3fc..2e6cca2f1bac1bdd86ec7e486f61bf4965f0867a 100644 (file)
@@ -11,9 +11,10 @@ import org.jscience.physics.amount.Amount;
 \r
 import com.billkuker.rocketry.motorsim.Chamber;\r
 import com.billkuker.rocketry.motorsim.CylindricalChamber;\r
+import com.billkuker.rocketry.motorsim.ICylindricalChamber;\r
 import com.billkuker.rocketry.motorsim.RocketScience;\r
 \r
-public class Schedule80 implements Chamber {\r
+public class Schedule80 implements Chamber, ICylindricalChamber {\r
        public static enum Size {               \r
                \r
                //Dimensions: http://www.harvel.com/pipepvc-sch40-80-dim.asp\r
index d1f4879f621f3fe9e5d88036238b4dd562ad9c2e..1a9f273c1b8daf9c4060c3571ba1ade19e38650f 100644 (file)
@@ -15,8 +15,8 @@ import javax.measure.unit.SI;
 import org.jscience.physics.amount.Amount;
 
 import com.billkuker.rocketry.motorsim.Burn;
-import com.billkuker.rocketry.motorsim.CylindricalChamber;
 import com.billkuker.rocketry.motorsim.GraphSimplifier;
+import com.billkuker.rocketry.motorsim.ICylindricalChamber;
 
 public class ENGExporter {
 
@@ -32,7 +32,7 @@ public class ENGExporter {
 
        public static void export(Burn b, OutputStream os) throws IOException {
 
-               CylindricalChamber cha = (CylindricalChamber) b.getMotor().getChamber();
+               ICylindricalChamber cha = (ICylindricalChamber) b.getMotor().getChamber();
 
                NumberFormat nf = new DecimalFormat("00.####");