[bugfix] fixed minor initialization bug
This commit is contained in:
parent
12cda5b722
commit
a32b303069
@ -2,13 +2,13 @@ package net.sf.openrocket.aerodynamics;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.util.Coordinate;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* An abstract aerodynamic calculator implementation, that offers basic implementation
|
||||
@ -93,9 +93,18 @@ public abstract class AbstractAerodynamicCalculator implements AerodynamicCalcul
|
||||
protected final void checkCache(FlightConfiguration configuration) {
|
||||
if (rocketAeroModID != configuration.getRocket().getAerodynamicModID() ||
|
||||
rocketTreeModID != configuration.getRocket().getTreeModID()) {
|
||||
// // vvvv DEVEL vvvv
|
||||
// log.debug("Voiding the aerodynamic cache");
|
||||
// System.err.println(" >> Voiding Aero Cache... because modIDs changed...");
|
||||
// StackTraceElement[] els = Thread.currentThread().getStackTrace();
|
||||
// final int depth=12;
|
||||
// for(int i=1; i< depth; i++){
|
||||
// System.err.println(" "+els[i]);
|
||||
// }
|
||||
// // ^^^^ DEVEL ^^^^
|
||||
|
||||
rocketAeroModID = configuration.getRocket().getAerodynamicModID();
|
||||
rocketTreeModID = configuration.getRocket().getTreeModID();
|
||||
log.debug("Voiding the aerodynamic cache");
|
||||
voidAerodynamicCache();
|
||||
}
|
||||
}
|
||||
|
@ -718,8 +718,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
||||
protected void voidAerodynamicCache() {
|
||||
super.voidAerodynamicCache();
|
||||
|
||||
// System.err.println("> Voiding Calc Map.");
|
||||
|
||||
calcMap = null;
|
||||
cacheDiameter = -1;
|
||||
cacheLength = -1;
|
||||
|
@ -24,7 +24,7 @@ public class ComponentChangeEvent extends EventObject {
|
||||
this.value = _val;
|
||||
}
|
||||
|
||||
public boolean has( final int testValue ){
|
||||
public boolean matches( final int testValue ){
|
||||
return (0 != (this.value & testValue ));
|
||||
}
|
||||
|
||||
@ -37,7 +37,8 @@ public class ComponentChangeEvent extends EventObject {
|
||||
/** A change that affects the aerodynamic properties of the rocket */
|
||||
public static final int AERODYNAMIC_CHANGE = TYPE.AERODYNAMIC.value;
|
||||
/** A change that affects the mass and aerodynamic properties of the rocket */
|
||||
public static final int BOTH_CHANGE = TYPE.AERO_MASS.value; // Mass & Aerodynamic
|
||||
public static final int AEROMASS_CHANGE = TYPE.AERO_MASS.value; // Mass & Aerodynamic
|
||||
public static final int BOTH_CHANGE = AEROMASS_CHANGE; // syntactic sugar / backward compatibility
|
||||
|
||||
/** A change that affects the rocket tree structure */
|
||||
public static final int TREE_CHANGE = TYPE.TREE.value;
|
||||
@ -60,9 +61,6 @@ public class ComponentChangeEvent extends EventObject {
|
||||
|
||||
public ComponentChangeEvent(RocketComponent component, final int type) {
|
||||
super(component);
|
||||
if (0 > type ) {
|
||||
throw new IllegalArgumentException("bad event type provided");
|
||||
}
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@ -85,37 +83,37 @@ public class ComponentChangeEvent extends EventObject {
|
||||
}
|
||||
|
||||
public boolean isAerodynamicChange() {
|
||||
return TYPE.AERODYNAMIC.has( this.type);
|
||||
return TYPE.AERODYNAMIC.matches( this.type);
|
||||
}
|
||||
|
||||
|
||||
public boolean isEventChange() {
|
||||
return TYPE.EVENT.has( this.type);
|
||||
return TYPE.EVENT.matches( this.type);
|
||||
}
|
||||
|
||||
public boolean isFunctionalChange() {
|
||||
return ! (TYPE.NON_FUNCTIONAL.has( this.type));
|
||||
return ! (TYPE.NON_FUNCTIONAL.matches( this.type));
|
||||
}
|
||||
|
||||
public boolean isMassChange() {
|
||||
return TYPE.MASS.has(this.type);
|
||||
return TYPE.MASS.matches(this.type);
|
||||
}
|
||||
|
||||
public boolean isTextureChange() {
|
||||
return TYPE.TEXTURE.has(this.type);
|
||||
return TYPE.TEXTURE.matches(this.type);
|
||||
}
|
||||
|
||||
public boolean isTreeChange() {
|
||||
return TYPE.TREE.has(this.type);
|
||||
return TYPE.TREE.matches(this.type);
|
||||
}
|
||||
|
||||
public boolean isUndoChange() {
|
||||
return TYPE.UNDO.has(this.type);
|
||||
return TYPE.UNDO.matches(this.type);
|
||||
}
|
||||
|
||||
|
||||
public boolean isMotorChange() {
|
||||
return TYPE.MASS.has(this.type);
|
||||
return TYPE.MASS.matches(this.type);
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
|
@ -1,13 +1,11 @@
|
||||
package net.sf.openrocket.rocketcomponent;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EventObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -68,12 +68,12 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
|
||||
this.setTotalHeight( ht);
|
||||
}
|
||||
|
||||
public RailButton( final double od, final double id, final double ht, final double _thickness, final double _standoff ) {
|
||||
public RailButton( final double od, final double id, final double ht, final double flangeThickness, final double _standoff ) {
|
||||
super(Position.MIDDLE);
|
||||
this.outerDiameter_m = od;
|
||||
this.totalHeight_m = ht;
|
||||
this.innerDiameter_m = id;
|
||||
this.flangeHeight_m = _thickness;
|
||||
this.flangeHeight_m = flangeThickness;
|
||||
this.setStandoff( _standoff);
|
||||
this.setInstanceSeparation( od*2);
|
||||
}
|
||||
@ -186,14 +186,14 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
|
||||
if (MathUtil.equals(this.angle_rad, clamped_rad))
|
||||
return;
|
||||
this.angle_rad = clamped_rad;
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRelativePosition(RocketComponent.Position position) {
|
||||
super.setRelativePosition(position);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
@ -221,7 +221,7 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
|
||||
|
||||
@Override
|
||||
public Type getPresetType() {
|
||||
return ComponentPreset.Type.LAUNCH_LUG;
|
||||
return ComponentPreset.Type.RAIL_BUTTON;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -258,7 +258,7 @@ public class RailButton extends ExternalComponent implements LineInstanceable {
|
||||
@Override
|
||||
public void setInstanceSeparation(final double _separation){
|
||||
this.instanceSeparation = _separation;
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user