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);
}
},
//// 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;
},
;
-
+
+ private static final Translator trans = Application.getTranslator();
private final String description;
IgnitionEvent(String description) {
@Override
public String toString() {
- return description;
+ return trans.get(description);
}
};
* @param motor the motor, or <code>null</code>.
*/
public void setMotor(String id, Motor motor);
-
+
/**
* Get the number of similar motors clustered.
*
public int getMotorCount();
-
+
/**
* Return the ejection charge delay of given motor configuration.
* A "plugged" motor without an ejection charge is given by
public void setMotorOverhang(double overhang);
-
+
/**
* Return the inner diameter of the motor mount.
*