<commit_before>package com.escapeindustries.numericdisplay;

import java.util.Calendar;
import java.util.GregorianCalendar;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;
import android.view.SurfaceHolder;

public class SurfaceGridRendererThread extends Thread {

	private static final int TRANSITION_LIMIT = 300;
	private static final int LIGHTENING = 2;
	private static final int DIMMING = 1;
	private static final int LIT = 3;
	private static final int DIM = 0;
	private boolean running;
	private SurfaceHolder holder;
	private Context context;
	private ModelGrid grid;
	private int litColor;
	private int dimColor;
	private int rows = 13;
	private int columns = 7;
	private int[][] coordsX;
	private int[][] coordsY;
	private int radius = 4;
	private int space = 2;

	private int lastSeconds = -1;
	private int fps = 0;
	private Paint[] paints = new Paint[4];
	private long sinceSecond;

	private static String TAG = "NumericalDisplay";
	private int alphaRange;
	private int redRange;
	private int blueRange;
	private int greenRange;
	private int litAlpha;
	private int dimAlpha;
	private int litRed;
	private int dimRed;
	private int litBlue;
	private int dimBlue;
	private int litGreen;
	private int dimGreen;

	public SurfaceGridRendererThread(SurfaceHolder holder, Context context,
			ModelGrid grid) {
		this.holder = holder;
		this.context = context;
		this.grid = grid;
		setupColors();
		this.columns = grid.getColumns();
		this.rows = grid.getRows();
		initCoords();
	}

	@Override
	public void run() {
		while (running) {
			updatePaints();
			Canvas canvas = null;
			try {
				canvas = holder.lockCanvas();
				if (canvas != null) {
					synchronized (holder) {
						canvas.drawColor(Color.BLACK);
						for (int row = 0; row < rows; row++) {
							for (int column = 0; column < columns; column++) {
								canvas.drawCircle(coordsX[row][column],
										coordsY[row][column], radius,
										paints[grid.getDotState(column, row)]);
							}
						}
					}
					logFPS();
					if (sinceSecond >= TRANSITION_LIMIT && grid.getTransitionsActive() == true) {
						grid.clearTransitionState();
					}
				}
			} finally {
				if (canvas != null) {
					holder.unlockCanvasAndPost(canvas);
				}
			}
		}
	}

	private long getStartOfSecond(Calendar now) {
		Calendar from = GregorianCalendar.getInstance();
		from.set(now.get(Calendar.YEAR), now.get(Calendar.MONTH),<commit_msg>Small code clean-up<commit_after>package com.escapeindustries.numericdisplay;

import java.util.Calendar;
import java.util.GregorianCalendar;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;
import android.view.SurfaceHolder;

public class SurfaceGridRendererThread extends Thread {

	private static final int TRANSITION_LIMIT = 300;
	private static final int LIGHTENING = 2;
	private static final int DIMMING = 1;
	private static final int LIT = 3;
	private static final int DIM = 0;
	private boolean running;
	private SurfaceHolder holder;
	private Context context;
	private ModelGrid grid;
	private int litColor;
	private int dimColor;
	private int rows = 13;
	private int columns = 7;
	private int[][] coordsX;
	private int[][] coordsY;
	private int radius = 4;
	private int space = 2;

	private int lastSeconds = -1;
	private int fps = 0;
	private Paint[] paints = new Paint[4];
	private long sinceSecond;

	private static String TAG = "NumericalDisplay";
	private int alphaRange;
	private int redRange;
	private int blueRange;
	private int greenRange;
	private int litAlpha;
	private int dimAlpha;
	private int litRed;
	private int dimRed;
	private int litBlue;
	private int dimBlue;
	private int litGreen;
	private int dimGreen;

	public SurfaceGridRendererThread(SurfaceHolder holder, Context context,
			ModelGrid grid) {
		this.holder = holder;
		this.context = context;
		this.grid = grid;
		setupColors();
		this.columns = grid.getColumns();
		this.rows = grid.getRows();
		initCoords();
	}

	@Override
	public void run() {
		while (running) {
			Canvas canvas = null;
			try {
				canvas = holder.lockCanvas();
				if (canvas != null) {
					synchronized (holder) {
						drawFull(canvas);
					}
				}
			} finally {
				if (canvas != null) {
					holder.unlockCanvasAndPost(canvas);
				}
			}
		}
	}

	private void drawFull(Canvas canvas) {
		updatePaints();
		canvas.drawColor(Color.BLACK);
		for (int row = 0; row < rows; row++) {
			for (int column = 0; column < columns; column++) {
				canvas.drawCircle(coordsX[row][column],
						coordsY[row][column], radius,
						paints[grid.getDotState(column, row)]);
			}
		}
		logFPS();
		if (sinceSecond >= TRANSITION_LIMIT && grid.getTransitionsActive() == true) {
			grid.clearTransitionState();
		}
	}

	private long getStartOfSecond(Calendar now) {
		Calendar from = GregorianCalendar.getInstance();
		from.set(now.get(Calendar.YEAR), now.get(Calendar.MONTH),
{'fraction_non_alphanumeric': 0.10296163784535878, 'fraction_numerical': 0.006758099781355596, 'mean_word_length': 3.8997078870496593, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6276123', 'n_tokens_mistral': 1805, 'n_tokens_neox': 1545, 'n_words': 462}