Merged l10n branch to trunk
[debian/openrocket] / src / net / sf / openrocket / rocketcomponent / BodyTube.java
index 297ec1c3befa93382aa017d1667f240c1b3ee342..0b53eb0266c27ecf4ed87625582a7fadaa91ce22 100644 (file)
@@ -1,25 +1,25 @@
 package net.sf.openrocket.rocketcomponent;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+
 import net.sf.openrocket.l10n.Translator;
 import net.sf.openrocket.motor.Motor;
 import net.sf.openrocket.startup.Application;
 import net.sf.openrocket.util.Coordinate;
 import net.sf.openrocket.util.MathUtil;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-
 
 /**
  * Rocket body tube component.  Has only two parameters, a radius and length.
- * 
+ *
  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
  */
 
 public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial {
        private static final Translator trans = Application.getTranslator();
-
+       
        private double radius = 0;
        private boolean autoRadius = false; // Radius chosen automatically based on parent component
        
@@ -64,11 +64,11 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
        
        /**
         * Return the outer radius of the body tube.
-     * 
-     * @return  the outside radius of the tube
+        *
+        * @return  the outside radius of the tube
         */
-    @Override
-       public double getOuterRadius () {
+       @Override
+       public double getOuterRadius() {
                if (autoRadius) {
                        // Return auto radius from front or rear
                        double r = -1;
@@ -94,11 +94,11 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
         * Set the outer radius of the body tube.  If the radius is less than the wall thickness,
         * the wall thickness is decreased accordingly of the value of the radius.
         * This method sets the automatic radius off.
-     * 
-     * @param radius  the outside radius in standard units
+        *
+        * @param radius  the outside radius in standard units
         */
-    @Override
-       public void setOuterRadius (double radius) {
+       @Override
+       public void setOuterRadius(double radius) {
                if ((this.radius == radius) && (autoRadius == false))
                        return;
                
@@ -120,7 +120,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
        }
        
        /**
-        * Sets whether the radius is selected automatically or not.  
+        * Sets whether the radius is selected automatically or not.
         */
        public void setRadiusAutomatic(boolean auto) {
                if (autoRadius == auto)
@@ -132,9 +132,15 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
        
        
        @Override
-       public double getAftRadius() {  return getOuterRadius(); }
+       public double getAftRadius() {
+               return getOuterRadius();
+       }
+       
        @Override
-       public double getForeRadius() { return getOuterRadius(); }
+       public double getForeRadius() {
+               return getOuterRadius();
+       }
+       
        @Override
        public boolean isAftRadiusAutomatic() {
                return isRadiusAutomatic();
@@ -178,20 +184,17 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
        
 
 
-       
-       
-       
-       
-    @Override  
+
+       @Override
        public double getInnerRadius() {
                if (filled)
                        return 0;
-               return Math.max(getOuterRadius()-thickness, 0);
+               return Math.max(getOuterRadius() - thickness, 0);
        }
        
-    @Override
+       @Override
        public void setInnerRadius(double r) {
-               setThickness(getOuterRadius()-r);
+               setThickness(getOuterRadius() - r);
        }
        
        
@@ -205,18 +208,8 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
                //// Body tube
                return trans.get("BodyTube.BodyTube");
        }
-
-    /**
-     * Accept a visitor to this BodyTube in the component hierarchy.
-     * 
-     * @param theVisitor  the visitor that will be called back with a reference to this BodyTube
-     */
-    @Override 
-    public void accept (final ComponentVisitor theVisitor) {
-        theVisitor.visit(this);
-    }
-
-
+       
+       
        /************ Component calculations ***********/
        
        // From SymmetricComponent
@@ -236,7 +229,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
                if (filled)
                        return 0.0;
                else
-                       return Math.max(getOuterRadius()-thickness,0);
+                       return Math.max(getOuterRadius() - thickness, 0);
        }
        
        
@@ -264,14 +257,13 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
        @Override
        public double getLongitudinalUnitInertia() {
                // 1/12 * (3 * (r1^2 + r2^2) + h^2)
-               return (3 * (MathUtil.pow2(getInnerRadius())) + MathUtil.pow2(getOuterRadius()) +
-                               MathUtil.pow2(getLength())) / 12;
+               return (3 * (MathUtil.pow2(getInnerRadius())) + MathUtil.pow2(getOuterRadius()) + MathUtil.pow2(getLength())) / 12;
        }
        
        @Override
        public double getRotationalUnitInertia() {
                // 1/2 * (r1^2 + r2^2)
-               return (MathUtil.pow2(getInnerRadius()) + MathUtil.pow2(getOuterRadius()))/2;
+               return (MathUtil.pow2(getInnerRadius()) + MathUtil.pow2(getOuterRadius())) / 2;
        }
        
        
@@ -288,7 +280,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
        /**
         * Adds bounding coordinates to the given set.  The body tube will fit within the
         * convex hull of the points.
-        * 
+        *
         * Currently the points are simply a rectangular box around the body tube.
         */
        @Override
@@ -305,7 +297,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
        /**
         * Check whether the given type can be added to this component.  BodyTubes allow any
         * InternalComponents or ExternalComponents, excluding BodyComponents, to be added.
-        * 
+        *
         * @param type  The RocketComponent class type to add.
         * @return      Whether such a component can be added.
         */
@@ -446,7 +438,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
        /*
         * (non-Javadoc)
         * Copy the motor and ejection delay HashMaps.
-        * 
+        *
         * @see rocketcomponent.RocketComponent#copy()
         */
        @SuppressWarnings("unchecked")