<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.CANJaguar;
import edu.wpi.first.wpilibj.Jaguar;

/**
 *
 * @author Dlock
 */
public class BTMotor {
    
    private boolean isCANBus = false;
    private CANJaguar CANMotor;
    private Jaguar PWMMotor;
    private boolean successJag = false;
    
    public BTMotor(int port, boolean isCan, boolean isVoltage)
    {
        isCANBus = isCan;
        if (isCANBus) {
            try{
                CANMotor = new CANJaguar(port);
                if (isVoltage)
                {
                    CANMotor.changeControlMode(CANJaguar.ControlMode.kVoltage);
                }
                else
                {
                    CANMotor.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
                }
                successJag = true;
            }
            catch(Exception CANTimeoutException){
                System.out.println("Error initialising CANJaguar at port: " +port);
            }
        }
        else
        {
            PWMMotor = new Jaguar(port);
        }
    }
    public void setX(double x)
    {
        
        if(isCANBus)
        {
            if (successJag)
            {
                try{
                    CANMotor.setX(x);
                }
                catch(Exception CANTimeoutException){
                    System.out.println("Error setting CANJaguar speed");
                }
            }
        }
        else
        {
            PWMMotor.set(x);
        }
        
    }
}
<commit_msg>Added methods in BTMotor<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.CANJaguar;
import edu.wpi.first.wpilibj.Jaguar;

/**
 *
 * @author Dlock
 */
public class BTMotor {
    
    private boolean isCANBus = false;
    private CANJaguar CANMotor;
    private Jaguar PWMMotor;
    private boolean successJag = false;
    private int portNum;
   
    
    public BTMotor(int port, boolean isCan, boolean isVoltage)
    {
        isCANBus = isCan;
        portNum = port;
        if (isCANBus) {
            try{
                CANMotor = new CANJaguar(port);
                if (isVoltage)
                {
                    CANMotor.changeControlMode(CANJaguar.ControlMode.kVoltage);
                }
                else
                {
                    CANMotor.changeControlMode(CANJaguar.ControlMode.kPercentVbus);
                }
                successJag = true;
            }
            catch(Exception CANTimeoutException){
                System.out.println("Error initialising CANJaguar at port: " +port);
            }
        }
        else
        {
            PWMMotor = new Jaguar(port);
        }
    }
    public void setX(double x)
    {
        
        if(isCANBus)
        {
            if (successJag)
            {
                try{
                    CANMotor.setX(x);
                }
                catch(Exception CANTimeoutException){
                    System.out.println("Error setting CANJaguar speed at "+portNum);
                }
            }
        }
        else
        {
            PWMMotor.set(x);
        }
       
    }
    public double getBTBusVoltage(){
        if(isCANBus)
        {
            try{
                return CANMotor.getBusVoltage();
            }
            catch(Exception e){
                System.out.println("Error in getting voltage at "+portNum);
            }
        }
    return 0;
    }
    public double getBTOutputCurrent(){
        if(isCANBus)
        {            
            try{
                return CANMotor.getOutputCurrent();
        }
            catch(Exception e){
                System.out.println("Error in getting current at "+portNum);
            }
        }
    return 0;
    }
    public double getBTTemperature(){
        if(isCANBus)
        {
            try{
                return CANMotor.getTemperature();
        }
            catch (Exception e){
                System.out.println("Error in getting temperature at "+portNum);
            }    
        }
    return 0;
    }
}

{'fraction_non_alphanumeric': 0.08263500931098697, 'fraction_numerical': 0.0006983240223463687, 'mean_word_length': 1.2462101411395714, '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': '7588959', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1196, 'n_words': 244}