package org.lunatecs316.frc2014.lib;

import edu.wpi.first.wpilibj.Joystick;

/**
 * Wrapper class for the Xbox Controller
 * @author domenicpaul
 */
public class XboxController extends Joystick {

    public XboxController(final int port) {
        super(port);
    }

    public double getLeftX() {
        return getX();
    }

    public double getLeftY() {
        return getY();
    }

    public double getRightX() {
        return getRawAxis(4);
    }

    public double getRightY() {
        return getRawAxis(5);
    }

    public boolean getButtonA() {
        return getRawButton(1);
    }

    public boolean getButtonB() {
        return getRawButton(2);
    }

    public boolean getButtonX() {
        return getRawButton(3);
    }

    public boolean getButtonY() {
        return getRawButton(4);
    }

    public boolean getLeftBumper() {
        return getRawButton(5);
    }

    public boolean getRightBumper() {
        return getRawButton(6);
    }
}

@@ -190,16 +190,698 @@
 stick %7B%0A
+    %0A    public static final Button kButtonA = new Button(1);%0A    public static final Button kButtonB = new Button(2);%0A    public static final Button kButtonX = new Button(3);%0A    public static final Button kButtonY = new Button(4);%0A    public static final Button kLeftBumper = new Button(5);%0A    public static final Button kRightBumper = new Button(6);%0A    %0A    public static class Button %7B%0A        private int number;%0A        %0A        public Button(int number) %7B%0A            this.number = number;%0A        %7D%0A        %0A        public int getNumber() %7B%0A            return number;%0A        %7D%0A    %7D%0A    %0A    private boolean%5B%5D previous = %7B false, false, false, false, false, false %7D;%0A    
 %0A    pub
@@ -1239,38 +1239,49 @@
 onA() %7B%0A        
-return
+boolean current =
  getRawButton(1)
@@ -1278,24 +1278,79 @@
 wButton(1);%0A
+        previous%5B0%5D = current;%0A        return current;%0A
     %7D%0A%0A    p
@@ -1378,38 +1378,49 @@
 onB() %7B%0A        
-return
+boolean current =
  getRawButton(2)
@@ -1417,24 +1417,79 @@
 wButton(2);%0A
+        previous%5B1%5D = current;%0A        return current;%0A
     %7D%0A%0A    p
@@ -1517,38 +1517,49 @@
 onX() %7B%0A        
-return
+boolean current =
  getRawButton(3)
@@ -1556,24 +1556,79 @@
 wButton(3);%0A
+        previous%5B2%5D = current;%0A        return current;%0A
     %7D%0A%0A    p
@@ -1656,38 +1656,49 @@
 onY() %7B%0A        
-return
+boolean current =
  getRawButton(4)
@@ -1707,155 +1707,1343 @@
     
-%7D%0A%0A    public boolean getLeftBumper() %7B%0A        return getRawButton(5);%0A    %7D%0A%0A    public boolean getRightBumper() %7B%0A        return getRawButton(6)
+    previous%5B3%5D = current;%0A        return current;%0A    %7D%0A%0A    public boolean getLeftBumper() %7B%0A        boolean current = getRawButton(5);%0A        previous%5B4%5D = current;%0A        return current;%0A    %7D%0A%0A    public boolean getRightBumper() %7B%0A        boolean current = getRawButton(6);%0A        previous%5B5%5D = current;%0A        return current;%0A    %7D%0A    %0A    public boolean getButton(Button button) %7B%0A        boolean current = getRawButton(button.getNumber());%0A        previous%5Bbutton.getNumber()-1%5D = current;%0A        return current;%0A    %7D%0A    %0A    public boolean getButtonPressed(Button button) %7B%0A        int number = button.getNumber();%0A        boolean current = getRawButton(number);%0A        boolean result = current && !previous%5Bnumber-1%5D;%0A        previous%5Bnumber-1%5D = current;%0A        return result;%0A    %7D%0A    %0A    public boolean getButtonHeld(Button button) %7B%0A        int number = button.getNumber();%0A        boolean current = getRawButton(number);%0A        boolean result = current && previous%5Bnumber-1%5D;%0A        previous%5Bnumber-1%5D = current;%0A        return result;%0A    %7D%0A    %0A    public boolean getButtonReleased(Button button) %7B%0A        int number = button.getNumber();%0A        boolean current = getRawButton(number);%0A        boolean result = !current && previous%5Bnumber-1%5D;%0A        previous%5Bnumber-1%5D = current;%0A        return result
 ;%0A  

Add button pressed, held, and released methods to XboxController class