Cleanup configuration as component change listener.

This commit is contained in:
Doug Pedrick 2012-09-25 03:24:22 +00:00
parent 9ce96bdc05
commit d48a2cb400
4 changed files with 287 additions and 282 deletions

View File

@ -303,11 +303,13 @@ public class Simulation implements ChangeSource, Cloneable {
// Set simulated info after simulation, will not be set in case of exception // Set simulated info after simulation, will not be set in case of exception
simulatedConditions = options.clone(); simulatedConditions = options.clone();
simulatedMotors = getConfiguration().getMotorConfigurationDescription(); final Configuration configuration = getConfiguration();
simulatedMotors = configuration.getMotorConfigurationDescription();
simulatedRocketID = rocket.getFunctionalModID(); simulatedRocketID = rocket.getFunctionalModID();
status = Status.UPTODATE; status = Status.UPTODATE;
fireChangeEvent(); fireChangeEvent();
configuration.release();
} finally { } finally {
mutex.unlock("simulate"); mutex.unlock("simulate");
} }

View File

@ -94,8 +94,10 @@ public class RocksimSaver extends RocketSaver {
MassCalculator massCalc = new BasicMassCalculator(); MassCalculator massCalc = new BasicMassCalculator();
final double cg = massCalc.getCG(new Configuration(rocket), MassCalculator.MassCalcType.NO_MOTORS).x * final Configuration configuration = new Configuration(rocket);
final double cg = massCalc.getCG(configuration, MassCalculator.MassCalcType.NO_MOTORS).x *
RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH; RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH;
configuration.release();
int stageCount = rocket.getStageCount(); int stageCount = rocket.getStageCount();
if (stageCount == 3) { if (stageCount == 3) {
result.setStage321CG(cg); result.setStage321CG(cg);

View File

@ -419,6 +419,7 @@ public class DesignReport {
c.setBorder(PdfPCell.LEFT); c.setBorder(PdfPCell.LEFT);
c.setBorderWidthTop(0f); c.setBorderWidthTop(0f);
parent.addCell(c); parent.addCell(c);
config.release();
} }

View File

@ -169,6 +169,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
log.info("Warnings at the end of simulation: " + flightData.getWarningSet()); log.info("Warnings at the end of simulation: " + flightData.getWarningSet());
} }
configuration.release();
// TODO: HIGH: Simulate branches // TODO: HIGH: Simulate branches
return flightData; return flightData;
} }
@ -534,7 +535,6 @@ public class BasicEventSimulationEngine implements SimulationEngine {
* This method jumps the simulation time forward in case no motors have been ignited. * This method jumps the simulation time forward in case no motors have been ignited.
* The flight event is removed from the event queue. * The flight event is removed from the event queue.
* *
* @param status the simulation status
* @return the flight event to handle, or null * @return the flight event to handle, or null
*/ */
private FlightEvent nextEvent() { private FlightEvent nextEvent() {