<commit_before>package io.bootique.metrics.health.check;

import com.fasterxml.jackson.annotation.JsonCreator;

import java.util.StringTokenizer;

/**
 * A value object that defines a range of int values, mapping health check statuses to different parts of the range.
 * Can be used as a value object in YAML/JSON.
 *
 * @since 0.25
 */
public class IntRange extends ValueRange<Integer> {

    public IntRange(Integer warningThreshold, Integer criticalThreshold) {
        super(warningThreshold, criticalThreshold);
    }

    /**
     * Creates an {@link IntRange} from a space-separated String of numbers.
     *
     * @param encoded a space-separated String that defines health check thresholds for the range. Can be either
     *                "", "int" or "int int", specifying no thresholds, a critical threshold, warning and critical
     *                thresholds.
     * @return a non-null {@link IntRange} corresponding to the encoded String.
     */
    @JsonCreator
    public static IntRange parse(String encoded) {

        if (encoded == null) {
            return new IntRange(null, null);
        }

        // comma-separated format; spaces are insignificant
        StringTokenizer tokens = new StringTokenizer(encoded);

        switch (tokens.countTokens()) {
            case 0:
                return new IntRange(null, null);
            case 1:
                return new IntRange(null, fromString(encoded, tokens.nextToken()));
            case 2:
                return new IntRange(
                        fromString(encoded, tokens.nextToken()),
                        fromString(encoded, tokens.nextToken()));
            default:<commit_msg>obsolete comment<commit_after>package io.bootique.metrics.health.check;

import com.fasterxml.jackson.annotation.JsonCreator;

import java.util.StringTokenizer;

/**
 * A value object that defines a range of int values, mapping health check statuses to different parts of the range.
 * Can be used as a value object in YAML/JSON.
 *
 * @since 0.25
 */
public class IntRange extends ValueRange<Integer> {

    public IntRange(Integer warningThreshold, Integer criticalThreshold) {
        super(warningThreshold, criticalThreshold);
    }

    /**
     * Creates an {@link IntRange} from a space-separated String of numbers.
     *
     * @param encoded a space-separated String that defines health check thresholds for the range. Can be either
     *                "", "int" or "int int", specifying no thresholds, a critical threshold, warning and critical
     *                thresholds.
     * @return a non-null {@link IntRange} corresponding to the encoded String.
     */
    @JsonCreator
    public static IntRange parse(String encoded) {

        if (encoded == null) {
            return new IntRange(null, null);
        }

        StringTokenizer tokens = new StringTokenizer(encoded);

        switch (tokens.countTokens()) {
            case 0:
                return new IntRange(null, null);
            case 1:
                return new IntRange(null, fromString(encoded, tokens.nextToken()));
            case 2:
                return new IntRange(
                        fromString(encoded, tokens.nextToken()),
                        fromString(encoded, tokens.nextToken()));
            default:
{'fraction_non_alphanumeric': 0.08421690396849439, 'fraction_numerical': 0.0036352620418055137, 'mean_word_length': 2.32527693856999, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '6039106', 'n_tokens_mistral': 851, 'n_tokens_neox': 791, 'n_words': 287}