<commit_before>package de.ztube.yuno.entity;

import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Disposable;

import java.util.UUID;

/**
 * Created by ZTube on 18.07.2016.
 * Yuno
 */

/**Abstract class with base functionality for all Entities*/
public abstract class Entity extends Sprite implements Disposable, Comparable<Entity> {

    //The AssetManager used to load assets
    protected final AssetManager assets;

    //The players velocity used for movement
    private final Vector2 velocity;

    //The Unique Identification
    private final UUID uuid;

    //The current lifes
    private int lifes;

    //The movement speed
    private float speed = 60f * 1f;

    public Entity(AssetManager assets) {
        this.assets = assets;

        velocity = new Vector2(0, 0);

        //Generate a new random UUID
        uuid = UUID.randomUUID();
    }

    //Returns the Entity's lifes
    public final int getLifes() {
        return lifes;
    }

    //Returns the UUID
    public UUID getUUID() {
        return uuid;
    }

    //Sets the velocity in x direction
    protected void setVelocityX(float x) {
        velocity.set(x, velocity.y);
    }

    //Sets the velocity in y direction
    protected void setVelocityY(float y) {
        velocity.set(velocity.x, y);
    }

    //Sets the velocity
    protected void setVelocity(float x, float y) {
        velocity.set(x, y);
    }

    //Returns the velocity
    protected Vector2 getVelocity() {
        return velocity;
    }

    //Returns the current speed
    protected float getSpeed() {
        return speed;
    }

    //Compare to another Entity
    @Override
    public int compareTo(Entity entity) {
        //TODO: compare names instead of the UUID
        return uuid.compareTo(entity.getUUID());
    }

    @Override
    public boolean equals(Object obj) {
        //Two Entities are equal if the UUIDs are equal
        return uuid.equals(obj);
    }

    @Override
    public int hashCode() {
        //TODO: hash name
        return uuid.hashCode();
    }

    @Override
    public String toString() {
        //Returns the UUID
        //TODO: return name + uuid
        return uuid.toString();
    }
}
<commit_msg>Added names for entities and updated methods for comparing them<commit_after>package de.ztube.yuno.entity;

import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Disposable;

import java.util.UUID;

/**
 * Created by ZTube on 18.07.2016.
 * Yuno
 */

/**Abstract class with base functionality for all Entities*/
public abstract class Entity extends Sprite implements Disposable, Comparable<Entity> {

    //The AssetManager used to load assets
    protected final AssetManager assets;

    //The Entity's velocity used for movement
    private final Vector2 velocity;

    //The Unique Identification
    private final UUID uuid;

    //The current lifes
    private int lifes;

    //The movement speed
    private float speed = 60f * 1f;

    public Entity(AssetManager assets) {
        this.assets = assets;

        velocity = new Vector2(0, 0);

        //Generate a new random UUID
        uuid = UUID.randomUUID();
    }

    //Returns the Entity's lifes
    public final int getLifes() {
        return lifes;
    }

    //Returns the Entity's name based on the class name
    public String getName(){
        return getClass().getSimpleName();
    }

    //Returns the UUID
    public UUID getUUID() {
        return uuid;
    }

    //Sets the velocity in x direction
    protected void setVelocityX(float x) {
        velocity.set(x, velocity.y);
    }

    //Sets the velocity in y direction
    protected void setVelocityY(float y) {
        velocity.set(velocity.x, y);
    }

    //Sets the velocity
    protected void setVelocity(float x, float y) {
        velocity.set(x, y);
    }

    //Returns the velocity
    protected Vector2 getVelocity() {
        return velocity;
    }

    //Returns the current speed
    protected float getSpeed() {
        return speed;
    }

    //Compare to another Entity
    @Override
    public int compareTo(Entity entity) {
        return getName().compareTo(entity.getName()) + uuid.compareTo(entity.getUUID());
    }

    @Override
    public boolean equals(Object obj) {
        //Two Entities are equal if the names and UUIDs are equal
        return getName().equals(obj) && uuid.equals(obj);
    }

    @Override
    public int hashCode() {
        int tmpHash = 17;
        tmpHash = 31 * tmpHash + getName().hashCode();
        tmpHash = 31 * tmpHash + getUUID().hashCode();
        return tmpHash;
    }

    @Override
    public String toString() {
        //Returns the Name:UUID
        return String.format("%s:%s", getName(), uuid.toString());
    }
}

{'fraction_non_alphanumeric': 0.0940032414910859, 'fraction_numerical': 0.008508914100486223, 'mean_word_length': 2.3699658703071673, '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': '5513882', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1399, 'n_words': 462}