<commit_before>package org.siggd;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import org.siggd.actor.Blob;
import org.siggd.view.MenuView;
import org.siggd.ControllerFilterAPI;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.Controllers;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GLCommon;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.esotericsoftware.tablelayout.Cell;

public class MenuController implements InputProcessor, ControllerListener {
	private static int FILTER_AMOUNT = 7;
	private static int KEY_FILTER_AMOUNT = 1;
	private static final Set<Integer> NAV_KEYS = new HashSet<Integer>(
			Arrays.asList(new Integer[] { Input.Keys.A, Input.Keys.LEFT,
					Input.Keys.D, Input.Keys.RIGHT, Input.Keys.W,
					Input.Keys.UP, Input.Keys.S, Input.Keys.DOWN }));

	private Table mTable;
	private Controller mController;
	private int mPlayerId;
	private int mX, mY;
	private int mControllerFilter;
	private int mKeyFilter;
	private int mFilteredKey;
	private boolean mEscDown = false;
	private boolean mEnterDown = false;
	private static float sLineWidth = 3;

	/**
	 * Constructs a new MenuController, defaults selected index to 0
	 * 
	 * @param id
	 *            controller number
	 */
	public MenuController() {
		this(0);
	}

	/**
	 * Constructs a new MenuController for the specified controller starting at
	 * the specified index
	 * 
	 * @param id
	 *            controller number
	 * @param index
	 *            element index that starts selected
	 */
	public MenuController(int index) {
		mX = 0;
		mY = 0;
		mPlayerId = 0;
		mController = Controllers.getControllers().get(0);
		mControllerFilter = 0;
		mFilteredKey = -42;
		mTable = null;
	}

	public void setIndex(int i) {
		int j = 0;
		Cell target = null;
		for (Cell c : mTable.getCells()) {
			if (j == i) {
				target = c;
				break;
			}
			j++;
		}
		if (target != null) {
			mX = target.getColumn();
			mY = target.getRow();
		}
	}

	public void setTable(Table t) {
		mTable = t;
		if (t != null) {
			for (Cell c : t.getCells()) {
				Actor a = (Actor) c.getWidget();
				if (a != null) {
					a.addListener(hoverListener);
				}<commit_msg>Adding a null check for MenuController<commit_after>package org.siggd;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import org.siggd.actor.Blob;
import org.siggd.view.MenuView;
import org.siggd.ControllerFilterAPI;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.Controllers;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GLCommon;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.tablelayout.Cell;

public class MenuController implements InputProcessor, ControllerListener {
	private static int FILTER_AMOUNT = 7;
	private static int KEY_FILTER_AMOUNT = 1;
	private static final Set<Integer> NAV_KEYS = new HashSet<Integer>(
			Arrays.asList(new Integer[] { Input.Keys.A, Input.Keys.LEFT,
					Input.Keys.D, Input.Keys.RIGHT, Input.Keys.W,
					Input.Keys.UP, Input.Keys.S, Input.Keys.DOWN }));

	private Table mTable;
	private Controller mController;
	private int mPlayerId;
	private int mX, mY;
	private int mControllerFilter;
	private int mKeyFilter;
	private int mFilteredKey;
	private boolean mEscDown = false;
	private boolean mEnterDown = false;
	private static float sLineWidth = 3;

	/**
	 * Constructs a new MenuController, defaults selected index to 0
	 * 
	 * @param id
	 *            controller number
	 */
	public MenuController() {
		this(0);
	}

	/**
	 * Constructs a new MenuController for the specified controller starting at
	 * the specified index
	 * 
	 * @param id
	 *            controller number
	 * @param index
	 *            element index that starts selected
	 */
	public MenuController(int index) {
		mX = 0;
		mY = 0;
		mPlayerId = 0;
		Array<Controller> controllers = Controllers.getControllers();
		mController = controllers.size>0?controllers.get(0):null;
		mControllerFilter = 0;
		mFilteredKey = -42;
		mTable = null;
	}

	public void setIndex(int i) {
		int j = 0;
		Cell target = null;
		for (Cell c : mTable.getCells()) {
			if (j == i) {
				target = c;
				break;
			}
			j++;
		}
		if (target != null) {
			mX = target.getColumn();
			mY = target.getRow();
		}
	}

	public void setTable(Table t) {
		mTable = t;
		if (t != null) {
			for (Cell c : t.getCells()) {
				Actor a = (Actor) c.getWidget();
				if (a != null) {
					a.addListener(hoverListener);
				}
{'fraction_non_alphanumeric': 0.11167771545130036, 'fraction_numerical': 0.006969233384327724, 'mean_word_length': 3.8587943848059454, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, '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': '4140982', 'n_tokens_mistral': 2197, 'n_tokens_neox': 1984, 'n_words': 462}