Remove some now-unused Exception classes: MotorIgnitionException and SimulationLaunchException.
This commit is contained in:
parent
a36e7f1049
commit
1115212317
@ -9,11 +9,9 @@ import net.sf.openrocket.document.Simulation;
|
||||
import net.sf.openrocket.optimization.general.OptimizationException;
|
||||
import net.sf.openrocket.optimization.rocketoptimization.OptimizableParameter;
|
||||
import net.sf.openrocket.simulation.FlightData;
|
||||
import net.sf.openrocket.simulation.exception.MotorIgnitionException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationCalculationException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationCancelledException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationLaunchException;
|
||||
import net.sf.openrocket.simulation.listeners.SimulationListener;
|
||||
import net.sf.openrocket.simulation.listeners.system.InterruptListener;
|
||||
|
||||
@ -40,12 +38,6 @@ public abstract class SimulationBasedParameter implements OptimizableParameter {
|
||||
double value = getResultValue(simulation.getSimulatedData());
|
||||
log.debug("Parameter '" + getName() + " was " + value);
|
||||
return value;
|
||||
} catch (MotorIgnitionException e) {
|
||||
// A problem with motor ignition will cause optimization to fail
|
||||
throw new OptimizationException(e);
|
||||
} catch (SimulationLaunchException e) {
|
||||
// Other launch exceptions result in illegal value
|
||||
return Double.NaN;
|
||||
} catch (SimulationCalculationException e) {
|
||||
// Calculation errors result in illegal value
|
||||
return Double.NaN;
|
||||
|
@ -21,9 +21,8 @@ import net.sf.openrocket.rocketcomponent.MotorMount;
|
||||
import net.sf.openrocket.rocketcomponent.RecoveryDevice;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.StageSeparationConfiguration;
|
||||
import net.sf.openrocket.simulation.exception.MotorIgnitionException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationCalculationException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationLaunchException;
|
||||
import net.sf.openrocket.simulation.listeners.SimulationListenerHelper;
|
||||
import net.sf.openrocket.simulation.listeners.system.OptimumCoastListener;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
@ -709,7 +708,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
||||
" rocketOrientationQuaternion=" + currentStatus.getRocketOrientationQuaternion() +
|
||||
" rocketRotationVelocity=" + currentStatus.getRocketRotationVelocity() +
|
||||
" effectiveLaunchRodLength=" + currentStatus.getEffectiveLaunchRodLength());
|
||||
throw new SimulationException(trans.get("BasicEventSimulationEngine.error.NaNResult"));
|
||||
throw new SimulationCalculationException(trans.get("BasicEventSimulationEngine.error.NaNResult"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
package net.sf.openrocket.simulation.exception;
|
||||
|
||||
/**
|
||||
* An exception signifying that the simulation failed because no motors were
|
||||
* defined or ignited in the rocket.
|
||||
*
|
||||
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
||||
*/
|
||||
public class MotorIgnitionException extends SimulationLaunchException {
|
||||
|
||||
public MotorIgnitionException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public MotorIgnitionException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package net.sf.openrocket.simulation.exception;
|
||||
|
||||
/**
|
||||
* An exception signifying that a problem occurred at launch, for example
|
||||
* that no motors were defined or no motors ignited.
|
||||
*
|
||||
* @author Sampo Niskanen <sampo.niskanen@iki.fi>
|
||||
*/
|
||||
public class SimulationLaunchException extends SimulationException {
|
||||
|
||||
public SimulationLaunchException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public SimulationLaunchException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,6 @@ import net.sf.openrocket.document.Simulation;
|
||||
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
||||
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
|
||||
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||
import net.sf.openrocket.simulation.exception.MotorIgnitionException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationException;
|
||||
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
|
||||
import net.sf.openrocket.util.TestRockets;
|
||||
@ -34,6 +33,7 @@ public class DisableStageTest extends BaseTestCase {
|
||||
simDisabled.getOptions().setTimeStep(0.05);
|
||||
|
||||
// Since there are no stages, the simulation should throw an exception.
|
||||
// Needs fixing for SimulationAbort
|
||||
try {
|
||||
simDisabled.simulate();
|
||||
} catch (SimulationException e) {
|
||||
|
@ -45,7 +45,6 @@ import net.sf.openrocket.simulation.customexpression.CustomExpression;
|
||||
import net.sf.openrocket.simulation.customexpression.CustomExpressionSimulationListener;
|
||||
import net.sf.openrocket.simulation.exception.SimulationCancelledException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationException;
|
||||
import net.sf.openrocket.simulation.exception.SimulationLaunchException;
|
||||
import net.sf.openrocket.simulation.listeners.AbstractSimulationListener;
|
||||
import net.sf.openrocket.simulation.listeners.SimulationListener;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
@ -425,15 +424,7 @@ public class SimulationRunDialog extends JDialog {
|
||||
}
|
||||
|
||||
// Analyze the exception type
|
||||
if (t instanceof SimulationLaunchException) {
|
||||
|
||||
DetailDialog.showDetailedMessageDialog(SimulationRunDialog.this,
|
||||
new Object[] {
|
||||
//// Unable to simulate:
|
||||
trans.get("SimuRunDlg.msg.Unabletosim"), t.getMessage() },
|
||||
null, simulation.getName(), JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
} else if (t instanceof SimulationException) {
|
||||
if (t instanceof SimulationException) {
|
||||
String title = simulation.getName();
|
||||
FlightDataBranch dataBranch = ((SimulationException) t).getFlightDataBranch();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user