<commit_before>package com.alexstyl.specialdates.contact;

import android.content.ContentResolver;
import android.database.Cursor;
import android.provider.ContactsContract;

import com.alexstyl.specialdates.DisplayName;

class DeviceContactFactory {

    private final ContentResolver resolver;

    DeviceContactFactory(ContentResolver contentResolver) {
        resolver = contentResolver;
    }

    DeviceContact createContactWithId(long contactID) throws ContactNotFoundException {
        String selection = ContactsContract.Data.CONTACT_ID + " = " + contactID + " AND " + ContactsContract.Data.MIMETYPE + " = ?";

        Cursor cursor = resolver.query(ContactsQuery.CONTENT_URI, ContactsQuery.PROJECTION, selection, new String[]{
                ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE
        }, ContactsQuery.SORT_ORDER + " LIMIT 1");
        if (isInvalid(cursor)) {
            throw new RuntimeException("Cursor was invalid");
        }

        try {
            if (cursor.moveToFirst()) {
                DisplayName displayName = getDisplayNameFrom(cursor);
                String lookupKey = getLookupKeyFrom(cursor);
                return new DeviceContact(contactID, displayName, lookupKey);
            }
        } finally {
            cursor.close();
        }
        throw new ContactNotFoundException(contactID);
    }

    private boolean isInvalid(Cursor cursor) {
        return cursor == null || cursor.isClosed();
    }

    private String getLookupKeyFrom(Cursor cursor) {
        return cursor.getString(ContactsQuery.LOOKUP_KEY);
    }

    private DisplayName getDisplayNameFrom(Cursor cursor) {
        return DisplayName.from(cursor.getString(ContactsQuery.DISPLAY_NAME));
    }

}<commit_msg>Set methods that don't use any fields as static<commit_after>package com.alexstyl.specialdates.contact;

import android.content.ContentResolver;
import android.database.Cursor;
import android.provider.ContactsContract;

import com.alexstyl.specialdates.DisplayName;

class DeviceContactFactory {

    private final ContentResolver resolver;

    DeviceContactFactory(ContentResolver contentResolver) {
        resolver = contentResolver;
    }

    DeviceContact createContactWithId(long contactID) throws ContactNotFoundException {
        String selection = ContactsContract.Data.CONTACT_ID + " = " + contactID + " AND " + ContactsContract.Data.MIMETYPE + " = ?";

        Cursor cursor = resolver.query(ContactsQuery.CONTENT_URI, ContactsQuery.PROJECTION, selection, new String[]{
                ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE
        }, ContactsQuery.SORT_ORDER + " LIMIT 1");
        if (isInvalid(cursor)) {
            throw new RuntimeException("Cursor was invalid");
        }

        try {
            if (cursor.moveToFirst()) {
                DisplayName displayName = getDisplayNameFrom(cursor);
                String lookupKey = getLookupKeyFrom(cursor);
                return new DeviceContact(contactID, displayName, lookupKey);
            }
        } finally {
            cursor.close();
        }
        throw new ContactNotFoundException(contactID);
    }

    private static boolean isInvalid(Cursor cursor) {
        return cursor == null || cursor.isClosed();
    }

    private static DisplayName getDisplayNameFrom(Cursor cursor) {
        return DisplayName.from(cursor.getString(ContactsQuery.DISPLAY_NAME));
    }

    private static String getLookupKeyFrom(Cursor cursor) {
        return cursor.getString(ContactsQuery.LOOKUP_KEY);
    }

}
{'fraction_non_alphanumeric': 0.08433734939759036, 'fraction_numerical': 0.0005603810591202018, 'mean_word_length': 3.0660592255125283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4233513', 'n_tokens_mistral': 940, 'n_tokens_neox': 903, 'n_words': 187}