[1373] PR review fixes
Move hasRecoveryDevice to RocketComponent and reimplement FlightConfiguration version to check for FlightConfiguration errors.
This commit is contained in:
parent
f5cc1f61bf
commit
6c475645d4
@ -549,23 +549,16 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if a rocket has a configured Recovery Device
|
||||
* Return true if rocket has a RecoveryDevice
|
||||
*/
|
||||
public boolean hasRecoveryDevice() {
|
||||
Rocket rkt = this.getRocket();
|
||||
RocketComponent nextComponent = rkt.getNextComponent();
|
||||
|
||||
while(nextComponent != null) {
|
||||
if(nextComponent instanceof RecoveryDevice) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nextComponent = nextComponent.getNextComponent();
|
||||
}
|
||||
|
||||
if (fcid.hasError()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.getRocket().hasRecoveryDevice();
|
||||
}
|
||||
|
||||
/////////////// Helper methods ///////////////
|
||||
|
||||
/**
|
||||
|
@ -427,6 +427,19 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if any of this component's children are a RecoveryDevice
|
||||
*/
|
||||
public boolean hasRecoveryDevice() {
|
||||
Iterator<RocketComponent> iterator = this.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
RocketComponent child = iterator.next();
|
||||
if (child instanceof RecoveryDevice) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////// Methods that may not be overridden ////////////
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user