<commit_before>package jalf;

import static jalf.util.ValidationUtils.validateNotNull;
import jalf.type.Heading;
import jalf.type.RelationType;
import jalf.type.ScalarType;
import jalf.type.TupleType;

/**
 * JAl's type abstraction, i.e. a set of values.
 *
 * This is the main interface of JAlf's type system. Conceptually, a JAlf type
 * is a set of immutable values. JAlf currently distinguishes between scalar,
 * tuple and relation types. The last two are implemented by JAlf own classes,
 * see TupleType and RelationType. In contrast, scalar types can be obtained by
 * simple decoration of arbitrary Java classes. The latter must however properly
 * implement so-called value objects. In particular, the objects must be
 * immutable (or not mutated in practice) and their class must provide
 * consistent implementations of `hashCode` and `equals`. Provided those
 * requirements ae met, any class/object can be used for capturing values in
 * JAlf tuples and relations.
 *
 * This interface is not intended to be instantiated directly. Instances may be
 * obtained through the factory methods.
 *
 * @param <T> the java class used for representing the values of this type.
 */
public interface Type<T> {

    /**
     * Builds a scalar type.
     *
     * @param representation the Java class used to represent values.
     * @return a Type instance.
     */
    public static <U> Type<U> scalarType(Class<U> representation) {
        validateNotNull("Argument representation must not be null", representation);

        // TODO use a concurrent WeakHashMap to avoid creating the same type a million times
        return new ScalarType<U>(representation);
    }
<commit_msg>Fix documentation typo.<commit_after>package jalf;

import static jalf.util.ValidationUtils.validateNotNull;
import jalf.type.Heading;
import jalf.type.RelationType;
import jalf.type.ScalarType;
import jalf.type.TupleType;

/**
 * JAl's type abstraction, i.e. a set of values.
 *
 * This is the main interface of JAlf's type system. Conceptually, a JAlf type
 * is a set of immutable values. JAlf currently distinguishes between scalar,
 * tuple and relation types. The last two are implemented by JAlf own classes,
 * see TupleType and RelationType. In contrast, scalar types can be obtained by
 * simple decoration of arbitrary Java classes. The latter must however properly
 * implement so-called value objects. In particular, the objects must be
 * immutable (or not mutated in practice) and their class must provide
 * consistent implementations of `hashCode` and `equals`. Provided those
 * requirements are met, any class/object can be used for capturing values in
 * JAlf tuples and relations.
 *
 * This interface is not intended to be instantiated directly. Instances may be
 * obtained through the factory methods.
 *
 * @param <T> the java class used for representing the values of this type.
 */
public interface Type<T> {

    /**
     * Builds a scalar type.
     *
     * @param representation the Java class used to represent values.
     * @return a Type instance.
     */
    public static <U> Type<U> scalarType(Class<U> representation) {
        validateNotNull("Argument representation must not be null", representation);

        // TODO use a concurrent WeakHashMap to avoid creating the same type a million times
        return new ScalarType<U>(representation);
    }

{'fraction_non_alphanumeric': 0.06899615042937518, 'fraction_numerical': 0.0, 'mean_word_length': 3.74438202247191, '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': '2240818', 'n_tokens_mistral': 891, 'n_tokens_neox': 860, 'n_words': 414}