<commit_before>package com.hida.model;

import java.util.Arrays;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * A Pid (persistent identifier) is an object that is used to hold a unique
 * sequence of characters to reference other objects in a given domain.
 *
 * @author lruffin
 */
@Entity
@Table(name = "PIDS")
public class Pid implements Comparable<Pid> {

    @Id
    @Column(name = "NAME", updatable = false, nullable = false)
    protected String Name;

    @Transient
    protected int[] BaseMap;

    @Transient
    protected String Prefix;

    /**
     * A no-arg constructor to be used by Hibernate
     */
    public Pid() {
    }

    /**
     * Copy constructor; primarily used to copy values of the BaseMap from one
     * Id to another.
     *
     * @param id The Id to copy from.
     */
    public Pid(Pid id) {
        this.Prefix = id.Prefix;
        this.BaseMap = Arrays.copyOf(id.getBaseMap(), id.getBaseMap().length);
        this.Name = id.Name;
    }

    /**
     * Recommended, default constructor
     *
     * @param baseMap An array of integers that contain the indices described by
     * tokenMap
     * @param Prefix A sequence of characters that appear in the beginning of
     * PIDs
     */
    public Pid(int[] baseMap, String Prefix) {
        this.BaseMap = Arrays.copyOf(baseMap, baseMap.length);
        this.Prefix = Prefix;
    }

    @Override
    public int hashCode() {
        // arbitrarily chosen prime numbers
        final int prime1 = 37;
        final int prime2 = 257;

        int hash = prime1 * prime2 + Arrays.hashCode(this.BaseMap);
        return hash;
    }

    /**
     * Overridden so that id's can be identified solely by its baseName.
     *
     * @param obj the Object this id is being compared to
     * @return true if the two Objects are the same.
     */
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Pid)) {
            return false;
        }
        final Pid paramId = (Pid) obj;

        return Arrays.equals(this.BaseMap, paramId.BaseMap);
    }

    /**
     * Used to define the natural ordering of how id's should be listed. When
     * invoked, the two id's will be compared by their Names.
     *
     * @param t second Pid being compared.
     * @return ordering is as follows: [0-9] < [a-z] < [A-Z]
     */
    @Override
    public int compareTo(Pid t) {
        String name1 = this.Name;
        String name2 = t.Name;
        if (name1.length() < name2.length()) {
            return -1;
        }
        else if (name1.length() > name2.length()) {
            return 1;
        }
        else {
            for (int i = 0; i < name1.length(); i++) {
                char c1 = name1.charAt(i);
                char c2 = name2.charAt(i);
                if ((Character.isDigit(c1) && Character.isLetter(c2))
                        || (Character.isLowerCase(c1) && Character.isUpperCase(c2))) {
                    return -1;
                }
                else if ((Character.isLetter(c1) && Character.isDigit(c2))
                        || (Character.isUpperCase(c1) && Character.isLowerCase(c2))) {
                    return 1;
                }
                else if (c1 < c2) {
                    return -1;
                }
                else if (c1 > c2) {
                    return 1;
                }
            }
            return 0;
        }
    }

    /* getters and setters */
    public String getName() {
        return Name;
    }

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

    /**
     * The BaseMap is the numerical representation of this Pid's name. Used in
     * conjunction with TokenMap to return the string representation of this
     * id's name in its toString method.
     *
     * @return The array used to create the name
     */
    public int[] getBaseMap() {
        return BaseMap;
    }

    /**
     * The BaseMap is the numerical representation of this Pid's name. Used in
     * conjunction with TokenMap to return the string representation of this
     * id's name in its toString method.
     *
     * Be warned that the array must have a unique address for it to work with
     * Sets. The length of the array must be equal to TokenMap, otherwise an
     * IndexOutOfBounds error will be thrown in the getRootName method.
     *
     * @param baseMap The new array to replace the name.
     */
    public void setBaseMap(int[] baseMap) {
        this.BaseMap = baseMap;
    }

    public String getPrefix() {
        return Prefix;
    }

    public void setPrefix(String Prefix) {
        this.Prefix = Prefix;
    }
}
<commit_msg>Remove BaseMap and Prefix fields<commit_after>package com.hida.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * A Pid (persistent identifier) is an object that is used to hold a unique
 * sequence of characters to reference other objects in a given domain.
 *
 * @author lruffin
 */
@Entity
@Table(name = "PIDS")
public class Pid implements Comparable<Pid> {

    @Id
    @Column(name = "NAME", updatable = false, nullable = false)
    private String Name;

    /**
     * A no-arg constructor to be used by Hibernate
     */
    public Pid() {
    }

    public Pid(String Name) {
        this.Name = Name;
    }

    /**
     * Copy constructor; primarily used to copy values of the BaseMap from one
     * Id to another.
     *
     * @param id The Id to copy from.
     */
    public Pid(Pid id) {        
        this.Name = id.Name;
    }

    /**
     * Used to define the natural ordering of how id's should be listed. When
     * invoked, the two id's will be compared by their Names.
     *
     * @param t second Pid being compared.
     * @return ordering is as follows: [0-9] < [a-z] < [A-Z]
     */
    @Override
    public int compareTo(Pid t) {
        String name1 = this.Name;
        String name2 = t.Name;
        if (name1.length() < name2.length()) {
            return -1;
        }
        else if (name1.length() > name2.length()) {
            return 1;
        }
        else {
            for (int i = 0; i < name1.length(); i++) {
                char c1 = name1.charAt(i);
                char c2 = name2.charAt(i);
                if ((Character.isDigit(c1) && Character.isLetter(c2))
                        || (Character.isLowerCase(c1) && Character.isUpperCase(c2))) {
                    return -1;
                }
                else if ((Character.isLetter(c1) && Character.isDigit(c2))
                        || (Character.isUpperCase(c1) && Character.isLowerCase(c2))) {
                    return 1;
                }
                else if (c1 < c2) {
                    return -1;
                }
                else if (c1 > c2) {
                    return 1;
                }
            }
            return 0;
        }
    }

    /**
     * Updates this Pid's name by replacing a character located at index i with
     * character c.
     *
     * @param i index
     * @param c character
     */
    public void replace(int i, char c) {
        String newName = "";

        for (int j = 0; j < Name.length(); j++) {
            if (j == i) {
                newName += c;
            }
            else {
                newName += Name.charAt(j);
            }
        }

        Name = newName;
    }

    /* getters and setters */
    public String getName() {
        return Name;
    }

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

{'fraction_non_alphanumeric': 0.10051612903225807, 'fraction_numerical': 0.009806451612903225, 'mean_word_length': 1.6644895152973531, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 9, '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': '6191816', 'n_tokens_mistral': 2312, 'n_tokens_neox': 2224, 'n_words': 736}