[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,21 +549,14 @@ 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() {
|
public boolean hasRecoveryDevice() {
|
||||||
Rocket rkt = this.getRocket();
|
if (fcid.hasError()) {
|
||||||
RocketComponent nextComponent = rkt.getNextComponent();
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
while(nextComponent != null) {
|
return this.getRocket().hasRecoveryDevice();
|
||||||
if(nextComponent instanceof RecoveryDevice) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
nextComponent = nextComponent.getNextComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////// Helper methods ///////////////
|
/////////////// 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 ////////////
|
////////////// Methods that may not be overridden ////////////
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user