package org.team2471.frc.lib.io;

import edu.wpi.first.wpilibj.Joystick;

// TODO: Update to match 2017 wpilib Joystick api
public class Controller {
  private final Joystick joystick;

  public Controller(Joystick joystick) {
    this.joystick = joystick;

    int buttonCount = joystick.getButtonCount();
  }

  public Controller(int joystickPort) {
    this(new Joystick(joystickPort));
  }

  public String getName() {
    return joystick.getName();
  }

  public void rumbleLeft(float strength) {
    joystick.setRumble(Joystick.RumbleType.kLeftRumble, strength);
  }

  public void rumbleRight(float strength) {
    joystick.setRumble(Joystick.RumbleType.kRightRumble, strength);
  }

  public ControllerAxis getAxis(int axisId) {
    return () -> joystick.getRawAxis(axisId);
  }

  public ControllerButton getButton(int buttonId) {
    return () -> joystick.getRawButton(buttonId);
  }

  public ControllerDPad getDPad(int pov) {
    return () -> joystick.getPOV(pov);
  }

  public ControllerDPad getDPad() {
    return getDPad(0);
  }
}

@@ -60,68 +60,65 @@
 ibj.
-Joystick;%0A%0A// TODO: Update to match 2017 wpilib Joystick api
+GenericHID;%0Aimport edu.wpi.first.wpilibj.XboxController;%0A
 %0Apub
@@ -156,33 +156,37 @@
 e final 
-Joystick joystick
+GenericHID controller
 ;%0A%0A  pub
@@ -204,107 +204,65 @@
 ler(
-Joystick joystick) %7B%0A    this.joystick = joystick;%0A%0A    int buttonCount = joystick.getButtonCount()
+GenericHID controller) %7B%0A    this.controller = controller
 ;%0A  
@@ -288,24 +288,19 @@
 ler(int 
-joystick
+hid
 Port) %7B%0A
@@ -316,25 +316,26 @@
 new 
-Joystick(joystick
+XboxController(hid
 Port
@@ -382,24 +382,26 @@
  return 
-joystick
+controller
 .getName
@@ -452,32 +452,34 @@
 ngth) %7B%0A    
-joystick
+controller
 .setRumble(J
@@ -473,32 +473,34 @@
 r.setRumble(
-Joystick
+GenericHID
 .RumbleType.
@@ -576,24 +576,26 @@
 ) %7B%0A    
-joystick
+controller
 .setRumb
@@ -601,16 +601,18 @@
 ble(
-Joystick
+GenericHID
 .Rum
@@ -708,32 +708,34 @@
 eturn () -%3E 
-joystick
+controller
 .getRawAxis(
@@ -813,32 +813,34 @@
 eturn () -%3E 
-joystick
+controller
 .getRawButto
@@ -921,16 +921,18 @@
  -%3E 
-joystick
+controller
 .get

Update io.Controller constructs