X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fnet%2Fsf%2Fopenrocket%2Frocketcomponent%2FMotorMount.java;h=1c849d4d2a96a682269119216a4af61b51cd755d;hb=da7a9ff299f7b1529f8ff9cba08e4be3f369937c;hp=15ea70f85322935a2e1eb31f051e3686ebe6c37b;hpb=c3014ac8d2eddb3a12c8df0570a3b42ac82db4b1;p=debian%2Fopenrocket diff --git a/src/net/sf/openrocket/rocketcomponent/MotorMount.java b/src/net/sf/openrocket/rocketcomponent/MotorMount.java index 15ea70f8..1c849d4d 100644 --- a/src/net/sf/openrocket/rocketcomponent/MotorMount.java +++ b/src/net/sf/openrocket/rocketcomponent/MotorMount.java @@ -8,17 +8,16 @@ import net.sf.openrocket.util.ChangeSource; import net.sf.openrocket.util.Coordinate; public interface MotorMount extends ChangeSource { - static final Translator trans = Application.getTranslator(); - + public static enum IgnitionEvent { //// Automatic (launch or ejection charge) - AUTOMATIC(trans.get("MotorMount.IgnitionEvent.AUTOMATIC")) { + AUTOMATIC("MotorMount.IgnitionEvent.AUTOMATIC") { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { int count = source.getRocket().getStageCount(); int stage = source.getStageNumber(); - if (stage == count-1) { + if (stage == count - 1) { return LAUNCH.isActivationEvent(e, source); } else { return EJECTION_CHARGE.isActivationEvent(e, source); @@ -26,38 +25,38 @@ public interface MotorMount extends ChangeSource { } }, //// Launch - LAUNCH(trans.get("MotorMount.IgnitionEvent.LAUNCH")) { + LAUNCH("MotorMount.IgnitionEvent.LAUNCH") { @Override - public boolean isActivationEvent(FlightEvent e, RocketComponent source) { + public boolean isActivationEvent(FlightEvent e, RocketComponent source) { return (e.getType() == FlightEvent.Type.LAUNCH); } }, //// First ejection charge of previous stage - EJECTION_CHARGE(trans.get("MotorMount.IgnitionEvent.EJECTION_CHARGE")) { + EJECTION_CHARGE("MotorMount.IgnitionEvent.EJECTION_CHARGE") { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { if (e.getType() != FlightEvent.Type.EJECTION_CHARGE) return false; - + int charge = e.getSource().getStageNumber(); int mount = source.getStageNumber(); - return (mount+1 == charge); + return (mount + 1 == charge); } }, //// First burnout of previous stage - BURNOUT(trans.get("MotorMount.IgnitionEvent.BURNOUT")) { + BURNOUT("MotorMount.IgnitionEvent.BURNOUT") { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { if (e.getType() != FlightEvent.Type.BURNOUT) return false; - + int charge = e.getSource().getStageNumber(); int mount = source.getStageNumber(); - return (mount+1 == charge); + return (mount + 1 == charge); } }, //// Never - NEVER(trans.get("MotorMount.IgnitionEvent.NEVER")) { + NEVER("MotorMount.IgnitionEvent.NEVER") { @Override public boolean isActivationEvent(FlightEvent e, RocketComponent source) { return false; @@ -65,7 +64,8 @@ public interface MotorMount extends ChangeSource { }, ; - + + private static final Translator trans = Application.getTranslator(); private final String description; IgnitionEvent(String description) { @@ -76,7 +76,7 @@ public interface MotorMount extends ChangeSource { @Override public String toString() { - return description; + return trans.get(description); } }; @@ -113,7 +113,7 @@ public interface MotorMount extends ChangeSource { * @param motor the motor, or null. */ public void setMotor(String id, Motor motor); - + /** * Get the number of similar motors clustered. * @@ -125,7 +125,7 @@ public interface MotorMount extends ChangeSource { public int getMotorCount(); - + /** * Return the ejection charge delay of given motor configuration. * A "plugged" motor without an ejection charge is given by @@ -192,7 +192,7 @@ public interface MotorMount extends ChangeSource { public void setMotorOverhang(double overhang); - + /** * Return the inner diameter of the motor mount. *