<commit_before>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();
//		}
	}

}<commit_msg>Improve function and documentation in LimitedMotor<commit_after>package org.frc4931.zach.drive;

import edu.wpi.first.wpilibj.DigitalInput;

public class LimitedMotor extends Motor{
	private final DigitalInput highLimit;
	private final DigitalInput lowLimit;
	
	/**
	 * Constructs a new LimitedMotor with the on the using the specified channels and motor controller.
	 * @param channel the pwm channel the motor controller is attached to. 
	 * @param type the type of motor controller to use.
	 * @param lowLimit the digital input channel of the low limit switch.
	 * @param highLimit the digital input channel of the high limit switch.
	 */
	public LimitedMotor(int channel, Motor.SpeedControllerType type, int lowLimit, int highLimit) {
		super(channel, type);
		this.highLimit = new DigitalInput(highLimit);
		this.lowLimit = new DigitalInput(lowLimit);
	}
	
	/**
	 * Tests if this motor has hit the high limit.
	 * @return true if this motor has hit the high limit; false otherwise.
	 */
	public boolean isHigh(){
		return !highLimit.get();
	}
	
	/**
	 * Tests if this motor has hit the high limit.
	 * @return true if this motor has hit the low limit; false otherwise.
	 */
	public boolean isLow(){
		return lowLimit.get();
	}
	
	/**
	 * Move this motor towards the high limit at the specified speed.  This motor will not move
	 * if it is already at the high limit.
	 * @param speed the speed to turn the motor at.
	 */
	public void setHigh(double speed){
		if(!isHigh()){
			setSpeed(speed);
		}else{
			stop();
		}
	}
	
	/**
	 * Move this motor towards the low limit at the specified speed.  This motor will not move
	 * if it is already at the low limit.
	 * @param speed the speed to turn the motor at.
	 */
	public void setLow(double speed){
		if(!isLow()){
			setSpeed(speed);
		}else{
			stop();
		}	
	}
	
	/**
	 * Don't call this outside of LimitedMotor
	 */
	public void setSpeed(double speed){
		controller.set(speed);
	}

}
{'fraction_non_alphanumeric': 0.10095969289827256, 'fraction_numerical': 0.003071017274472169, 'mean_word_length': 3.6618962432915922, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1216522', 'n_tokens_mistral': 857, 'n_tokens_neox': 777, 'n_words': 294}