package org.usfirst.frc.team4536.robot;

import java.lang.Math;

public class Utilities {
	
	/*
	 * Takes in values and makes them between -1 and 1
	 */
	public static double limit (double input) {
		double output;
		
		if(input > 1) {
			output = 1;
		}
		else if(input < -1) {
			output = -1;
		}
		else {
			output = input;
		}
		
		return output;
	}
		
	/*
	 * Takes in values and makes sure they are both above deadZone and below -deadZone
	 * We use it to create a small region on our joysticks that outputs 0
	 * Once the joystick gets outside of the dead zone, it outputs their actual values
	 */
	public static double deadZone (double input, double deadZone) {
        double output;
		
		if ((input < deadZone) && (input > -deadZone))      //if the input is within the dead zone, return 0
            output = 0;
        else
            output = input;
		
		return output;
     	}
	
	
	/*
	 * 
	 */
	public static double speedCurve(double input, double curve) {
        double output;
        double adjustedCurve = curve;
        
        //We don't want to have bases smaller than 0.1 because of weird math
        if(curve <= 0.1) {         
            adjustedCurve = 0.1;
        }
        
        //If the input is negative then pretend that it's positive 
        if(input < 0) {            
            output = -(Math.pow(-input, adjustedCurve));  //and reflect it over the X axis
        }
        //If it's positive then simply take it to the power of the adjustedCurve
        else {                     
            output = Math.pow(input, adjustedCurve);
        }
        
        //output has to be between -1 and 1
        limit(output);
        
        return output;
    }
}

@@ -149,22 +149,151 @@
  and 1%0D%0A
+%09 *Suggested improvement: there is no need to have %22output%22 in this method. Just use %22return%22 in multiple places instead. Caleb%0D%0A
 %09 */%0D%0A
-
 %09public 
@@ -751,16 +751,70 @@
 values%0D%0A
+%09 *Suggested improvement: Same as for limit(). Caleb%0D%0A
 %09 */%0D%0A%09p
@@ -1119,20 +1119,74 @@
 %09%0D%0A%09/*%0D%0A
-
 %09 * 
+Suggested improvement: have comments right here. Caleb
 %0D%0A%09 */%0D%0A

Update Utilities.java