package org.frc4931.zach.drive;

import edu.wpi.first.wpilibj.DigitalInput;

public class LimitedMotor extends Motor{
	public final DigitalInput highLimit;
	public final DigitalInput lowLimit;
	public LimitedMotor(int channel, int type, int lowLimit, int highLimit) {
		super(channel, type);
		this.highLimit = new DigitalInput(highLimit);
		this.lowLimit = new DigitalInput(lowLimit);
	}
	public boolean isHigh(){
		return !highLimit.get();
	}
	public boolean isLow(){
		return lowLimit.get();
	}
	//@Override
	public void setSpeed(double speed){
//		if(!isHigh()&&!isLow()){
			controller.set(speed);
//		}else{
//			stop();
//		}
	}

}

@@ -113,21 +113,22 @@
 otor%7B%0A%09p
-ublic
+rivate
  final D
@@ -152,21 +152,22 @@
 imit;%0A%09p
-ublic
+rivate
  final D
@@ -188,16 +188,399 @@
 wLimit;%0A
+%09%0A%09/**%0A%09 * Constructs a new LimitedMotor with the on the using the specified channels and motor controller.%0A%09 * @param channel the pwm channel the motor controller is attached to. %0A%09 * @param type the type of motor controller to use.%0A%09 * @param lowLimit the digital input channel of the low limit switch.%0A%09 * @param highLimit the digital input channel of the high limit switch.%0A%09 */%0A
 %09public 
@@ -605,19 +605,41 @@
 hannel, 
-int
+Motor.SpeedControllerType
  type, i
@@ -794,128 +794,572 @@
 %09%7D%0A%09
-public boolean isHigh()%7B%0A%09%09return !highLimit.get();%0A%09%7D%0A%09public boolean isLow()%7B%0A%09%09return lowLimit.get();%0A%09%7D%0A%09//@Override
+%0A%09/**%0A%09 * Tests if this motor has hit the high limit.%0A%09 * @return true if this motor has hit the high limit; false otherwise.%0A%09 */%0A%09public boolean isHigh()%7B%0A%09%09return !highLimit.get();%0A%09%7D%0A%09%0A%09/**%0A%09 * Tests if this motor has hit the high limit.%0A%09 * @return true if this motor has hit the low limit; false otherwise.%0A%09 */%0A%09public boolean isLow()%7B%0A%09%09return lowLimit.get();%0A%09%7D%0A%09%0A%09/**%0A%09 * Move this motor towards the high limit at the specified speed.  This motor will not move%0A%09 * if it is already at the high limit.%0A%09 * @param speed the speed to turn the motor at.%0A%09 */
 %0A%09pu
@@ -1371,21 +1371,20 @@
 void set
-Speed
+High
 (double 
@@ -1391,18 +1391,16 @@
 speed)%7B%0A
-//
 %09%09if(!is
@@ -1409,38 +1409,312 @@
 gh()
-&&!isLow())%7B%0A%09%09%09controller.set
+)%7B%0A%09%09%09setSpeed(speed);%0A%09%09%7Delse%7B%0A%09%09%09stop();%0A%09%09%7D%0A%09%7D%0A%09%0A%09/**%0A%09 * Move this motor towards the low limit at the specified speed.  This motor will not move%0A%09 * if it is already at the low limit.%0A%09 * @param speed the speed to turn the motor at.%0A%09 */%0A%09public void setLow(double speed)%7B%0A%09%09if(!isLow())%7B%0A%09%09%09setSpeed
 (spe
@@ -1718,18 +1718,16 @@
 speed);%0A
-//
 %09%09%7Delse%7B
@@ -1727,18 +1727,16 @@
 %09%7Delse%7B%0A
-//
 %09%09%09stop(
@@ -1742,13 +1742,133 @@
 ();%0A
-//
 %09%09%7D
+%09%0A%09%7D%0A%09%0A%09/**%0A%09 * Don't call this outside of LimitedMotor%0A%09 */%0A%09public void setSpeed(double speed)%7B%0A%09%09controller.set(speed);
 %0A%09%7D%0A

Improve function and documentation in LimitedMotor