From: Bill Kuker Date: Sun, 26 Jun 2011 21:52:11 +0000 (+0000) Subject: Add an interface to allow export of pvc motors X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=c65affc68738d3d1fcfbcaa8628e6b556e121d74;p=sw%2Fmotorsim Add an interface to allow export of pvc motors --- diff --git a/src/com/billkuker/rocketry/motorsim/CylindricalChamber.java b/src/com/billkuker/rocketry/motorsim/CylindricalChamber.java index 5ed318e..8405456 100644 --- a/src/com/billkuker/rocketry/motorsim/CylindricalChamber.java +++ b/src/com/billkuker/rocketry/motorsim/CylindricalChamber.java @@ -11,7 +11,7 @@ import javax.measure.unit.SI; import org.jscience.physics.amount.Amount; -public class CylindricalChamber implements Chamber { +public class CylindricalChamber implements Chamber, ICylindricalChamber { private Amount length = Amount.valueOf(200, SI.MILLIMETER); private Amount oD = Amount.valueOf(31, SI.MILLIMETER); diff --git a/src/com/billkuker/rocketry/motorsim/ICylindricalChamber.java b/src/com/billkuker/rocketry/motorsim/ICylindricalChamber.java new file mode 100644 index 0000000..93e85f5 --- /dev/null +++ b/src/com/billkuker/rocketry/motorsim/ICylindricalChamber.java @@ -0,0 +1,15 @@ +package com.billkuker.rocketry.motorsim; + +import javax.measure.quantity.Length; + +import org.jscience.physics.amount.Amount; + +public interface ICylindricalChamber { + public Amount getLength(); + + + public Amount getID(); + + + public Amount getOD(); +} diff --git a/src/com/billkuker/rocketry/motorsim/cases/Schedule40.java b/src/com/billkuker/rocketry/motorsim/cases/Schedule40.java index 2a2beeb..8979746 100644 --- a/src/com/billkuker/rocketry/motorsim/cases/Schedule40.java +++ b/src/com/billkuker/rocketry/motorsim/cases/Schedule40.java @@ -11,9 +11,10 @@ import org.jscience.physics.amount.Amount; import com.billkuker.rocketry.motorsim.Chamber; import com.billkuker.rocketry.motorsim.CylindricalChamber; +import com.billkuker.rocketry.motorsim.ICylindricalChamber; import com.billkuker.rocketry.motorsim.RocketScience; -public class Schedule40 implements Chamber { +public class Schedule40 implements Chamber, ICylindricalChamber { public static enum Size { //Dimensions: http://www.harvel.com/pipepvc-sch40-80-dim.asp diff --git a/src/com/billkuker/rocketry/motorsim/cases/Schedule80.java b/src/com/billkuker/rocketry/motorsim/cases/Schedule80.java index b47fc89..2e6cca2 100644 --- a/src/com/billkuker/rocketry/motorsim/cases/Schedule80.java +++ b/src/com/billkuker/rocketry/motorsim/cases/Schedule80.java @@ -11,9 +11,10 @@ import org.jscience.physics.amount.Amount; import com.billkuker.rocketry.motorsim.Chamber; import com.billkuker.rocketry.motorsim.CylindricalChamber; +import com.billkuker.rocketry.motorsim.ICylindricalChamber; import com.billkuker.rocketry.motorsim.RocketScience; -public class Schedule80 implements Chamber { +public class Schedule80 implements Chamber, ICylindricalChamber { public static enum Size { //Dimensions: http://www.harvel.com/pipepvc-sch40-80-dim.asp diff --git a/src/com/billkuker/rocketry/motorsim/io/ENGExporter.java b/src/com/billkuker/rocketry/motorsim/io/ENGExporter.java index d1f4879..1a9f273 100644 --- a/src/com/billkuker/rocketry/motorsim/io/ENGExporter.java +++ b/src/com/billkuker/rocketry/motorsim/io/ENGExporter.java @@ -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.####");