<commit_before>/*
This file is part of Reactive Cascade which is released under The MIT License.
See license.txt or http://reactivecascade.com for details.
This is open source for the common good. Please contribute improvements by pull request or contact <EMAIL>
*/
package com.futurice.cascade.i;

import android.support.annotation.NonNull;

/**
 * Create the actual URL at the last minute, just before the request is processed.
 * <p>
 * This may be useful for load balancing between servers or late-prioritizing parameters
 * based on current conditions. For example use this in association with a Collection to
 * prioritize if/which-next at that moment based on current user interface state.
 * <p>
 * Your implementation must be thread safe since multiple WORKER threads may attempt to start
 * network connections simultaneously. The simplest way to do this is mark the method synchronized
 * <p>
 * Return <code>null</code> if no URL should be loaded at this time. Depending on your use case
 * this may signal the end of a collection of URLs to be downloaded.
 *
 * @param <T>
 */
public interface IGettable<T> {
    /**
     * A null object indicating that the <code>IGettable</code> is not able to meaningfully provide its state
     * as a string at this time. For example, the from may not yet be determined.
     * <p>
     * This will appear as "VALUE_NOT_AVAILABLE" in debugging outputs
     */
    IGettable<?> VALUE_NOT_AVAILABLE = (IGettable<?>) new IGettable<Object>() {
        @NonNull
        @Override // IGettable
        public Object get() {
            return toString();
        }

        @NonNull
        @Override // IGettable
        public String toString() {
            return "VALUE_NOT_AVAILABLE";
        }
    };

    /**
     * Get the current from of a variable or the next from in a list.
     *
     * @return the current from, or the next from in the series
     * @throws IllegalStateException if the current from is not available. See also {@link ISafeGettable#safeGet()}
     */<commit_msg>IGettable safer throw when get() in state VALUE_NOT_AVAILABLE<commit_after>/*
This file is part of Reactive Cascade which is released under The MIT License.
See license.txt or http://reactivecascade.com for details.
This is open source for the common good. Please contribute improvements by pull request or contact <EMAIL>
*/
package com.futurice.cascade.i;

import android.support.annotation.NonNull;

/**
 * Create the actual URL at the last minute, just before the request is processed.
 * <p>
 * This may be useful for load balancing between servers or late-prioritizing parameters
 * based on current conditions. For example use this in association with a Collection to
 * prioritize if/which-next at that moment based on current user interface state.
 * <p>
 * Your implementation must be thread safe since multiple WORKER threads may attempt to start
 * network connections simultaneously. The simplest way to do this is mark the method synchronized
 * <p>
 * Return <code>null</code> if no URL should be loaded at this time. Depending on your use case
 * this may signal the end of a collection of URLs to be downloaded.
 *
 * @param <T>
 */
public interface IGettable<T> {
    /**
     * A null object indicating that the <code>IGettable</code> is not able to meaningfully provide its state
     * as a string at this time. For example, the from may not yet be determined.
     * <p>
     * This will appear as "VALUE_NOT_AVAILABLE" in debugging outputs
     */
    IGettable<?> VALUE_NOT_AVAILABLE = (IGettable<?>) new IGettable<Object>() {
        @NonNull
        @Override // IGettable
        public Object get() {
            throw new IllegalStateException("Can not get() from IGettable.VALUE_NOT_AVALIABLE. Perhaps you want ISafaGettable.safeGet() instead? You could also safely check the value before getting since you can not return to this state. Another choice is to examine the logic flow and sequence for initializing this variable.");
        }

        @NonNull
        @Override // IGettable
        public String toString() {
            return "VALUE_NOT_AVAILABLE";
        }
    };

    /**
     * Get the current from of a variable or the next from in a list.
     *
     * @return the current from, or the next from in the series
     * @throws IllegalStateException if the current from is not available. See also {@link ISafeGettable#safeGet()}
     */
{'fraction_non_alphanumeric': 0.07054035722360388, 'fraction_numerical': 0.0, 'mean_word_length': 3.1578947368421053, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '2372739', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1140, 'n_words': 560}