diff --git a/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java b/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java index 8e0f533c5..40725d608 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java +++ b/core/src/net/sf/openrocket/rocketcomponent/AxialStage.java @@ -1,8 +1,5 @@ package net.sf.openrocket.rocketcomponent; -import java.util.ArrayList; -import java.util.Collection; - import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.rocketcomponent.position.AxialMethod; import net.sf.openrocket.startup.Application; @@ -11,12 +8,12 @@ import net.sf.openrocket.util.Coordinate; public class AxialStage extends ComponentAssembly implements FlightConfigurableComponent { private static final Translator trans = Application.getTranslator(); - //private static final Logger log = LoggerFactory.getLogger(AxialStage.class); - + /** list of separations to be happening*/ protected FlightConfigurableParameterSet separations; /** number of stages */ protected int stageNumber; + private FlightConfigurationId stageId; /** * default constructor, builds a rocket with zero stages @@ -25,6 +22,7 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC this.separations = new FlightConfigurableParameterSet( new StageSeparationConfiguration()); this.axialMethod = AxialMethod.AFTER; this.stageNumber = 0; + this.stageId = new FlightConfigurationId(); } /** @@ -94,9 +92,13 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC protected RocketComponent copyWithOriginalID() { AxialStage copy = (AxialStage) super.copyWithOriginalID(); copy.separations = new FlightConfigurableParameterSet(separations); + copy.stageId = new FlightConfigurationId(); return copy; } + public FlightConfigurationId getStageId() { + return stageId; + } /** * Stages may be positioned relative to other stages. In that case, this will set the stage number diff --git a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java index 0b85db63d..8f0a632ff 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java @@ -198,6 +198,15 @@ public class Rocket extends ComponentAssembly { return this.stageMap.get( stageNumber); } + public AxialStage getStage(final FlightConfigurationId stageId) { + for (AxialStage stage : getStageList()) { + if (stage.getStageId().equals(stageId)) { + return stage; + } + } + return null; + } + /** * Get the topmost stage, only taking into account active stages from the flight configuration. * @param config flight configuration dictating which stages are active