<commit_before>package de.ehex.foss.gematik.specifications;

import static java.util.Objects.requireNonNull;

/**
 * API definition of a gematik requirement (ger. Anforderung = AFO).
 *
 * @author <NAME>uml;dt
 * @since September 9th, 2016
 */
public abstract interface AFO extends Comparable<AFO> {

    /**
     * Returns the ID of {@code this} AFO.
     *
     * @return the ID of {@code this} AFO
     */
    public abstract String getAfoId();

    /**
     * {@inheritDoc}
     *
     * <p>
     * The {@code default} implementation compares any AFOs by its {@link #getAfoId() ID}.
     *
     * In result, equal IDs implies equal AFOs. Thus, these AFOs must provide an equal {@linkplain #getLabel() label}
     * and an equal {@linkplain #getType() AFO type}, all based on the according specification of the gematik.
     * </p>
     */
    @Override
    public default int compareTo(final AFO afo) {
        requireNonNull(afo);
        return this.getAfoId().compareTo(afo.getAfoId());
    }

    /**
     * Returns the label of {@code this} AFO.
     *
     * @return the label of {@code this} AFO
     */
    public abstract String getLabel();

    /**
     * Returns the requirement type of {@code this} AFO.
     *
     * @return the requirement type of {@code this} AFO
     */
    public abstract AFOType getType();

}
<commit_msg>Umstellen auf separaten Comparator, damit eine AFO-Implementierung per enum (extends Comparable) möglich ist.<commit_after>package de.ehex.foss.gematik.specifications;

import java.util.Comparator;

/**
 * API definition of a gematik AFO (AFO = Anforderung, engl. Requirement).
 *
 * <em>Any AFO implementation ensure immutable
 * instances.</em>
 *
 * @apiNote Although AFOs can be ordered by its {@link #getAfoId()}, this interface does not extend {@link Comparable}.
 *          Otherwise, the specific AFO enumerations (e.g. {@link de.ehex.foss.gematik.specifications.gemSpec_PKI.AFOs})
 *          cannot be defined as {@code enum} types (because {@link Enum} already extends {@link Comparable}). In
 *          result, this interface provides an according separate {@link Comparator} to be used when sorting/comparing
 *          AFOs: {@link #AFO_COMPARATOR}.
 *
 * @author <NAME>uml;dt
 * @since September 9th, 2016
 */
public abstract interface AFO {

    /**
     * Returns the ID of {@code this} AFO.
     *
     * @return the ID of {@code this} AFO
     */
    public abstract String getAfoId();

    /**
     * This {@link Comparator} compares two given AFO instances by its {@linkplain #getAfoId() id}
     * {@linkplain String#compareTo(String) lexicographically}.
     */
    public static final Comparator<? super AFO> AFO_COMPARATOR = (x, y) -> x.getAfoId().compareTo(y.getAfoId());

    /**
     * Returns the label of {@code this} AFO.
     *
     * @return the label of {@code this} AFO
     */
    public abstract String getLabel();

    /**
     * Returns the requirement type of {@code this} AFO.
     *
     * @return the requirement type of {@code this} AFO
     */
    public abstract AFOType getType();

}

{'fraction_non_alphanumeric': 0.11724585904514452, 'fraction_numerical': 0.003247807729782397, 'mean_word_length': 2.8260869565217392, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '4041519', 'n_tokens_mistral': 960, 'n_tokens_neox': 941, 'n_words': 322}