<commit_before>/*
 * Copyright 2008-2011 Microarray Informatics Team, EMBL-European Bioinformatics Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *
 * For further details of the Gene Expression Atlas project, including source code,
 * downloads and documentation, please see:
 *
 * http://gxa.github.com/gxa
 */

package uk.ac.ebi.gxa.data;

import net.java.quickcheck.Generator;
import net.java.quickcheck.generator.PrimitiveGenerators;

import static java.util.Arrays.asList;
import static net.java.quickcheck.generator.CombinedGenerators.ensureValues;
import static net.java.quickcheck.generator.PrimitiveGenerators.doubles;

/**
 * @author alf
 */
public class BestDesignElementCandidateGenerators {

    public static Generator<Double> validPValues() {
        return doubles(0.0, 1.0);
    }

    public static Generator<Double> validTStats() {
        return ensureValues(
                asList(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY),
                doubles(Float.MIN_VALUE, Float.MAX_VALUE));
    }

    public static Generator<Double> invalidPValues() {
        return ensureValues(asList(Double.NaN, -1.0, 2.0));
    }

    public static Generator<Double> invalidTStats() {
        return ensureValues(asList(Double.NaN));
    }

    public static Generator<BestDesignElementCandidate> deCandidates() {
        final Generator<Double> p = validPValues();
        final Generator<Double> t = validTStats();
        final Generator<Integer> de = PrimitiveGenerators.integers();
        final Generator<Integer> uefv = PrimitiveGenerators.integers();

        return new Generator<BestDesignElementCandidate>() {
            @Override
            public BestDesignElementCandidate next() {
                return new BestDesignElementCandidate(
                        p.next().floatValue(),
                        t.next().floatValue(),
                        de.next(), uefv.next());
            }
        };
    }
}
<commit_msg>More precise description of what constitutes an "invalid P"<commit_after>/*
 * Copyright 2008-2011 Microarray Informatics Team, EMBL-European Bioinformatics Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *
 * For further details of the Gene Expression Atlas project, including source code,
 * downloads and documentation, please see:
 *
 * http://gxa.github.com/gxa
 */

package uk.ac.ebi.gxa.data;

import net.java.quickcheck.Generator;
import net.java.quickcheck.generator.PrimitiveGenerators;

import static java.util.Arrays.asList;
import static net.java.quickcheck.generator.CombinedGenerators.*;
import static net.java.quickcheck.generator.PrimitiveGenerators.doubles;

/**
 * @author alf
 */
public class BestDesignElementCandidateGenerators {

    public static Generator<Double> validPValues() {
        return doubles(0.0, 1.0);
    }

    public static Generator<Double> validTStats() {
        return ensureValues(
                asList(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY),
                doubles(Float.MIN_VALUE, Float.MAX_VALUE));
    }

    public static Generator<Double> invalidPValues() {
        return ensureValues(asList(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NaN),
                oneOf(excludeValues(doubles(-Float.MAX_VALUE, -0.0), asList(+0.0, -0.0)))
                        .add(excludeValues(doubles(1.0, Float.MAX_VALUE), asList(1.0))));
    }

    public static Generator<Double> invalidTStats() {
        return ensureValues(Double.NaN);
    }

    public static Generator<BestDesignElementCandidate> deCandidates() {
        final Generator<Double> p = validPValues();
        final Generator<Double> t = validTStats();
        final Generator<Integer> de = PrimitiveGenerators.integers();
        final Generator<Integer> uefv = PrimitiveGenerators.integers();

        return new Generator<BestDesignElementCandidate>() {
            @Override
            public BestDesignElementCandidate next() {
                return new BestDesignElementCandidate(
                        p.next().floatValue(),
                        t.next().floatValue(),
                        de.next(), uefv.next());
            }
        };
    }
}

{'fraction_non_alphanumeric': 0.0954029621080977, 'fraction_numerical': 0.008847855356799385, 'mean_word_length': 3.0625, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3528280', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1382, 'n_words': 395}