/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.plasmarobotics.jim.controls;

import edu.wpi.first.wpilibj.GenericHID;

/**
 * Attempted emulation of ToggleableButton, used for PlamsaGamepad
 * triggers and D-Pad. Instead of calling GenericHID.getRawButton to
 * provide output for get(), calls GenericHID.getRawAxis and calculates
 * boolean value based its return.
 * @author Allek
 */
public class GhettoButton {
    private GenericHID joystick;
    private int axisNumber;
    private boolean isHeld = false,
            negativeEnd;
    
    /**
     * @param joystick The joystick
     * @param axisNumber Number corresponding to axis on joystick.
     * @param negativeEnd If axis value approaches -1 when target entity is active.
     **/
    public GhettoButton(GenericHID joystick, int axisNumber, boolean negativeEnd) {
        this.joystick = joystick;
        this.axisNumber = axisNumber;
        this.negativeEnd = negativeEnd;
    }
    public boolean get() {
        double axisValue = joystick.getRawAxis(axisNumber);
        return (negativeEnd) ? (axisValue < 0) : (axisValue > 0);
    }
}

@@ -561,118 +561,54 @@
 ton 
-%7B%0A    private GenericHID joystick;%0A    private int axisNumber;%0A    private boolean isHeld = false,%0A           
+extends ToggleableButton %7B%0A    private boolean
  neg
@@ -922,21 +922,22 @@
     
-this.
+super(
 joystick
  = j
@@ -936,57 +936,21 @@
 tick
- = joystick;%0A        this.axisNumber = axisNumber
+, axisNumber)
 ;%0A  

Modify GhettoButton to extend ToggleableButton