Add unique identifier for stages
This commit is contained in:
parent
ac03049277
commit
9cb57ae9c8
@ -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<StageSeparationConfiguration> 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<StageSeparationConfiguration>( 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<StageSeparationConfiguration>(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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user