<commit_before>package com.ezardlabs.dethsquare;

/**
 * Representation of 2D vectors and points
 */
public final class Vector2 {
	public float x;
	public float y;

	/**
	 * Shorthand for writing Vector2(0, 0)
	 */
	public Vector2() {
	}

	/**
	 * Creates a new vector with the given x and y components
	 */
	public Vector2(float x, float y) {
		this.x = x;
		this.y = y;
	}

	/**
	 * Creates a new vector that has the same x and y values as the source vector
	 */
	public Vector2(Vector2 source) {
		this.x = source.x;
		this.y = source.y;
	}

	/**
	 * Sets the x and y components of the vector
	 *
	 * @param x the new x component
	 * @param y the new y component
	 */
	public void set(float x, float y) {
		if (listener != null) listener.onVector2Changed(x - this.x, y - this.y);
		this.x = x;
		this.y = y;
	}

	/**
	 * Returns a new {@link Vector2} that has been offset by the given parameters
	 * @param x The amount to offset the x coordinate by
	 * @param y The amount to offset the y coordinate by
	 * @return The offset {@link Vector2}
	 */
	public Vector2 offset(float x, float y) {
		return new Vector2(this.x + x, this.y + y);
	}

	/**
	 * Calculates the distance between 2 vector points
	 * @param a the first point
	 * @param b the second point
	 * @return The distance between the 2 points
	 */
	public static double distance(Vector2 a, Vector2 b) {
		return Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));
	}

	@Override
	public String toString() {
		return "Vector2(" + x + ", " + y + ")";
	}

	@Override
	public boolean equals(Object o) {
		return o instanceof Vector2 && ((Vector2) o).x == x && ((Vector2) o).y == y;
	}

	private Vector2ChangeListener listener;

	void setVector2ChangeListener(Vector2ChangeListener listener) {
		this.listener = listener;
	}

	interface Vector2ChangeListener {
		void onVector2Changed(float xDiff, float yDiff);
	}
}<commit_msg>Move field to top of file<commit_after>package com.ezardlabs.dethsquare;

/**
 * Representation of 2D vectors and points
 */
public final class Vector2 {
	public float x;
	public float y;
	private Vector2ChangeListener listener;

	/**
	 * Shorthand for writing Vector2(0, 0)
	 */
	public Vector2() {
	}

	/**
	 * Creates a new vector with the given x and y components
	 */
	public Vector2(float x, float y) {
		this.x = x;
		this.y = y;
	}

	/**
	 * Creates a new vector that has the same x and y values as the source vector
	 */
	public Vector2(Vector2 source) {
		this.x = source.x;
		this.y = source.y;
	}

	/**
	 * Sets the x and y components of the vector
	 *
	 * @param x the new x component
	 * @param y the new y component
	 */
	public void set(float x, float y) {
		if (listener != null) listener.onVector2Changed(x - this.x, y - this.y);
		this.x = x;
		this.y = y;
	}

	/**
	 * Returns a new {@link Vector2} that has been offset by the given parameters
	 * @param x The amount to offset the x coordinate by
	 * @param y The amount to offset the y coordinate by
	 * @return The offset {@link Vector2}
	 */
	public Vector2 offset(float x, float y) {
		return new Vector2(this.x + x, this.y + y);
	}

	/**
	 * Calculates the distance between 2 vector points
	 * @param a the first point
	 * @param b the second point
	 * @return The distance between the 2 points
	 */
	public static double distance(Vector2 a, Vector2 b) {
		return Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));
	}

	@Override
	public String toString() {
		return "Vector2(" + x + ", " + y + ")";
	}

	@Override
	public boolean equals(Object o) {
		return o instanceof Vector2 && ((Vector2) o).x == x && ((Vector2) o).y == y;
	}

	void setVector2ChangeListener(Vector2ChangeListener listener) {
		this.listener = listener;
	}

	interface Vector2ChangeListener {
		void onVector2Changed(float xDiff, float yDiff);
	}
}
{'fraction_non_alphanumeric': 0.11739931560937089, 'fraction_numerical': 0.015267175572519083, 'mean_word_length': 3.064171122994652, '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': '3102563', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1244, 'n_words': 469}