true
if children can be attached to this component, false
otherwise.
*/
public abstract boolean allowsChildren();
-
+
/**
* Test whether the given component type can be added to this component. This type safety
* is enforced by the addChild()
methods. The return value of this method
@@ -207,8 +207,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
* @return Whether such a component can be added.
*/
public abstract boolean isCompatible(Class extends RocketComponent> type);
-
-
+
+
/* Non-abstract helper method */
/**
* Test whether the given component can be added to this component. This is equivalent
@@ -222,9 +222,9 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return isCompatible(c.getClass());
}
-
-
-
+
+
+
/**
* Return a collection of bounding coordinates. The coordinates must be such that
* the component is fully enclosed in their convex hull.
@@ -232,24 +232,24 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
* @return a collection of coordinates that bound the component.
*/
public abstract Collectionnull
* to use the default color.
@@ -411,7 +411,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return color;
}
-
+
/**
* Set the color of the object to use in 2D figures.
*/
@@ -419,18 +419,18 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
if ((color == null && c == null) ||
(color != null && color.equals(c)))
return;
-
+
checkState();
this.color = c;
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
}
-
-
+
+
public final LineStyle getLineStyle() {
mutex.verify();
return lineStyle;
}
-
+
public final void setLineStyle(LineStyle style) {
if (this.lineStyle == style)
return;
@@ -438,10 +438,10 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
this.lineStyle = style;
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
}
-
-
-
-
+
+
+
+
/**
* Get the current override mass. The mass is not necessarily in use
* at the moment.
@@ -452,7 +452,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return overrideMass;
}
-
+
/**
* Set the current override mass. The mass is not set to use by this
* method.
@@ -467,7 +467,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
if (massOverriden)
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
}
-
+
/**
* Return whether mass override is active for this component. This does NOT
* take into account whether a parent component is overriding the mass.
@@ -478,7 +478,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return massOverriden;
}
-
+
/**
* Set whether the mass is currently overridden.
*
@@ -492,11 +492,11 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
massOverriden = o;
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
}
-
-
-
-
-
+
+
+
+
+
/**
* Return the current override CG. The CG is not necessarily overridden.
*
@@ -506,7 +506,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return getComponentCG().setX(overrideCGX);
}
-
+
/**
* Return the x-coordinate of the current override CG.
*
@@ -516,7 +516,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return overrideCGX;
}
-
+
/**
* Set the current override CG to (x,0,0).
*
@@ -532,7 +532,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
else
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
}
-
+
/**
* Return whether the CG is currently overridden.
*
@@ -542,7 +542,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return cgOverriden;
}
-
+
/**
* Set whether the CG is currently overridden.
*
@@ -556,9 +556,9 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
cgOverriden = o;
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
}
-
-
-
+
+
+
/**
* Return whether the mass and/or CG override overrides all subcomponent values
* as well. The default implementation is a normal getter/setter implementation,
@@ -573,8 +573,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return overrideSubcomponents;
}
-
-
+
+
/**
* Set whether the mass and/or CG override overrides all subcomponent values
* as well. See {@link #getOverrideSubcomponents()} for details.
@@ -589,7 +589,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
overrideSubcomponents = override;
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
}
-
+
/**
* Return whether the option to override all subcomponents is enabled or not.
* The default implementation returns false
if neither mass nor
@@ -604,10 +604,10 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return isCGOverridden() || isMassOverridden();
}
-
-
-
-
+
+
+
+
/**
* Get the user-defined name of the component.
*/
@@ -615,7 +615,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return name;
}
-
+
/**
* Set the user-defined name of the component. If name==null, sets the name to
* the default name, currently the component name.
@@ -631,8 +631,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
this.name = name;
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
}
-
-
+
+
/**
* Return the comment of the component. The component may contain multiple lines
* using \n as a newline separator.
@@ -643,7 +643,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return comment;
}
-
+
/**
* Set the comment of the component.
*
@@ -659,9 +659,9 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
this.comment = comment;
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
}
-
-
-
+
+
+
/**
* Return the preset component that this component is based upon.
*
@@ -670,7 +670,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
public final ComponentPreset getPresetComponent() {
return presetComponent;
}
-
+
/**
* Return the most compatible preset type for this component.
* This method should be overridden by components which have presets
@@ -680,7 +680,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
public ComponentPreset.Type getPresetType() {
return null;
}
-
+
/**
* Set the preset component this component is based upon and load all of the
* preset values.
@@ -691,12 +691,12 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
if (presetComponent == preset) {
return;
}
-
+
if (preset == null) {
clearPreset();
return;
}
-
+
// TODO - do we need to this compatibility check?
/*
if (preset.getComponentClass() != this.getClass()) {
@@ -704,7 +704,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
+ " into component of type " + this.getClass());
}
*/
-
+
RocketComponent root = getRoot();
final Rocket rocket;
if (root instanceof Rocket) {
@@ -712,25 +712,25 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
} else {
rocket = null;
}
-
+
try {
if (rocket != null) {
rocket.freeze();
}
-
+
loadFromPreset(preset);
-
+
this.presetComponent = preset;
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
-
+
} finally {
if (rocket != null) {
rocket.thaw();
}
}
}
-
-
+
+
/**
* Load component properties from the specified preset. The preset is guaranteed
* to be of the correct type.
@@ -744,12 +744,12 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
* @param preset the preset to load from
*/
protected void loadFromPreset(ComponentPreset preset) {
- if ( preset.has(ComponentPreset.LENGTH) ) {
+ if (preset.has(ComponentPreset.LENGTH)) {
this.length = preset.get(ComponentPreset.LENGTH);
}
}
-
-
+
+
/**
* Clear the current component preset. This does not affect the component properties
* otherwise.
@@ -760,9 +760,9 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
presetComponent = null;
fireComponentChangeEvent(ComponentChangeEvent.NONFUNCTIONAL_CHANGE);
}
-
-
-
+
+
+
/**
* Returns the unique ID of the component.
*
@@ -771,7 +771,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
public final String getID() {
return id;
}
-
+
/**
* Generate a new ID for this component.
*/
@@ -779,10 +779,10 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
this.id = UniqueID.uuid();
}
-
-
-
-
+
+
+
+
/**
* Get the characteristic length of the component, for example the length of a body tube
* of the length of the root chord of a fin. This is used in positioning the component
@@ -795,7 +795,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return length;
}
-
+
/**
* Get the positioning of the component relative to its parent component.
* This is one of the enums of {@link Position}. A setter method is not provided,
@@ -805,8 +805,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return relativePosition;
}
-
-
+
+
/**
* Set the positioning of the component relative to its parent component.
* The actual position of the component is maintained to the best ability.
@@ -822,38 +822,38 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
if (this.relativePosition == position)
return;
checkState();
-
+
// Update position so as not to move the component
if (this.parent != null) {
double thisPos = this.toRelative(Coordinate.NUL, this.parent)[0].x;
-
+
switch (position) {
case ABSOLUTE:
this.position = this.toAbsolute(Coordinate.NUL)[0].x;
break;
-
+
case TOP:
this.position = thisPos;
break;
-
+
case MIDDLE:
this.position = thisPos - (this.parent.length - this.length) / 2;
break;
-
+
case BOTTOM:
this.position = thisPos - (this.parent.length - this.length);
break;
-
+
default:
throw new BugException("Unknown position type: " + position);
}
}
-
+
this.relativePosition = position;
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
-
-
+
+
/**
* Determine position relative to given position argument. Note: This is a side-effect free method. No state
* is modified.
@@ -867,7 +867,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
double result = this.position;
if (relativeTo != null) {
double thisPos = this.toRelative(Coordinate.NUL, relativeTo)[0].x;
-
+
switch (thePosition) {
case ABSOLUTE:
result = this.toAbsolute(Coordinate.NUL)[0].x;
@@ -887,7 +887,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
}
return result;
}
-
+
/**
* Get the position value of the component. The exact meaning of the value is
* dependent on the current relative positioning.
@@ -898,8 +898,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.verify();
return position;
}
-
-
+
+
/**
* Set the position value of the component. The exact meaning of the value
* depends on the current relative positioning.
@@ -917,11 +917,11 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
this.position = value;
}
-
-
-
+
+
+
/////////// Coordinate changes ///////////
-
+
/**
* Returns coordinate c in absolute coordinates. Equivalent to toComponent(c,null).
*/
@@ -929,8 +929,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
return toRelative(c, null);
}
-
-
+
+
/**
* Return coordinate c
described in the coordinate system of
* dest
. If dest
is null
returns
@@ -955,33 +955,33 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
RocketComponent search = dest;
Coordinate[] array = new Coordinate[1];
array[0] = c;
-
+
RocketComponent component = this;
while ((component != search) && (component.parent != null)) {
-
+
array = component.shiftCoordinates(array);
-
+
switch (component.relativePosition) {
case TOP:
for (int i = 0; i < array.length; i++) {
array[i] = array[i].add(component.position, 0, 0);
}
break;
-
+
case MIDDLE:
for (int i = 0; i < array.length; i++) {
array[i] = array[i].add(component.position +
(component.parent.length - component.length) / 2, 0, 0);
}
break;
-
+
case BOTTOM:
for (int i = 0; i < array.length; i++) {
array[i] = array[i].add(component.position +
(component.parent.length - component.length), 0, 0);
}
break;
-
+
case AFTER:
// Add length of all previous brother-components with POSITION_RELATIVE_AFTER
int index = component.parent.children.indexOf(component);
@@ -997,28 +997,28 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
array[i] = array[i].add(component.position + component.parent.length, 0, 0);
}
break;
-
+
case ABSOLUTE:
search = null; // Requires back-search if dest!=null
if (Double.isNaN(absoluteX)) {
absoluteX = component.position;
}
break;
-
+
default:
throw new BugException("Unknown relative positioning type of component" +
component + ": " + component.relativePosition);
}
-
+
component = component.parent; // parent != null
}
-
+
if (!Double.isNaN(absoluteX)) {
for (int i = 0; i < array.length; i++) {
array[i] = array[i].setX(absoluteX + c.x);
}
}
-
+
// Check whether destination has been found or whether to backtrack
// TODO: LOW: Backtracking into clustered components uses only one component
if ((dest != null) && (component != dest)) {
@@ -1027,14 +1027,14 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
array[i] = array[i].sub(origin[0]);
}
}
-
+
return array;
} finally {
mutex.unlock("toRelative");
}
}
-
-
+
+
/**
* Recursively sum the lengths of all subcomponents that have position
* Position.AFTER.
@@ -1056,11 +1056,11 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
mutex.unlock("getTotalLength");
}
}
-
-
-
+
+
+
/////////// Total mass and CG calculation ////////////
-
+
/**
* Return the (possibly overridden) mass of component.
*
@@ -1072,7 +1072,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
return overrideMass;
return getComponentMass();
}
-
+
/**
* Return the (possibly overridden) center of gravity and mass.
*
@@ -1085,14 +1085,14 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
if (cgOverriden)
return getOverrideCG().setWeight(getMass());
-
+
if (massOverriden)
return getComponentCG().setWeight(getMass());
-
+
return getComponentCG();
}
-
-
+
+
/**
* Return the longitudinal (around the y- or z-axis) moment of inertia of this component.
* The moment of inertia is scaled in reference to the (possibly overridden) mass
@@ -1104,7 +1104,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
return getLongitudinalUnitInertia() * getMass();
}
-
+
/**
* Return the rotational (around the y- or z-axis) moment of inertia of this component.
* The moment of inertia is scaled in reference to the (possibly overridden) mass
@@ -1116,12 +1116,12 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
return getRotationalUnitInertia() * getMass();
}
-
-
-
+
+
+
/////////// Children handling ///////////
-
-
+
+
/**
* Adds a child to the rocket component tree. The component is added to the end
* of the component's child list. This is a helper method that calls
@@ -1136,8 +1136,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
addChild(component, children.size());
}
-
-
+
+
/**
* Adds a child to the rocket component tree. The component is added to
* the given position of the component's child list.
@@ -1152,32 +1152,32 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
*/
public void addChild(RocketComponent component, int index) {
checkState();
-
+
if (component.parent != null) {
throw new IllegalArgumentException("component " + component.getComponentName() +
" is already in a tree");
}
-
+
// Ensure that the no loops are created in component tree [A -> X -> Y -> B, B.addChild(A)]
if (this.getRoot().equals(component)) {
throw new IllegalStateException("Component " + component.getComponentName() +
" is a parent of " + this.getComponentName() + ", attempting to create cycle in tree.");
}
-
+
if (!isCompatible(component)) {
throw new IllegalStateException("Component " + component.getComponentName() +
" not currently compatible with component " + getComponentName());
}
-
+
children.add(index, component);
component.parent = this;
-
+
this.checkComponentStructure();
component.checkComponentStructure();
-
+
fireAddRemoveEvent(component);
}
-
+
/**
* Removes a child from the rocket component tree.
*
@@ -1188,13 +1188,13 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
RocketComponent component = children.remove(n);
component.parent = null;
-
+
this.checkComponentStructure();
component.checkComponentStructure();
-
+
fireAddRemoveEvent(component);
}
-
+
/**
* Removes a child from the rocket component tree. Does nothing if the component
* is not present as a child.
@@ -1204,24 +1204,24 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
*/
public final boolean removeChild(RocketComponent component) {
checkState();
-
+
component.checkComponentStructure();
-
+
if (children.remove(component)) {
component.parent = null;
-
+
this.checkComponentStructure();
component.checkComponentStructure();
-
+
fireAddRemoveEvent(component);
return true;
}
return false;
}
-
-
-
-
+
+
+
+
/**
* Move a child to another position.
*
@@ -1233,15 +1233,15 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
if (children.remove(component)) {
children.add(index, component);
-
+
this.checkComponentStructure();
component.checkComponentStructure();
-
+
fireAddRemoveEvent(component);
}
}
-
-
+
+
/**
* Fires an AERODYNAMIC_CHANGE, MASS_CHANGE or OTHER_CHANGE event depending on the
* type of component removed.
@@ -1256,30 +1256,30 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
if (c.isMassive())
type |= ComponentChangeEvent.MASS_CHANGE;
}
-
+
fireComponentChangeEvent(type);
}
-
-
+
+
public final int getChildCount() {
checkState();
this.checkComponentStructure();
return children.size();
}
-
+
public final RocketComponent getChild(int n) {
checkState();
this.checkComponentStructure();
return children.get(n);
}
-
+
public final Listnull
if the component
* has no parent.
@@ -1303,7 +1303,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
return parent;
}
-
+
/**
* Get the root component of the component tree.
*
@@ -1316,7 +1316,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
gp = gp.parent;
return gp;
}
-
+
/**
* Returns the root Rocket component of this component tree. Throws an
* IllegalStateException if the root component is not a Rocket.
@@ -1332,8 +1332,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
throw new IllegalStateException("getRocket() called with root component "
+ r.getComponentName());
}
-
-
+
+
/**
* Return the Stage component that this component belongs to. Throws an
* IllegalStateException if a Stage is not in the parentage of this component.
@@ -1351,7 +1351,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
}
throw new IllegalStateException("getStage() called without Stage as a parent.");
}
-
+
/**
* Return the stage number of the stage this component belongs to. The stages
* are numbered from zero upwards.
@@ -1363,7 +1363,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
if (parent == null) {
throw new IllegalArgumentException("getStageNumber() called for root component");
}
-
+
RocketComponent stage = this;
while (!(stage instanceof Stage)) {
stage = stage.parent;
@@ -1374,8 +1374,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
}
return stage.parent.getChildPosition(stage);
}
-
-
+
+
/**
* Find a component with the given ID. The component tree is searched from this component
* down (including this component) for the ID and the corresponding component is returned,
@@ -1394,8 +1394,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
}
return null;
}
-
-
+
+
// TODO: Move these methods elsewhere (used only in SymmetricComponent)
public final RocketComponent getPreviousComponent() {
checkState();
@@ -1407,7 +1407,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
StringBuffer sb = new StringBuffer();
sb.append("Inconsistent internal state: ");
sb.append("this=").append(this).append('[')
- .append(System.identityHashCode(this)).append(']');
+ .append(System.identityHashCode(this)).append(']');
sb.append(" parent.children=[");
for (int i = 0; i < parent.children.size(); i++) {
RocketComponent c = parent.children.get(i);
@@ -1426,34 +1426,34 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
c = c.getChild(c.getChildCount() - 1);
return c;
}
-
+
// TODO: Move these methods elsewhere (used only in SymmetricComponent)
public final RocketComponent getNextComponent() {
checkState();
if (getChildCount() > 0)
return getChild(0);
-
+
RocketComponent current = this;
RocketComponent nextParent = this.parent;
-
+
while (nextParent != null) {
int pos = nextParent.getChildPosition(current);
if (pos < nextParent.getChildCount() - 1)
return nextParent.getChild(pos + 1);
-
+
current = nextParent;
nextParent = current.parent;
}
return null;
}
-
-
+
+
/////////// Event handling //////////
//
// Listener lists are provided by the root Rocket component,
// a single listener list for the whole rocket.
//
-
+
/**
* Adds a ComponentChangeListener to the rocket tree. The listener is added to the root
* component, which must be of type Rocket (which overrides this method). Events of all
@@ -1465,7 +1465,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
getRocket().addComponentChangeListener(l);
}
-
+
/**
* Removes a ComponentChangeListener from the rocket tree. The listener is removed from
* the root component, which must be of type Rocket (which overrides this method).
@@ -1479,8 +1479,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
getRoot().removeComponentChangeListener(l);
}
}
-
-
+
+
/**
* Adds a ChangeListener
to the rocket tree. This is identical to
* addComponentChangeListener()
except that it uses a
@@ -1495,7 +1495,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
getRocket().addChangeListener(l);
}
-
+
/**
* Removes a ChangeListener from the rocket tree. This is identical to
* removeComponentChangeListener() except it uses a ChangeListener.
@@ -1510,8 +1510,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
getRoot().removeChangeListener(l);
}
}
-
-
+
+
/**
* Fires a ComponentChangeEvent on the rocket structure. The call is passed to the
* root component, which must be of type Rocket (which overrides this method).
@@ -1532,8 +1532,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
}
getRoot().fireComponentChangeEvent(e);
}
-
-
+
+
/**
* Fires a ComponentChangeEvent of the given type. The source of the event is set to
* this component.
@@ -1544,8 +1544,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
protected void fireComponentChangeEvent(int type) {
fireComponentChangeEvent(new ComponentChangeEvent(this, type));
}
-
-
+
+
/**
* Checks whether this component has been invalidated and should no longer be used.
* This is a safety check that in-place replaced components are no longer used.
@@ -1558,8 +1558,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
invalidator.check(true);
mutex.verify();
}
-
-
+
+
/**
* Check that the local component structure is correct. This can be called after changing
* the component structure in order to verify the integrity.
@@ -1582,7 +1582,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
}
}
}
-
+
// Check whether the list contains exactly the searched-for component (with == operator)
private boolean containsExact(List
@@ -1617,8 +1617,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
public final Iterator
@@ -1633,9 +1633,9 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
public final Iterator
@@ -1654,8 +1654,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
checkState();
return new RocketComponentIterator(this, returnSelf);
}
-
-
+
+
/**
* Returns an iterator that iterates over this component, its children and sub-children.
*
@@ -1667,30 +1667,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
public final Iteratorx
and the radius at the specified position is
@@ -1732,41 +1709,41 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
bounds.add(new Coordinate(x, r, r));
bounds.add(new Coordinate(x, -r, r));
}
-
-
+
+
protected static final Coordinate ringCG(double outerRadius, double innerRadius,
double x1, double x2, double density) {
return new Coordinate((x1 + x2) / 2, 0, 0,
ringMass(outerRadius, innerRadius, x2 - x1, density));
}
-
- protected static final double ringVolume( double outerRadius, double innerRadius, double length ) {
- return ringMass( outerRadius, innerRadius, length, 1.0 );
+
+ protected static final double ringVolume(double outerRadius, double innerRadius, double length) {
+ return ringMass(outerRadius, innerRadius, length, 1.0);
}
-
+
protected static final double ringMass(double outerRadius, double innerRadius,
double length, double density) {
return Math.PI * (MathUtil.pow2(outerRadius) - MathUtil.pow2(innerRadius)) *
length * density;
}
-
+
protected static final double ringLongitudinalUnitInertia(double outerRadius,
double innerRadius, double length) {
// 1/12 * (3 * (r1^2 + r2^2) + h^2)
return (3 * (MathUtil.pow2(innerRadius) + MathUtil.pow2(outerRadius)) + MathUtil.pow2(length)) / 12;
}
-
+
protected static final double ringRotationalUnitInertia(double outerRadius,
double innerRadius) {
// 1/2 * (r1^2 + r2^2)
return (MathUtil.pow2(innerRadius) + MathUtil.pow2(outerRadius)) / 2;
}
-
-
-
+
+
+
//////////// OTHER
-
-
+
+
/**
* Loads the RocketComponent fields from the given component. This method is meant
* for in-place replacement of a component. It is used with the undo/redo
@@ -1787,34 +1764,34 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
protected List