<commit_before>//
// $Id: ResultListener.java,v 1.1 2002/03/20 07:07:48 mdb Exp $

package com.samskivert.util;

/**
 * Provides access to a future result, or the exception associated with
 * failure. In the trying course of implementing a method, one is often
 * left with no choice but to foist control off onto another thread or
 * generally postpone things beyond the lifetime of the current call. In
 * such circumstances, it is handy to have a general purpose mechanism for
 * leting the caller know when things are done and whether or not the
 * succeeded; this class serves that purpose.
 *
 * <p> The following contrived example will hopefully communicate its use
 * more clearly than the previous paragraph of flowery prose:
 *
 * <pre>
 * public void doSomeStuff (ResultListener<String> listener)
 * {
 *     Runnable run = new Runnable () {
 *         public void run () {
 *             try {
 *                 // do our thing
 *                 listener.requestCompleted("Elvis!");
 *             } catch (Exception e) {
 *                 listener.requestFailed(e);
 *             }
 *         }
 *     };
 *     new Thread(run).start();
 * }
 * </pre>
 *
 * @see IntResultListener
 */
public interface ResultListener<T>
{
    /**
     * Called to communicate that the request succeeded and that the
     * result is available.
     */
    public void requestCompleted (T result);

    /**
     * Called to communicate that the request failed and to provide the
     * reason for failure.
     */
    public void requestFailed (Exception cause);
}<commit_msg>Add the NOOP back but deprecate it.<commit_after>//
// $Id: ResultListener.java,v 1.1 2002/03/20 07:07:48 mdb Exp $

package com.samskivert.util;

/**
 * Provides access to a future result, or the exception associated with
 * failure. In the trying course of implementing a method, one is often
 * left with no choice but to foist control off onto another thread or
 * generally postpone things beyond the lifetime of the current call. In
 * such circumstances, it is handy to have a general purpose mechanism for
 * leting the caller know when things are done and whether or not the
 * succeeded; this class serves that purpose.
 *
 * <p> The following contrived example will hopefully communicate its use
 * more clearly than the previous paragraph of flowery prose:
 *
 * <pre>
 * public void doSomeStuff (ResultListener<String> listener)
 * {
 *     Runnable run = new Runnable () {
 *         public void run () {
 *             try {
 *                 // do our thing
 *                 listener.requestCompleted("Elvis!");
 *             } catch (Exception e) {
 *                 listener.requestFailed(e);
 *             }
 *         }
 *     };
 *     new Thread(run).start();
 * }
 * </pre>
 *
 * @see IntResultListener
 */
public interface ResultListener<T>
{
    /**
     * Called to communicate that the request succeeded and that the
     * result is available.
     */
    public void requestCompleted (T result);

    /**
     * Called to communicate that the request failed and to provide the
     * reason for failure.
     */
    public void requestFailed (Exception cause);

    /** @deprecated This cannot be type safe so don't use it. */
    public ResultListener<Object> NOOP = new ResultListener<Object>() {
        public void requestCompleted (Object result) {
        }
        public void requestFailed (Exception cause) {
        }
    };
}
{'fraction_non_alphanumeric': 0.0873476494486361, 'fraction_numerical': 0.009286128845037725, 'mean_word_length': 2.495943204868154, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6030924', 'n_tokens_mistral': 914, 'n_tokens_neox': 874, 'n_words': 380}