// Path: src/org/usfirst/frc2832/Robot_2016/Coordinate.java
// public class Coordinate
// {
// 	private final double x, y;
// 	
// 	public Coordinate(double x, double y)
// 	{
// 		this.x = x;
// 		this.y = y;
// 	}
// 	
// 	public double getX()
// 	{
// 		return x;
// 	}
// 	
// 	public double getY()
// 	{
// 		return y;
// 	}
// }


import org.usfirst.frc2832.Robot_2016.Coordinate;
import edu.wpi.first.wpilibj.Joystick;
package org.usfirst.frc2832.Robot_2016.HID;



public class GamepadDeadzoned extends Joystick {
	
	private double range = 0.15;
	
	private int[] leftstickAxis = {0, 1};
	private int[] rightstickAxis = {4, 5};
	
	public GamepadDeadzoned(int port) {
		super(port);
	}

	private double deadzone(double in) {
		return Math.abs(in) < range ? 0 : in;
	}
	
	private static boolean arrContains(int[] arr, int x) {
		for(int a : arr) {
			if (a == x)
				return true;
		}
		
		return false;
	}
	
	
	/**
	 * Use getRawAxis with your axis ID instead of this method
	 * 0 and 1 for left stick
	 * 2 and 3 for triggers
	 * 4 and 5 for right stick
	 */
	@Deprecated
	@Override
	public double getAxis(AxisType axis) {
		return getRawAxis(axis.value);
	}
	
	/**
	 * Radial deadzoning helper method
	 * @param x
	 * @param y
	 * @return
	 */
// Path: src/org/usfirst/frc2832/Robot_2016/Coordinate.java
// public class Coordinate
// {
// 	private final double x, y;
// 	
// 	public Coordinate(double x, double y)
// 	{
// 		this.x = x;
// 		this.y = y;
// 	}
// 	
// 	public double getX()
// 	{
// 		return x;
// 	}
// 	
// 	public double getY()
// 	{
// 		return y;
// 	}
// }


// Path: src/org/usfirst/frc2832/Robot_2016/HID/GamepadDeadzoned.java
import org.usfirst.frc2832.Robot_2016.Coordinate;
import edu.wpi.first.wpilibj.Joystick;

package org.usfirst.frc2832.Robot_2016.HID;



public class GamepadDeadzoned extends Joystick {
	
	private double range = 0.15;
	
	private int[] leftstickAxis = {0, 1};
	private int[] rightstickAxis = {4, 5};
	
	public GamepadDeadzoned(int port) {
		super(port);
	}

	private double deadzone(double in) {
		return Math.abs(in) < range ? 0 : in;
	}
	
	private static boolean arrContains(int[] arr, int x) {
		for(int a : arr) {
			if (a == x)
				return true;
		}
		
		return false;
	}
	
	
	/**
	 * Use getRawAxis with your axis ID instead of this method
	 * 0 and 1 for left stick
	 * 2 and 3 for triggers
	 * 4 and 5 for right stick
	 */
	@Deprecated
	@Override
	public double getAxis(AxisType axis) {
		return getRawAxis(axis.value);
	}
	
	/**
	 * Radial deadzoning helper method
	 * @param x
	 * @param y
	 * @return
	 */
	private Coordinate deadzone2D(double x, double y) {