<commit_before>package com.zenplanner.sql;

import com.google.common.base.Joiner;

import java.util.ArrayList;

public class Key extends ArrayList<Comparable> implements Comparable {

    @Override
    public int hashCode() {
        int hash = 0;
        for(Object o : this) {
            if(o == null) {
                continue;
            }
            hash += o.hashCode();
        }
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Key == false) {
            return false;
        }
        int eq = this.compareTo(obj);
        return eq == 0;
    }

    @Override
    public int compareTo(Object o) {
        if(o == null) {
            return -1; // null means we've went past the end of the ResultSet, and should be treated as INFINITY
        }
        if(o instanceof Key == false) {
            return -1;
        }
        Key other = (Key)o;
        int len = Math.max(this.size(), other.size());
        for(int i = 0; i < len; i++) {
            Comparable thisVal = i < this.size() ? this.get(i) : null;
            Comparable otherVal = i < other.size() ? other.get(i) : null;
            if(thisVal == null && otherVal == null) {
                continue;
            }
            if(otherVal == null) {
                return 1;
            }
            if(thisVal == null) {
                return -1;
            }
            int val = thisVal.compareTo(otherVal);
            if(val == 0) {
                continue;
            }
            return val;
        }
        return 0;
    }

    @Override
    public String toString() {
        return "[" + Joiner.on(",").join(this) + "]";
    }

    public static int compare(Key left, Key right) {
        if(left == null && right == null) {
            return 0;
        }
        if(left == null) {
            return -1;
        }
        return left.compareTo(right);
    }
}
<commit_msg>Switched key comparator to work correctly with UUIDs<commit_after>package com.zenplanner.sql;

import com.google.common.base.Joiner;

import java.util.ArrayList;
import java.util.UUID;

public class Key extends ArrayList<Comparable> implements Comparable {

    @Override
    public int hashCode() {
        int hash = 0;
        for(Object o : this) {
            if(o == null) {
                continue;
            }
            hash += o.hashCode();
        }
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Key == false) {
            return false;
        }
        int eq = this.compareTo(obj);
        return eq == 0;
    }

    @Override
    public int compareTo(Object o) {
        if(o == null) {
            return -1; // null means we've went past the end of the ResultSet, and should be treated as INFINITY
        }
        if(o instanceof Key == false) {
            return -1;
        }
        Key other = (Key)o;
        int len = Math.max(this.size(), other.size());
        for(int i = 0; i < len; i++) {
            Comparable thisVal = i < this.size() ? this.get(i) : null;
            Comparable otherVal = i < other.size() ? other.get(i) : null;
            if(thisVal == null && otherVal == null) {
                continue;
            }
            if(otherVal == null) {
                return 1;
            }
            if(thisVal == null) {
                return -1;
            }
            int val;
            if(thisVal instanceof UUID && otherVal instanceof UUID) {
                val = UuidUtil.sqlUuidCompare((UUID)thisVal, (UUID)otherVal);
            } else {
                val = thisVal.compareTo(otherVal);
            }
            if(val == 0) {
                continue;
            }
            return val;
        }
        return 0;
    }

    @Override
    public String toString() {
        return "[" + Joiner.on(",").join(this) + "]";
    }

    public static int compare(Key left, Key right) {
        if(left == null && right == null) {
            return 0;
        }
        if(left == null) {
            return -1;
        }
        return left.compareTo(right);
    }
}

{'fraction_non_alphanumeric': 0.11573849878934625, 'fraction_numerical': 0.005326876513317191, 'mean_word_length': 1.3796082949308757, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2754159', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1172, 'n_words': 322}