<commit_before>package us.vanderhyde.gamepad;

import java.util.ArrayList;

/**
 *
 * @author james
 */
public class EventThread extends Thread
{
    private ArrayList<ControllerListener> controllerListeners;
    private ArrayList<GamepadButtonListener> buttonListeners;

    public EventThread()
    {
        super("Controller-event-thread");
        this.setDaemon(true);
        
        this.controllerListeners = new ArrayList<ControllerListener>();
        this.buttonListeners = new ArrayList<GamepadButtonListener>();
    }
    
    @Override
    public void run()
    {
        System.out.println("Event thread started.");
        
        ControllerSearch search = new ControllerSearch();<commit_msg>Added method to check for gamepads<commit_after>package us.vanderhyde.gamepad;

import java.util.ArrayList;
import net.java.games.input.Controller;
import net.java.games.input.ControllerEnvironment;

/**
 *
 * @author james
 */
public class EventThread extends Thread
{
    private ArrayList<ControllerListener> controllerListeners;
    private ArrayList<GamepadButtonListener> buttonListeners;

    public EventThread()
    {
        super("Controller-event-thread");
        this.setDaemon(true);
        
        this.controllerListeners = new ArrayList<ControllerListener>();
        this.buttonListeners = new ArrayList<GamepadButtonListener>();
    }
    
    public static int numGamepadsAttached()
    {
        Controller[] conts = ControllerEnvironment.getDefaultEnvironment().getControllers();
        int num = 0;
        for (Controller c:conts)
            if (c.getType() == Controller.Type.GAMEPAD) 
                num++;
        return num;
    }
    
    @Override
    public void run()
    {
        System.out.println("Gamepad event thread started.");
        
        ControllerSearch search = new ControllerSearch();
{'fraction_non_alphanumeric': 0.0972972972972973, 'fraction_numerical': 0.0005405405405405405, 'mean_word_length': 2.9551282051282053, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3311632', 'n_tokens_mistral': 473, 'n_tokens_neox': 476, 'n_words': 104}