<commit_before>package org.flymine.sql.query;

/**
 * A representation of a field in a table.
 *
 * @author <NAME>
 */
public class Field extends AbstractValue
{
    protected String name;
    protected Table table;

    /**
     * Constructor for this Field object.
     *
     * @param name the name of the field, as the database knows it
     * @param table the name of the table to which the field belongs, as the database knows it
     */
    public Field(String name, Table table) {
        if (name == null) {
            throw (new NullPointerException("Field names cannot be null"));
        }
        if (table == null) {
            throw (new NullPointerException("Cannot accept null values for table"));
        }
        this.name = name;
        this.table = table;
    }

    /**
     * Returns a String representation of this Field object, suitable for forming part of an SQL
     * query.
     *
     * @return the String representation
     */
    public String getSQLString() {
        String tableName = (table.getAlias() != null) ? table.getAlias() : table.getName();
        return tableName + "." + name;
    }

    /**
     * Overrides Object.equals().
     *
     * @param obj an Object to compare to
     * @return true if the object is of the same class, and with the same name
     */
    public boolean equals(Object obj) {
        if (obj instanceof Field) {
            Field objField = (Field) obj;
            return name.equals(objField.name)
                && table.equals(objField.table);
        }
        return false;
    }

    /**
     * Overrides Object.hashcode().
     *
     * @return an arbitrary integer based on the name of the Table
     */
    public int hashCode() {
        return name.hashCode() + table.hashCode();
    }

    /**
     * Compare this Field to another AbstractValue, including only the table alias.
     *
     * @param obj an AbstractField to compare to
     * @return true if the object is of the same class, and with the same value<commit_msg>Field contains an AbstractTable, not a Table<commit_after>package org.flymine.sql.query;

/**
 * A representation of a field in a table.
 *
 * @author <NAME>
 */
public class Field extends AbstractValue
{
    protected String name;
    protected AbstractTable table;

    /**
     * Constructor for this Field object.
     *
     * @param name the name of the field, as the database knows it
     * @param table the name of the AbstractTable to which the field belongs, as the database
     * knows it
     */
    public Field(String name, AbstractTable table) {
        if (name == null) {
            throw (new NullPointerException("Field names cannot be null"));
        }
        if (table == null) {
            throw (new NullPointerException("Cannot accept null values for table"));
        }
        this.name = name;
        this.table = table;
    }

    /**
     * Returns a String representation of this Field object, suitable for forming part of an SQL
     * query.
     *
     * @return the String representation
     */
    public String getSQLString() {
        return table.getAlias() + "." + name;
    }

    /**
     * Overrides Object.equals().
     *
     * @param obj an Object to compare to
     * @return true if the object is of the same class, and with the same name
     */
    public boolean equals(Object obj) {
        if (obj instanceof Field) {
            Field objField = (Field) obj;
            return name.equals(objField.name)
                && table.equals(objField.table);
        }
        return false;
    }

    /**
     * Overrides Object.hashcode().
     *
     * @return an arbitrary integer based on the contents of the Field
     */
    public int hashCode() {
        return name.hashCode() + table.hashCode();
    }

    /**
     * Compare this Field to another AbstractValue, including only the table alias.
     *
     * @param obj an AbstractField to compare to
     * @return true if the object is of the same class, and with the same value
{'fraction_non_alphanumeric': 0.09115815691158156, 'fraction_numerical': 0.0, 'mean_word_length': 2.0963762528912877, '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': '4635561', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1045, 'n_words': 425}