<commit_before>package com.badlogic.gdx.ingenuity.utils;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.ingenuity.GdxData;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Align;

public enum GdxUtil {
	;

	@SuppressWarnings("unchecked")
	public static <T extends ApplicationListener> T getAppGame() {
		return (T) Gdx.app.getApplicationListener();
	}

	public static Rectangle getTextBounds(String text, BitmapFont bitmapFont) {
		GlyphLayout glyphLayout = new GlyphLayout();
		glyphLayout.setText(bitmapFont, text);
		return new Rectangle().setSize(glyphLayout.width, glyphLayout.height);
	}

	public static Rectangle getWarppedTextBounds(String text, float wrapWidth, BitmapFont bitmapFont) {
		GlyphLayout glyphLayout = new GlyphLayout();
		glyphLayout.setText(bitmapFont, text, bitmapFont.getColor(), wrapWidth, Align.left, true);
		return new Rectangle().setSize(glyphLayout.width, glyphLayout.height);
	}

	public static void center(Actor actor, boolean horizontal) {
		if (horizontal) {
			float wd = GdxData.WIDTH - actor.getWidth();
			actor.setX(wd / 2);
		} else {
			float ht = GdxData.HEIGHT - actor.getHeight();
			actor.setY(ht / 2);
		}
	}

	public static void center(Actor actor) {
		float wd = GdxData.WIDTH - actor.getWidth();
		float ht = GdxData.HEIGHT - actor.getHeight();
		actor.setPosition(wd / 2, ht / 2);
	}

	public static void center(Actor staticActhor, Actor actor) {
		actor.setPosition(staticActhor.getX() + (staticActhor.getWidth() - actor.getWidth()) / 2, staticActhor.getY() + (staticActhor.getHeight() - actor.getHeight()) / 2);
	}

	public static void replace(Actor oldActor, Actor newActor) {
		if (oldActor != null && oldActor.getParent() != null) {
			newActor.setBounds(oldActor.getX(), oldActor.getY(), oldActor.getWidth(), oldActor.getHeight());
			oldActor.getParent().addActorBefore(oldActor, newActor);
			oldActor.remove();
		}
	}

}<commit_msg>update GdxUtils.javav<commit_after>package com.badlogic.gdx.ingenuity.utils;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.ingenuity.GdxData;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Align;

public enum GdxUtil {
	;

	@SuppressWarnings("unchecked")
	public static <T extends ApplicationListener> T getAppGame() {
		return (T) Gdx.app.getApplicationListener();
	}

	public static Rectangle getTextBounds(String text, BitmapFont bitmapFont) {
		GlyphLayout glyphLayout = new GlyphLayout();
		glyphLayout.setText(bitmapFont, text);
		return new Rectangle().setSize(glyphLayout.width, glyphLayout.height);
	}

	public static Rectangle getWarppedTextBounds(String text, float wrapWidth, BitmapFont bitmapFont) {
		GlyphLayout glyphLayout = new GlyphLayout();
		glyphLayout.setText(bitmapFont, text, bitmapFont.getColor(), wrapWidth, Align.left, true);
		return new Rectangle().setSize(glyphLayout.width, glyphLayout.height);
	}

	public static <T extends Actor> T center(T actor, boolean horizontal) {
		if (horizontal) {
			float wd = GdxData.WIDTH - actor.getWidth();
			actor.setX(wd / 2);
		} else {
			float ht = GdxData.HEIGHT - actor.getHeight();
			actor.setY(ht / 2);
		}
		return actor;
	}

	public static <T extends Actor> T center(T actor) {
		float wd = GdxData.WIDTH - actor.getWidth();
		float ht = GdxData.HEIGHT - actor.getHeight();
		actor.setPosition(wd / 2, ht / 2);
		return actor;
	}

	public static void center(Actor staticActhor, Actor actor) {
		actor.setPosition(staticActhor.getX() + (staticActhor.getWidth() - actor.getWidth()) / 2, staticActhor.getY() + (staticActhor.getHeight() - actor.getHeight()) / 2);
	}

	public static void replace(Actor oldActor, Actor newActor) {
		if (oldActor != null && oldActor.getParent() != null) {
			newActor.setBounds(oldActor.getX(), oldActor.getY(), oldActor.getWidth(), oldActor.getHeight());
			oldActor.getParent().addActorBefore(oldActor, newActor);
			oldActor.remove();
		}
	}

}
{'fraction_non_alphanumeric': 0.12861811391223155, 'fraction_numerical': 0.004201680672268907, 'mean_word_length': 4.861833105335157, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7316626', 'n_tokens_mistral': 1551, 'n_tokens_neox': 1425, 'n_words': 301}