Added extrudedGrain superclass
[sw/motorsim] / src / com / billkuker / rocketry / motorsim / grain / RodAndTubeGrain.java
index 2ae00f44b966c6b3b516004fd22cbd472f7d1ab3..bf35bb8e17741891d19a33b8f5a9b03d7d114647 100644 (file)
@@ -8,6 +8,8 @@ import javax.measure.unit.SI;
 import org.jscience.physics.amount.Amount;\r
 \r
 import com.billkuker.rocketry.motorsim.Grain;\r
+import com.billkuker.rocketry.motorsim.visual.Editor;\r
+import com.billkuker.rocketry.motorsim.visual.GrainPanel;\r
 \r
 public class RodAndTubeGrain extends CompoundGrain {\r
        CoredCylindricalGrain rod, tube;\r
@@ -19,14 +21,15 @@ public class RodAndTubeGrain extends CompoundGrain {
                        rod.setID(Amount.valueOf(0, SI.MILLIMETER));\r
                        rod.setOD(Amount.valueOf(10, SI.MILLIMETER));\r
                        rod.setOuterSurfaceInhibited(false);\r
-                       rod.setEndSurfaceInhibited(true);\r
+                       rod.setForeEndInhibited(true);\r
+                       rod.setAftEndInhibited(true);\r
                        \r
                        tube = new CoredCylindricalGrain();\r
                        tube.setInnerSurfaceInhibited(false);\r
                        tube.setID(Amount.valueOf(20, SI.MILLIMETER));\r
                        tube.setOD(Amount.valueOf(30, SI.MILLIMETER));\r
-                       tube.setOuterSurfaceInhibited(true);\r
-                       tube.setEndSurfaceInhibited(true);\r
+                       tube.setForeEndInhibited(true);\r
+                       tube.setAftEndInhibited(true);\r
                } catch ( PropertyVetoException v ){\r
                        v.printStackTrace();\r
                        //I know these values are OK\r
@@ -60,16 +63,6 @@ public class RodAndTubeGrain extends CompoundGrain {
                tube.setOD(od);\r
        }\r
 \r
-       public boolean isEndSurfaceInhibited() {\r
-               return rod.isEndSurfaceInhibited();\r
-       }\r
-\r
-       public void setEndSurfaceInhibited(boolean endSurfaceInhibited)\r
-                       throws PropertyVetoException {\r
-               rod.setEndSurfaceInhibited(endSurfaceInhibited);\r
-               tube.setEndSurfaceInhibited(endSurfaceInhibited);\r
-       }\r
-\r
        public Amount<Length> getLength() {\r
                return rod.getLength();\r
        }\r
@@ -79,4 +72,30 @@ public class RodAndTubeGrain extends CompoundGrain {
                tube.setLength(length);\r
        }\r
 \r
+       public boolean isAftEndInhibited() {\r
+               return rod.isAftEndInhibited();\r
+       }\r
+\r
+       public boolean isForeEndInhibited() {\r
+               return rod.isForeEndInhibited();\r
+       }\r
+\r
+       public void setAftEndInhibited(boolean aftEndInhibited)\r
+                       throws PropertyVetoException {\r
+               rod.setAftEndInhibited(aftEndInhibited);\r
+               tube.setAftEndInhibited(aftEndInhibited);\r
+       }\r
+\r
+       public void setForeEndInhibited(boolean foreEndInhibited)\r
+                       throws PropertyVetoException {\r
+               rod.setForeEndInhibited(foreEndInhibited);\r
+               tube.setForeEndInhibited(foreEndInhibited);\r
+       }\r
+\r
+\r
+       public static void main(String args[]) throws Exception {\r
+               Grain g = new RodAndTubeGrain();\r
+               new Editor(g).show();\r
+               new GrainPanel(g).show();\r
+       }\r
 }\r