bug fixes and rocket optimization
[debian/openrocket] / src / net / sf / openrocket / rocketcomponent / RocketComponent.java
index 8573caa67f9b019ca8bbc4a5d6d41a2ef9b01fb8..f9b28ea381d048f5dbbda7d516ca6f6955dad81b 100644 (file)
@@ -10,6 +10,7 @@ import java.util.NoSuchElementException;
 
 import javax.swing.event.ChangeListener;
 
+import net.sf.openrocket.l10n.Translator;
 import net.sf.openrocket.logging.LogHelper;
 import net.sf.openrocket.startup.Application;
 import net.sf.openrocket.util.ArrayList;
@@ -23,9 +24,9 @@ import net.sf.openrocket.util.SafetyMutex;
 import net.sf.openrocket.util.UniqueID;
 
 
-public abstract class RocketComponent implements ChangeSource, Cloneable, Iterable<RocketComponent>,
-               Visitable<ComponentVisitor, RocketComponent> {
+public abstract class RocketComponent implements ChangeSource, Cloneable, Iterable<RocketComponent> {
        private static final LogHelper log = Application.getLogger();
+       private static final Translator trans = Application.getTranslator();
        
        /*
         * Text is suitable to the form
@@ -33,15 +34,20 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         */
        public enum Position {
                /** Position relative to the top of the parent component. */
-               TOP("Top of the parent component"),
+               //// Top of the parent component
+               TOP(trans.get("RocketComponent.Position.TOP")),
                /** Position relative to the middle of the parent component. */
-               MIDDLE("Middle of the parent component"),
+               //// Middle of the parent component
+               MIDDLE(trans.get("RocketComponent.Position.MIDDLE")),
                /** Position relative to the bottom of the parent component. */
-               BOTTOM("Bottom of the parent component"),
+               //// Bottom of the parent component
+               BOTTOM(trans.get("RocketComponent.Position.BOTTOM")),
                /** Position after the parent component (for body components). */
-               AFTER("After the parent component"),
+               //// After the parent component
+               AFTER(trans.get("RocketComponent.Position.AFTER")),
                /** Specify an absolute X-coordinate position. */
-               ABSOLUTE("Tip of the nose cone");
+               //// Tip of the nose cone
+               ABSOLUTE(trans.get("RocketComponent.Position.ABSOLUTE"));
                
                private String title;
                
@@ -158,22 +164,22 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
 
        /**
-        * Return the longitudinal (around the y- or z-axis) unitary moment of inertia.  
+        * Return the longitudinal (around the y- or z-axis) unitary moment of inertia.
         * The unitary moment of inertia is the moment of inertia with the assumption that
         * the mass of the component is one kilogram.  The inertia is measured in
         * respect to the non-overridden CG.
-        * 
+        *
         * @return   the longitudinal unitary moment of inertia of this component.
         */
        public abstract double getLongitudinalUnitInertia();
        
        
        /**
-        * Return the rotational (around the x-axis) unitary moment of inertia.  
+        * Return the rotational (around the x-axis) unitary moment of inertia.
         * The unitary moment of inertia is the moment of inertia with the assumption that
         * the mass of the component is one kilogram.  The inertia is measured in
         * respect to the non-overridden CG.
-        * 
+        *
         * @return   the rotational unitary moment of inertia of this component.
         */
        public abstract double getRotationalUnitInertia();
@@ -183,7 +189,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * Test whether this component allows any children components.  This method must
         * return true if and only if {@link #isCompatible(Class)} returns true for any
         * rocket component class.
-        * 
+        *
         * @return      <code>true</code> if children can be attached to this component, <code>false</code> otherwise.
         */
        public abstract boolean allowsChildren();
@@ -193,7 +199,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * is enforced by the <code>addChild()</code> methods.  The return value of this method
         * may change to reflect the current state of this component (e.g. two components of some
         * type cannot be placed as children).
-        * 
+        *
         * @param type  The RocketComponent class type to add.
         * @return      Whether such a component can be added.
         */
@@ -204,7 +210,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Test whether the given component can be added to this component.  This is equivalent
         * to calling <code>isCompatible(c.getClass())</code>.
-        * 
+        *
         * @param c  Component to test.
         * @return   Whether the component can be added.
         * @see #isCompatible(Class)
@@ -219,7 +225,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Return a collection of bounding coordinates.  The coordinates must be such that
         * the component is fully enclosed in their convex hull.
-        * 
+        *
         * @return      a collection of coordinates that bound the component.
         */
        public abstract Collection<Coordinate> getComponentBounds();
@@ -248,7 +254,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * coordinate for each cluster.
         * <p>
         * The default implementation simply returns the array, and thus produces no shift.
-        * 
+        *
         * @param c   an array of coordinates to shift.
         * @return    an array of shifted coordinates.  The method may modify the contents
         *                        of the passed array and return the array itself.
@@ -260,11 +266,11 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        
        /**
-        * Called when any component in the tree fires a ComponentChangeEvent.  This is by 
-        * default a no-op, but subclasses may override this method to e.g. invalidate 
-        * cached data.  The overriding method *must* call 
+        * Called when any component in the tree fires a ComponentChangeEvent.  This is by
+        * default a no-op, but subclasses may override this method to e.g. invalidate
+        * cached data.  The overriding method *must* call
         * <code>super.componentChanged(e)</code> at some point.
-        * 
+        *
         * @param e  The event fired
         */
        protected void componentChanged(ComponentChangeEvent e) {
@@ -278,7 +284,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Return the user-provided name of the component, or the component base
         * name if the user-provided name is empty.  This can be used in the UI.
-        * 
+        *
         * @return A string describing the component.
         */
        @Override
@@ -321,7 +327,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * Make a deep copy of the rocket component tree structure from this component
         * downwards for copying purposes.  Each component in the copy will be assigned
         * a new component ID, making it a safe copy.  This method does not fire any events.
-        * 
+        *
         * @return A deep copy of the structure.
         */
        public final RocketComponent copy() {
@@ -343,13 +349,13 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * undo/redo mechanism.  This method should not be used for other purposes,
         * such as copy/paste.  This method does not fire any events.
         * <p>
-        * This method must be overridden by any component that refers to mutable objects, 
+        * This method must be overridden by any component that refers to mutable objects,
         * or if some fields should not be copied.  This should be performed by
         * <code>RocketComponent c = super.copyWithOriginalID();</code> and then cloning/modifying
         * the appropriate fields.
         * <p>
         * This is not performed as serializing/deserializing for performance reasons.
-        * 
+        *
         * @return A deep copy of the structure.
         */
        protected RocketComponent copyWithOriginalID() {
@@ -388,16 +394,6 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        }
        
        
-       /**
-        * Accept a visitor to this RocketComponent in the component hierarchy.
-        * 
-        * @param theVisitor  the visitor that will be called back with a reference to this RocketComponent
-        */
-       @Override
-       public void accept(final ComponentVisitor theVisitor) {
-               theVisitor.visit(this);
-       }
-       
        //////////////  Methods that may not be overridden  ////////////
        
 
@@ -414,7 +410,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        }
        
        /**
-        * Set the color of the object to use in 2D figures.  
+        * Set the color of the object to use in 2D figures.
         */
        public final void setColor(Color c) {
                if ((color == null && c == null) ||
@@ -446,7 +442,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Get the current override mass.  The mass is not necessarily in use
         * at the moment.
-        * 
+        *
         * @return  the override mass
         */
        public final double getOverrideMass() {
@@ -457,7 +453,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Set the current override mass.  The mass is not set to use by this
         * method.
-        * 
+        *
         * @param m  the override mass
         */
        public final void setOverrideMass(double m) {
@@ -472,7 +468,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Return whether mass override is active for this component.  This does NOT
         * take into account whether a parent component is overriding the mass.
-        * 
+        *
         * @return  whether the mass is overridden
         */
        public final boolean isMassOverridden() {
@@ -482,7 +478,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Set whether the mass is currently overridden.
-        * 
+        *
         * @param o  whether the mass is overridden
         */
        public final void setMassOverridden(boolean o) {
@@ -500,7 +496,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
 
        /**
         * Return the current override CG.  The CG is not necessarily overridden.
-        * 
+        *
         * @return  the override CG
         */
        public final Coordinate getOverrideCG() {
@@ -510,7 +506,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Return the x-coordinate of the current override CG.
-        * 
+        *
         * @return      the x-coordinate of the override CG.
         */
        public final double getOverrideCGX() {
@@ -520,7 +516,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Set the current override CG to (x,0,0).
-        * 
+        *
         * @param x  the x-coordinate of the override CG to set.
         */
        public final void setOverrideCGX(double x) {
@@ -536,7 +532,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Return whether the CG is currently overridden.
-        * 
+        *
         * @return  whether the CG is overridden
         */
        public final boolean isCGOverridden() {
@@ -546,7 +542,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Set whether the CG is currently overridden.
-        * 
+        *
         * @param o  whether the CG is overridden
         */
        public final void setCGOverridden(boolean o) {
@@ -567,7 +563,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * always or never overrides subcomponents.  In this case the subclass should
         * also override {@link #isOverrideSubcomponentsEnabled()} to return
         * <code>false</code>.
-        * 
+        *
         * @return      whether the current mass and/or CG override overrides subcomponents as well.
         */
        public boolean getOverrideSubcomponents() {
@@ -579,7 +575,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Set whether the mass and/or CG override overrides all subcomponent values
         * as well.  See {@link #getOverrideSubcomponents()} for details.
-        * 
+        *
         * @param override      whether the mass and/or CG override overrides all subcomponent.
         */
        public void setOverrideSubcomponents(boolean override) {
@@ -598,7 +594,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * <p>
         * This method may be overridden if the setting of overriding subcomponents
         * cannot be set.
-        * 
+        *
         * @return      whether the option to override subcomponents is currently enabled.
         */
        public boolean isOverrideSubcomponentsEnabled() {
@@ -637,7 +633,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Return the comment of the component.  The component may contain multiple lines
         * using \n as a newline separator.
-        * 
+        *
         * @return  the comment of the component.
         */
        public final String getComment() {
@@ -647,7 +643,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Set the comment of the component.
-        * 
+        *
         * @param comment  the comment of the component.
         */
        public final void setComment(String comment) {
@@ -665,7 +661,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
 
        /**
         * Returns the unique ID of the component.
-        * 
+        *
         * @return      the ID of the component.
         */
        public final String getID() {
@@ -687,7 +683,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * 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
         * relative to its parent.
-        * 
+        *
         * If the length of a component is settable, the class must define the setter method
         * itself.
         */
@@ -715,7 +711,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * do not support setting the relative position.  A component that does support
         * it should override this with a public method that simply calls this
         * supermethod AND fire a suitable ComponentChangeEvent.
-        * 
+        *
         * @param position      the relative positioning.
         */
        protected void setRelativePosition(RocketComponent.Position position) {
@@ -759,7 +755,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Get the position value of the component.  The exact meaning of the value is
         * dependent on the current relative positioning.
-        * 
+        *
         * @return  the positional value.
         */
        public final double getPositionValue() {
@@ -776,7 +772,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * do not support setting the relative position.  A component that does support
         * it should override this with a public method that simply calls this
         * supermethod AND fire a suitable ComponentChangeEvent.
-        * 
+        *
         * @param value         the position value of the component.
         */
        public void setPositionValue(double value) {
@@ -800,16 +796,16 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        
        /**
-        * Return coordinate <code>c</code> described in the coordinate system of 
+        * Return coordinate <code>c</code> described in the coordinate system of
         * <code>dest</code>.  If <code>dest</code> is <code>null</code> returns
         * absolute coordinates.
         * <p>
         * This method returns an array of coordinates, each of which represents a
         * position of the coordinate in clustered cases.  The array is guaranteed
-        * to contain at least one element.  
+        * to contain at least one element.
         * <p>
         * The current implementation does not support rotating components.
-        * 
+        *
         * @param c    Coordinate in the component's coordinate system.
         * @param dest Destination component coordinate system.
         * @return     an array of coordinates describing <code>c</code> in coordinates
@@ -888,7 +884,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
                        }
                        
                        // Check whether destination has been found or whether to backtrack
-                       // TODO: LOW: Backtracking into clustered components uses only one component 
+                       // TODO: LOW: Backtracking into clustered components uses only one component
                        if ((dest != null) && (component != dest)) {
                                Coordinate[] origin = dest.toAbsolute(Coordinate.NUL);
                                for (int i = 0; i < array.length; i++) {
@@ -904,9 +900,9 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        
        /**
-        * Recursively sum the lengths of all subcomponents that have position 
+        * Recursively sum the lengths of all subcomponents that have position
         * Position.AFTER.
-        * 
+        *
         * @return  Sum of the lengths.
         */
        private final double getTotalLength() {
@@ -931,7 +927,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Return the (possibly overridden) mass of component.
-        * 
+        *
         * @return The mass of the component or the given override mass.
         */
        public final double getMass() {
@@ -943,10 +939,10 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Return the (possibly overridden) center of gravity and mass.
-        * 
+        *
         * Returns the CG with the weight of the coordinate set to the weight of the component.
         * Both CG and mass may be separately overridden.
-        * 
+        *
         * @return The CG of the component or the given override CG.
         */
        public final Coordinate getCG() {
@@ -965,7 +961,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * 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
         * and is relative to the non-overridden CG.
-        * 
+        *
         * @return    the longitudinal moment of inertia of this component.
         */
        public final double getLongitudinalInertia() {
@@ -977,7 +973,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * 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
         * and is relative to the non-overridden CG.
-        * 
+        *
         * @return    the rotational moment of inertia of this component.
         */
        public final double getRotationalInertia() {
@@ -992,11 +988,11 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
 
        /**
         * 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 
+        * of the component's child list.  This is a helper method that calls
         * {@link #addChild(RocketComponent,int)}.
-        * 
+        *
         * @param component  The component to add.
-        * @throws IllegalArgumentException  if the component is already part of some 
+        * @throws IllegalArgumentException  if the component is already part of some
         *                                                                       component tree.
         * @see #addChild(RocketComponent,int)
         */
@@ -1007,15 +1003,15 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        
        /**
-        * Adds a child to the rocket component tree.  The component is added to 
+        * Adds a child to the rocket component tree.  The component is added to
         * the given position of the component's child list.
         * <p>
-        * This method may be overridden to enforce more strict component addition rules.  
+        * This method may be overridden to enforce more strict component addition rules.
         * The tests should be performed first and then this method called.
-        * 
+        *
         * @param component     The component to add.
         * @param index         Position to add component to.
-        * @throws IllegalArgumentException  If the component is already part of 
+        * @throws IllegalArgumentException  If the component is already part of
         *                                                                       some component tree.
         */
        public void addChild(RocketComponent component, int index) {
@@ -1041,7 +1037,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Removes a child from the rocket component tree.
-        * 
+        *
         * @param n  remove the n'th child.
         * @throws IndexOutOfBoundsException  if n is out of bounds
         */
@@ -1059,7 +1055,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Removes a child from the rocket component tree.  Does nothing if the component
         * is not present as a child.
-        * 
+        *
         * @param component             the component to remove
         * @return                              whether the component was a child
         */
@@ -1085,7 +1081,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
 
        /**
         * Move a child to another position.
-        * 
+        *
         * @param component     the component to move
         * @param index the component's new position
         * @throws IllegalArgumentException If an illegal placement was attempted.
@@ -1144,7 +1140,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Returns the position of the child in this components child list, or -1 if the
         * component is not a child of this component.
-        * 
+        *
         * @param child  The child to search for.
         * @return  Position in the list or -1 if not found.
         */
@@ -1157,7 +1153,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Get the parent component of this component.  Returns <code>null</code> if the component
         * has no parent.
-        * 
+        *
         * @return  The parent of this component or <code>null</code>.
         */
        public final RocketComponent getParent() {
@@ -1167,7 +1163,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Get the root component of the component tree.
-        * 
+        *
         * @return  The root component of the component tree.
         */
        public final RocketComponent getRoot() {
@@ -1179,9 +1175,9 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        }
        
        /**
-        * Returns the root Rocket component of this component tree.  Throws an 
+        * Returns the root Rocket component of this component tree.  Throws an
         * IllegalStateException if the root component is not a Rocket.
-        * 
+        *
         * @return  The root Rocket component of the component tree.
         * @throws  IllegalStateException  If the root component is not a Rocket.
         */
@@ -1198,7 +1194,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Return the Stage component that this component belongs to.  Throws an
         * IllegalStateException if a Stage is not in the parentage of this component.
-        * 
+        *
         * @return      The Stage component this component belongs to.
         * @throws      IllegalStateException   if a Stage component is not in the parentage.
         */
@@ -1216,7 +1212,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Return the stage number of the stage this component belongs to.  The stages
         * are numbered from zero upwards.
-        * 
+        *
         * @return   the stage number this component belongs to.
         */
        public final int getStageNumber() {
@@ -1241,7 +1237,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * 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,
         * or null if not found.
-        * 
+        *
         * @param idToFind  ID to search for.
         * @return    The component with the ID, or null if not found.
         */
@@ -1319,7 +1315,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * 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
         * subcomponents are sent to all listeners.
-        * 
+        *
         * @throws IllegalStateException - if the root component is not a Rocket
         */
        public void addComponentChangeListener(ComponentChangeListener l) {
@@ -1332,7 +1328,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * the root component, which must be of type Rocket (which overrides this method).
         * Does nothing if the root component is not a Rocket.  (The asymmetry is so
         * that listeners can always be removed just in case.)
-        * 
+        *
         * @param l  Listener to remove
         */
        public void removeComponentChangeListener(ComponentChangeListener l) {
@@ -1343,12 +1339,12 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        
        /**
-        * Adds a <code>ChangeListener</code> to the rocket tree.  This is identical to 
-        * <code>addComponentChangeListener()</code> except that it uses a 
+        * Adds a <code>ChangeListener</code> to the rocket tree.  This is identical to
+        * <code>addComponentChangeListener()</code> except that it uses a
         * <code>ChangeListener</code>.  The same events are dispatched to the
-        * <code>ChangeListener</code>, as <code>ComponentChangeEvent</code> is a subclass 
+        * <code>ChangeListener</code>, as <code>ComponentChangeEvent</code> is a subclass
         * of <code>ChangeEvent</code>.
-        * 
+        *
         * @throws IllegalStateException - if the root component is not a <code>Rocket</code>
         */
        @Override
@@ -1362,7 +1358,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * removeComponentChangeListener() except it uses a ChangeListener.
         * Does nothing if the root component is not a Rocket.  (The asymmetry is so
         * that listeners can always be removed just in case.)
-        * 
+        *
         * @param l  Listener to remove
         */
        @Override
@@ -1374,14 +1370,14 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        
        /**
-        * Fires a ComponentChangeEvent on the rocket structure.  The call is passed to the 
+        * 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).
         * Events of all subcomponents are sent to all listeners.
-        * 
-        * If the component tree root is not a Rocket, the event is ignored.  This is the 
-        * case when constructing components not in any Rocket tree.  In this case it 
+        *
+        * If the component tree root is not a Rocket, the event is ignored.  This is the
+        * case when constructing components not in any Rocket tree.  In this case it
         * would be impossible for the component to have listeners in any case.
-        *  
+        *
         * @param e  Event to send
         */
        protected void fireComponentChangeEvent(ComponentChangeEvent e) {
@@ -1398,7 +1394,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Fires a ComponentChangeEvent of the given type.  The source of the event is set to
         * this component.
-        * 
+        *
         * @param type  Type of event
         * @see #fireComponentChangeEvent(ComponentChangeEvent)
         */
@@ -1412,7 +1408,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * This is a safety check that in-place replaced components are no longer used.
         * All non-trivial methods (with the exception of methods simply getting a property)
         * should call this method before changing or computing anything.
-        * 
+        *
         * @throws      BugException    if this component has been invalidated by {@link #copyFrom(RocketComponent)}.
         */
        protected void checkState() {
@@ -1466,10 +1462,10 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * <p>
         * If an iterator iterating over only the direct children of the component is required,
         * use <code>component.getChildren().iterator()</code>.
-        * 
+        *
         * TODO: HIGH: Remove this after merges have been done
-        * 
-        * @param returnSelf boolean value specifying whether the component itself should be 
+        *
+        * @param returnSelf boolean value specifying whether the component itself should be
         *                                       returned
         * @return An iterator for the children and sub-children.
         * @deprecated Use {@link #iterator(boolean)} instead
@@ -1484,9 +1480,9 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * Returns an iterator that iterates over all children and sub-children, including itself.
         * <p>
         * This method is equivalent to <code>deepIterator(true)</code>.
-        * 
+        *
         * TODO: HIGH: Remove this after merges have been done
-        * 
+        *
         * @return An iterator for this component, its children and sub-children.
         * @deprecated Use {@link #iterator()} instead
         */
@@ -1506,8 +1502,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * <p>
         * If an iterator iterating over only the direct children of the component is required,
         * use <code>component.getChildren().iterator()</code>.
-        * 
-        * @param returnSelf boolean value specifying whether the component itself should be 
+        *
+        * @param returnSelf boolean value specifying whether the component itself should be
         *                                       returned
         * @return An iterator for the children and sub-children.
         */
@@ -1518,10 +1514,10 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        
        /**
-        * Returns an iterator that iterates over this components, its children and sub-children.
+        * Returns an iterator that iterates over this component, its children and sub-children.
         * <p>
         * This method is equivalent to <code>iterator(true)</code>.
-        * 
+        *
         * @return An iterator for this component, its children and sub-children.
         */
        @Override
@@ -1566,7 +1562,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        /**
         * Helper method to add rotationally symmetric bounds at the specified coordinates.
         * The X-axis value is <code>x</code> and the radius at the specified position is
-        * <code>r</code>. 
+        * <code>r</code>.
         */
        protected static final void addBound(Collection<Coordinate> bounds, double x, double r) {
                bounds.add(new Coordinate(x, -r, -r));
@@ -1619,7 +1615,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
         * to them have been removed (for example by firing appropriate events).  The list contains
         * all children and sub-children of the current component and the entire component
         * tree of <code>src</code>.
-        * 
+        *
         * @return      a list of components that should not be used after this call.
         */
        protected List<RocketComponent> copyFrom(RocketComponent src) {
@@ -1685,7 +1681,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
        
        /**
         * Private inner class to implement the Iterator.
-        * 
+        *
         * This iterator is fail-fast if the root of the structure is a Rocket.
         */
        private static class RocketComponentIterator implements Iterator<RocketComponent> {