diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index 9241c0ebe..e1e911912 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -40,7 +40,7 @@ public class FlightConfiguration implements FlightConfigurableParameter the parameter type - */ -public class FlightConfigurationSet extends FlightConfigurableParameterSet { - - /** - * Construct a FlightConfiguration that has no overrides. - * - * @param component the rocket component on which events are fired when the parameter values are changed - * @param eventType the event type that will be fired on changes - */ - public FlightConfigurationSet( RocketComponent component, int eventType, FlightConfiguration _defaultValue) { - super( component, eventType, _defaultValue); - } - - - /** - * Construct a copy of an existing FlightConfigurationSet - * - * @param component the rocket component on which events are fired when the parameter values are changed - * @param eventType the event type that will be fired on changes - */ - public FlightConfigurationSet(FlightConfigurationSet configSet, RocketComponent component, int eventType) { - super( configSet, component, eventType ); - } - - - -} diff --git a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java index d4ffc9b89..87d96dd7d 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java @@ -67,7 +67,7 @@ public class Rocket extends RocketComponent { // Flight configuration list - private FlightConfigurationSet configSet; + private FlightConfigurableParameterSet configSet; // Does the rocket have a perfect finish (a notable amount of laminar flow) private boolean perfectFinish = false; @@ -85,7 +85,7 @@ public class Rocket extends RocketComponent { functionalModID = modID; FlightConfiguration defaultConfiguration = new FlightConfiguration( this, null); - this.configSet = new FlightConfigurationSet(this, ComponentChangeEvent.CONFIG_CHANGE, defaultConfiguration); + this.configSet = new FlightConfigurableParameterSet(this, ComponentChangeEvent.CONFIG_CHANGE, defaultConfiguration); } public String getDesigner() { @@ -301,7 +301,7 @@ public class Rocket extends RocketComponent { @Override public Rocket copyWithOriginalID() { Rocket copy = (Rocket) super.copyWithOriginalID(); - copy.configSet = new FlightConfigurationSet( + copy.configSet = new FlightConfigurableParameterSet( this.configSet, copy, ComponentChangeEvent.CONFIG_CHANGE); copy.resetListeners(); @@ -339,7 +339,7 @@ public class Rocket extends RocketComponent { this.refType = r.refType; this.customReferenceLength = r.customReferenceLength; - this.configSet = new FlightConfigurationSet( r.configSet, this, ComponentChangeEvent.CONFIG_CHANGE); + this.configSet = new FlightConfigurableParameterSet( r.configSet, this, ComponentChangeEvent.CONFIG_CHANGE); this.perfectFinish = r.perfectFinish; this.checkComponentStructure(); diff --git a/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java b/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java index 5fa2d5f48..428bfb341 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java +++ b/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java @@ -1247,21 +1247,21 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab * * @return Sum of the lengths. */ - private final double getTotalLength() { - checkState(); - this.checkComponentStructure(); - mutex.lock("getTotalLength"); - try { - double l = 0; - if (relativePosition == Position.AFTER) - l = length; - for (int i = 0; i < children.size(); i++) - l += children.get(i).getTotalLength(); - return l; - } finally { - mutex.unlock("getTotalLength"); - } - } +// private final double getTotalLength() { +// checkState(); +// this.checkComponentStructure(); +// mutex.lock("getTotalLength"); +// try { +// double l = 0; +// if (relativePosition == Position.AFTER) +// l = length; +// for (int i = 0; i < children.size(); i++) +// l += children.get(i).getTotalLength(); +// return l; +// } finally { +// mutex.unlock("getTotalLength"); +// } +// } /////////// Total mass and CG calculation //////////// diff --git a/core/test/net/sf/openrocket/rocketcomponent/ParameterSetTest.java b/core/test/net/sf/openrocket/rocketcomponent/ParameterSetTest.java new file mode 100644 index 000000000..918ae7722 --- /dev/null +++ b/core/test/net/sf/openrocket/rocketcomponent/ParameterSetTest.java @@ -0,0 +1,47 @@ +package net.sf.openrocket.rocketcomponent; + +//import static org.hamcrest.CoreMatchers.equalTo; +//import static org.junit.Assert.assertEquals; +//import static org.junit.Assert.assertThat; +//import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import net.sf.openrocket.util.MathUtil; +import net.sf.openrocket.util.StateChangeListener; +import net.sf.openrocket.util.BaseTestCase.BaseTestCase; + + +public class ParameterSetTest extends BaseTestCase { + + private final static double EPSILON = MathUtil.EPSILON*1E3; + + private class Parameter implements FlightConfigurableParameter { + + public Parameter(){} + + @Override + public Parameter clone(){ return null; } + + @Override + public void update(){} + + @Override + public void addChangeListener(StateChangeListener listener){} + + @Override + public void removeChangeListener(StateChangeListener listener){} + + }; + + + @Test + public void testEmptyRocket() { + //FlightConfigurableParameterSet testSet = new FlightConfigurableParameterSet(); + + + } + + + +}