cleaned up FlightConfiguration naming code
This commit is contained in:
parent
96f2cc048b
commit
0ab8dde5fb
@ -29,10 +29,9 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
private static final Logger log = LoggerFactory.getLogger(FlightConfiguration.class);
|
private static final Logger log = LoggerFactory.getLogger(FlightConfiguration.class);
|
||||||
|
|
||||||
public final static String DEFAULT_CONFIGURATION_NAME = "Default Configuration";
|
public final static String DEFAULT_CONFIGURATION_NAME = "Default Configuration";
|
||||||
public final static String NO_MOTORS_TEXT = "(No Motors Defined)";
|
public final static String NO_MOTORS_TEXT = "[No Motors Defined]";
|
||||||
|
|
||||||
protected boolean isNamed = false;
|
protected String configurationName=null;
|
||||||
protected String configurationName;
|
|
||||||
|
|
||||||
protected final Rocket rocket;
|
protected final Rocket rocket;
|
||||||
protected final FlightConfigurationId fcid;
|
protected final FlightConfigurationId fcid;
|
||||||
@ -88,8 +87,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
this.fcid = _fcid;
|
this.fcid = _fcid;
|
||||||
}
|
}
|
||||||
this.rocket = rocket;
|
this.rocket = rocket;
|
||||||
this.isNamed = false;
|
this.configurationName = null;
|
||||||
this.configurationName = "<WARN: attempt to access unset configurationName. WARN!> ";
|
|
||||||
this.instanceNumber = instanceCount++;
|
this.instanceNumber = instanceCount++;
|
||||||
|
|
||||||
updateStages();
|
updateStages();
|
||||||
@ -296,18 +294,14 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNameOverridden(){
|
public boolean isNameOverridden(){
|
||||||
return isNamed;
|
return (null != this.configurationName );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
if( isNamed ){
|
if( null == configurationName){
|
||||||
return configurationName;
|
return this.getOneLineMotorDescription();
|
||||||
}else{
|
}else{
|
||||||
if( this.hasMotors()){
|
return configurationName;
|
||||||
return this.getOneLineMotorDescription();
|
|
||||||
}else{
|
|
||||||
return NO_MOTORS_TEXT ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +327,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( 0 == activeMotorCount ){
|
if( 0 == activeMotorCount ){
|
||||||
buff.append(" n/a ");
|
return NO_MOTORS_TEXT;
|
||||||
}
|
}
|
||||||
buff.append("]");
|
buff.append("]");
|
||||||
return buff.toString();
|
return buff.toString();
|
||||||
@ -491,14 +485,13 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
|
|
||||||
public void setName( final String newName) {
|
public void setName( final String newName) {
|
||||||
if(( null == newName ) ||( "".equals(newName))){
|
if(( null == newName ) ||( "".equals(newName))){
|
||||||
this.isNamed= false;
|
this.configurationName = null;
|
||||||
return;
|
return;
|
||||||
}else if( ! this.getFlightConfigurationID().isValid()){
|
}else if( ! this.getFlightConfigurationID().isValid()){
|
||||||
return;
|
return;
|
||||||
}else if( newName.equals(this.configurationName)){
|
}else if( newName.equals(this.configurationName)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isNamed = true;
|
|
||||||
this.configurationName = newName;
|
this.configurationName = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user