<commit_before>package com.vaguehope.onosendai.images;

import java.util.concurrent.Executor;

import android.app.Activity;
import android.graphics.Bitmap;

public final class ImageLoaderUtils {

	private ImageLoaderUtils () {
		throw new AssertionError();
	}

	public static ImageLoader fromActivity (final Activity activity) {
		if (!(activity instanceof ImageLoader)) throw new IllegalArgumentException("Activity is not an ImageLoader: " + activity);
		return (ImageLoader) activity;
	}

	public static void loadImage (final HybridBitmapCache cache, final ImageLoadRequest req) {
		loadImage(cache, req, null);
	}

	public static void loadImage (final HybridBitmapCache cache, final ImageLoadRequest req, final Executor exec) {
		final Bitmap bmp = cache.quickGet(req.getUrl());
		if (bmp != null) {
			req.setImageBitmap(bmp);
		}
		else {
			req.setImagePending();
			final ImageFetcherTask task = new ImageFetcherTask(cache);
			// TODO if this becomes multi-threaded, need to lock in each unique URL to avoid duplicate downloads.
			if (exec != null) {
				task.executeOnExecutor(exec, req);
			}
			else {
				task.execute(req);
			}
		}
	}

}<commit_msg>Update TODO comments.<commit_after>package com.vaguehope.onosendai.images;

import java.util.concurrent.Executor;

import android.app.Activity;
import android.graphics.Bitmap;

public final class ImageLoaderUtils {

	private ImageLoaderUtils () {
		throw new AssertionError();
	}

	public static ImageLoader fromActivity (final Activity activity) {
		if (!(activity instanceof ImageLoader)) throw new IllegalArgumentException("Activity is not an ImageLoader: " + activity);
		return (ImageLoader) activity;
	}

	public static void loadImage (final HybridBitmapCache cache, final ImageLoadRequest req) {
		loadImage(cache, req, null);
	}

	public static void loadImage (final HybridBitmapCache cache, final ImageLoadRequest req, final Executor exec) {
		final Bitmap bmp = cache.quickGet(req.getUrl());
		if (bmp != null) {
			req.setImageBitmap(bmp);
		}
		else {
			req.setImagePending();
			final ImageFetcherTask task = new ImageFetcherTask(cache);
			if (exec != null) {
				// TODO Need to lock in each unique URL to avoid duplicate downloads.
				task.executeOnExecutor(exec, req);
			}
			else {
				task.execute(req);
			}
		}
	}

}
{'fraction_non_alphanumeric': 0.09596178897090751, 'fraction_numerical': 0.0, 'mean_word_length': 4.383177570093458, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2561340', 'n_tokens_mistral': 740, 'n_tokens_neox': 663, 'n_words': 204}