<commit_before>package com.jenjinstudios.world;

import com.jenjinstudios.world.math.Vector2D;

/**
 * Represents an object that exists in the game world.
 * @author <NAME>
 */
public class WorldObject
{
	/** The name of this actor. */
	private final String name;
	/** The zoneID in which this actor is located. */
	private int zoneID;
	/** The vector2D in the world at which the object is located. */
	private Vector2D vector2D;
	/** The relativeAngle in which this object is facing. */
	private double absoluteAngle;
	/** The ID number of this object. */
	private int id = Integer.MIN_VALUE;
	/** The world in which this object exists. */
	private World world;
	/** The location in which this object is residing. */
	private Location location;
	/** The resource ID number for this object. */
	private int resourceID;


	/**
	 * Construct a new WorldObject.
	 * @param name The name of this object.
	 */
	public WorldObject(String name) {
		vector2D = new Vector2D(0, 0);
		this.name = name;
	}

	/**
	 * Get the relativeAngle in which this object is facing, in radians.
	 * @return The relativeAngle in which this object is facing.
	 */
	public double getAbsoluteAngle() { return absoluteAngle; }

	/**
	 * Set the relativeAngle in which this object is facing.
	 * @param absoluteAngle The new relativeAngle for this object to face.
	 */
	public void setAbsoluteAngle(double absoluteAngle) { this.absoluteAngle = absoluteAngle; }

	/**
	 * Get this object's current position.
	 * @return This object's current position.
	 */
	public Vector2D getVector2D() { return new Vector2D(vector2D); }

	/**
	 * Set this object's current position.
	 * @param vector2D The new position.
	 */
	public void setVector2D(Vector2D vector2D) {
		this.vector2D = new Vector2D(vector2D);

		if (world != null)
		{
			Location newLocation = world.getLocationForCoordinates(this.zoneID, this.vector2D);
			setLocation(newLocation);
		}
	}

	/**
	 * Get the resourceID for this object.
	 * @return The resourceID for this object.
	 */
	public int getResourceID() { return resourceID; }

	/**
	 * Set the resourceID for this object.
	 * @param resourceID The resourceID for this object.
	 */
	public void setResourceID(int resourceID) { this.resourceID = resourceID; }

	/**
	 * Get this object's ID number.
	 * @return This object's ID number.
	 */
	public int getId() { return id; }

	/**
	 * Set this object's ID number if it has not already been set.
	 * @param id The new ID number.
	 */
	public void setId(int id) { this.id = id; }

	/**
	 * Get this object's location.
	 * @return This object's location.
	 */
	public Location getLocation() { return location; }

	/**
	 * Set this objects new location.
	 * @param newLocation The new location.
	 */
	protected void setLocation(Location newLocation) {<commit_msg>Added equals and hashcode methods<commit_after>package com.jenjinstudios.world;

import com.jenjinstudios.world.math.Vector2D;

/**
 * Represents an object that exists in the game world.
 * @author <NAME>
 */
public class WorldObject
{
	/** The name of this actor. */
	private final String name;
	/** The zoneID in which this actor is located. */
	private int zoneID;
	/** The vector2D in the world at which the object is located. */
	private Vector2D vector2D;
	/** The relativeAngle in which this object is facing. */
	private double absoluteAngle;
	/** The ID number of this object. */
	private int id = Integer.MIN_VALUE;
	/** The world in which this object exists. */
	private World world;
	/** The location in which this object is residing. */
	private Location location;
	/** The resource ID number for this object. */
	private int resourceID;


	/**
	 * Construct a new WorldObject.
	 * @param name The name of this object.
	 */
	public WorldObject(String name) {
		vector2D = new Vector2D(0, 0);
		this.name = name;
	}

	/**
	 * Get the relativeAngle in which this object is facing, in radians.
	 * @return The relativeAngle in which this object is facing.
	 */
	public double getAbsoluteAngle() { return absoluteAngle; }

	/**
	 * Set the relativeAngle in which this object is facing.
	 * @param absoluteAngle The new relativeAngle for this object to face.
	 */
	public void setAbsoluteAngle(double absoluteAngle) { this.absoluteAngle = absoluteAngle; }

	/**
	 * Get this object's current position.
	 * @return This object's current position.
	 */
	public Vector2D getVector2D() { return new Vector2D(vector2D); }

	/**
	 * Set this object's current position.
	 * @param vector2D The new position.
	 */
	public void setVector2D(Vector2D vector2D) {
		this.vector2D = new Vector2D(vector2D);

		if (world != null)
		{
			Location newLocation = world.getLocationForCoordinates(this.zoneID, this.vector2D);
			setLocation(newLocation);
		}
	}

	/**
	 * Get the resourceID for this object.
	 * @return The resourceID for this object.
	 */
	public int getResourceID() { return resourceID; }

	/**
	 * Set the resourceID for this object.
	 * @param resourceID The resourceID for this object.
	 */
	public void setResourceID(int resourceID) { this.resourceID = resourceID; }

	/**
	 * Get this object's ID number.
	 * @return This object's ID number.
	 */
	public int getId() { return id; }

	/**
	 * Set this object's ID number if it has not already been set.
	 * @param id The new ID number.
	 */
	public void setId(int id) { this.id = id; }

	/**
	 * Get this object's location.
	 * @return This object's location.
	 */
	public Location getLocation() { return location; }

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (!(o instanceof WorldObject)) return false;

		WorldObject that = (WorldObject) o;

		return id == that.id && name.equals(that.name);

	}

	@Override
	public int hashCode() {
		int result = name.hashCode();
		result = 31 * result + id;
		return result;
	}

	/**
	 * Set this objects new location.
	 * @param newLocation The new location.
	 */
	protected void setLocation(Location newLocation) {
{'fraction_non_alphanumeric': 0.10467069892473119, 'fraction_numerical': 0.007056451612903226, 'mean_word_length': 3.361172161172161, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1465315', 'n_tokens_mistral': 1865, 'n_tokens_neox': 1718, 'n_words': 675}