<commit_before>package io.resourcepool.hvsz.persistance.models;

import java.io.Serializable;

public class SafeZone implements ZoneResource, Serializable {
    private static final String NAME = "safe zone n°";
    private static final String TYPE = "safezone";
    private Integer id;
    private int resource;
    private int maxResource;
    private String name;
    private String type;

    /**
     * SafeZone Empty constructor.
     */
    public SafeZone() {
    }

    /**
     * SafeZone constructor.
     * @param id the id of the SafeZone
     * @param resource the amount of Resource at the start of the game
     * @param maxResource the max of Resource the zone can hold.
     */
    public SafeZone(int id, int resource, int maxResource) {
        this.id = id;
        this.resource = resource;
        this.maxResource = maxResource;
        name = NAME + id;
        type = TYPE;
    }


    public String getType() {
        return type;
    }


    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setResource(int resource) {
        this.resource = resource;
    }

    public int getMaxResource() {
        return this.maxResource;
    }

    public void setMaxResource(int maxResource) {
        this.maxResource = maxResource;
    }

    public void setName(String name) {
        this.name = name;
    }


    @Override
    public int getResource() {
        return resource;
    }

    @Override
    public String getName() {
        return name;
    }

    /**
     * Drop an amount of resource.
     * @param quantite amount of resource we want to drop
     * @return how many resource we have realy drop
     */
    public int drop(int quantite) {
        resource += quantite;
        if (resource > maxResource) {
            int over = resource - maxResource;
            resource = maxResource;
            return quantite - over;
        }
        return quantite;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {<commit_msg>[Fix] fix bug on invalid value<commit_after>package io.resourcepool.hvsz.persistance.models;

import java.io.Serializable;

public class SafeZone implements ZoneResource, Serializable {
    private static final String NAME = "safe zone n°";
    private static final String TYPE = "safezone";
    private Integer id;
    private int resource;
    private int maxResource;
    private String name;
    private String type;

    /**
     * SafeZone Empty constructor.
     */
    public SafeZone() {
    }

    /**
     * SafeZone constructor.
     * @param id the id of the SafeZone
     * @param resource the amount of Resource at the start of the game
     * @param maxResource the max of Resource the zone can hold.
     */
    public SafeZone(int id, int resource, int maxResource) {
        this.id = id;
        this.resource = resource;
        this.maxResource = maxResource;
        name = NAME + id;
        type = TYPE;
    }


    public String getType() {
        return type;
    }


    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setResource(int resource) {
        this.resource = resource;
    }

    public int getMaxResource() {
        return this.maxResource;
    }

    public void setMaxResource(int maxResource) {
        this.maxResource = maxResource;
    }

    public void setName(String name) {
        this.name = name;
    }


    @Override
    public int getResource() {
        return resource;
    }

    @Override
    public String getName() {
        return name;
    }

    /**
     * Drop an amount of resource.
     * @param quantite amount of resource we want to drop
     * @return how many resource we have realy drop
     */
    public int drop(int quantite) {
        if (quantite <= 0) {
            return 0;
        }
        resource += quantite;
        if (resource > maxResource) {
            int over = resource - maxResource;
            resource = maxResource;
            return quantite - over;
        }
        return quantite;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
{'fraction_non_alphanumeric': 0.08563036601897876, 'fraction_numerical': 0.00045187528242205153, 'mean_word_length': 1.9240422721268164, 'pattern_counts': {'":': 0, '<': 4, '<?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': '6989720', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1196, 'n_words': 412}