package com.snobot.simulator.motor_sim;

public class GravityLoadDcMotorSim extends BaseDcMotorSimulator
{
    protected final static double sGRAVITY = 9.8;

    protected final double mLoad;

    public GravityLoadDcMotorSim(DcMotorModel aModel, double aLoad)
    {
        super(aModel);

        mLoad = aLoad;
    }


    @Override
    public void update(double cycleTime)
    {
        double extraAcceleration = -sGRAVITY;

        // If you are going up, you will be fighting gravity
        if (mVoltagePercentage > 0)
        {
            extraAcceleration *= -1;
        }

        mMotorModel.step(mVoltagePercentage * 12, mLoad, extraAcceleration, cycleTime);
    }
}

@@ -32,19 +32,17 @@
 tor_sim;
-%0D%0A%0D
+%0A
 %0Apublic 
@@ -101,12 +101,10 @@
 ator
-%0D
 %0A%7B
-%0D
 %0A   
@@ -149,19 +149,17 @@
 Y = 9.8;
-%0D%0A%0D
+%0A
 %0A    pro
@@ -184,19 +184,17 @@
 e mLoad;
-%0D%0A%0D
+%0A
 %0A    pub
@@ -253,24 +253,22 @@
 e aLoad)
-%0D
 %0A    %7B
-%0D
 %0A       
@@ -282,19 +282,17 @@
 aModel);
-%0D%0A%0D
+%0A
 %0A       
@@ -310,20 +310,16 @@
 oad;
-%0D
 %0A    %7D
-%0D%0A%0D%0A%0D
+%0A%0A
 %0A   
@@ -328,17 +328,16 @@
 Override
-%0D
 %0A    pub
@@ -373,16 +373,14 @@
 ime)
-%0D
 %0A    %7B
-%0D
 %0A   
@@ -425,172 +425,9 @@
 ITY;
-%0D%0A%0D%0A        // If you are going up, you will be fighting gravity%0D%0A        if (mVoltagePercentage %3E 0)%0D%0A        %7B%0D%0A            extraAcceleration *= -1;%0D%0A        %7D%0D%0A%0D
+%0A
 %0A   
@@ -514,16 +514,13 @@
 me);
-%0D
 %0A    %7D
-%0D
 %0A%7D
-%0D
 %0A

Removing unecessary code. Handled implicitly