\r
import org.jscience.physics.amount.Amount;\r
\r
-import com.billkuker.rocketry.motorsim.MotorPart;\r
+import com.billkuker.rocketry.motorsim.Validating;\r
import com.billkuker.rocketry.motorsim.visual.Editor;\r
import com.billkuker.rocketry.motorsim.visual.GrainPanel;\r
\r
\r
-public class CoredCylindricalGrain extends ExtrudedGrain implements MotorPart.Validating {\r
+public class CoredCylindricalGrain extends ExtrudedGrain implements Validating {\r
\r
private Amount<Length> oD, iD;\r
private boolean outerSurfaceInhibited = true, innerSurfaceInhibited = false;\r
innerSurfaceInhibited = in;\r
}\r
\r
- @Override\r
public Amount<Area> surfaceArea(Amount<Length> regression) {\r
Amount<Length> zero = Amount.valueOf(0, SI.MILLIMETER);\r
if ( regression.isLessThan(zero) )\r
return total;\r
}\r
\r
- @Override\r
public Amount<Volume> volume(Amount<Length> regression) {\r
Amount<Length> zero = Amount.valueOf(0, SI.MILLIMETER);\r
\r
}\r
\r
public void setOD(Amount<Length> od) throws PropertyVetoException {\r
- fireVetoableChange("od", this.oD, od);\r
- Amount<Length> old = this.oD;\r
this.oD = od;\r
- firePropertyChange("OD", old, oD);\r
}\r
\r
public void setID(Amount<Length> id) throws PropertyVetoException {\r
- fireVetoableChange("id", this.iD, id);\r
- Amount<Length> old = this.iD;\r
iD = id;\r
- firePropertyChange("ID", old, iD);\r
}\r
\r
- public void checkValidity() throws ValidationException{\r
+ @Override\r
+ public void validate() throws ValidationException{\r
if ( iD.equals(Amount.ZERO) )\r
throw new ValidationException(this, "Invalid iD");\r
if ( oD.equals(Amount.ZERO) )\r
\r
}\r
\r
- @Override\r
public Amount<Length> webThickness() {\r
if ( innerSurfaceInhibited && outerSurfaceInhibited ){\r
return oD; //TODO gotta move this to the end\r
return iD;\r
}\r
\r
- @Override\r
public java.awt.geom.Area getCrossSection(Amount<Length> regression){\r
Amount<Length> zero = Amount.valueOf(0, SI.MILLIMETER);\r
if ( regression.isLessThan(zero) )\r
\r
\r
public void setOuterSurfaceInhibited(boolean outerSurfaceInhibited) throws PropertyVetoException {\r
- fireVetoableChange("outerSurfaceInhibited", this.outerSurfaceInhibited, outerSurfaceInhibited);\r
- boolean old = this.outerSurfaceInhibited;\r
this.outerSurfaceInhibited = outerSurfaceInhibited;\r
- firePropertyChange("outerSurfaceInhibited", old, outerSurfaceInhibited);\r
}\r
\r
\r
\r
\r
public void setInnerSurfaceInhibited(boolean innerSurfaceInhibited) throws PropertyVetoException {\r
- fireVetoableChange("innerSurfaceInhibited", this.innerSurfaceInhibited, innerSurfaceInhibited);\r
- boolean old = this.innerSurfaceInhibited;\r
this.innerSurfaceInhibited = innerSurfaceInhibited;\r
- firePropertyChange("innerSurfaceInhibited", old, innerSurfaceInhibited);\r
}\r
\r
public static void main(String args[]) throws Exception {\r
CoredCylindricalGrain e = DEFAULT_GRAIN;\r
- new Editor(e).show();\r
- new GrainPanel(e).show();\r
+ new Editor(e).showAsWindow();\r
+ new GrainPanel(e).showAsWindow();\r
}\r
\r
}\r