<commit_before>package ru.ematveev.iterator;

import java.util.Iterator;

/**
 * @author <NAME>.
 */
public class IteratorSimpleNumbers implements Iterator {
    private final int[] value = {2, 523, 199, 525, 347, 983, 11, 529, 7, 911};
    private int index = 0;

    @Override
    public boolean hasNext() {
        return value.length > index;
    }

    @Override
    public Object next() {
        int result = 0;
        for (int i = index; i < value.length; i++) {
            if (checrSqrt(value[i])) {
                result = value[i];
                index = i + 1;
                break;
            }
        }
        return result;
    }

    /**
     * Method checks whether the number n is divided by a number other than n.
     *
     * @param n verified number.
     * @return boolean.
     */
    private boolean checkNumber(int n) {
        if (n % 2 != 0 && n != 2) {
            for (int i = 3; i < Math.sqrt(n); i++) {
                if (n % i == 0) {
                    return false;
                }
                i++;
            }
        }
        return true;
    }

    /**
     * The method checks the "prime number" or not.
     *
     * @param n verified number.
     * @return boolean.
     */
    private boolean checrSqrt(int n) {
        if (n == 0 || n == 1 || (n % 2 == 0 && n != 2)) {
            return false;
        }
        if (n > 100) {
            int x = (int) Math.sqrt(n);
            if (Math.pow(x, 2) == n) {
                if (checkNumber(x)) {
                    return false;
                }
            } else {
                if (checkNumber(n)) {
                    return true;
                }
            }
        }
        if (n < 100) {
            if (checkNumber(n)) {
                return true;
            }
        }
        return false;
    }
}

<commit_msg>IteratorSimpleNumbers - change method hasNext().<commit_after>package ru.ematveev.iterator;

import java.util.Iterator;

/**
 * @author <NAME>.
 */
public class IteratorSimpleNumbers implements Iterator<Integer> {
    private final int[] value = {2, 523, 199, 525, 347, 983, 11, 529, 7, 912};
    private int index = 0;

    @Override
    public boolean hasNext() {
        if(value.length > index) {
            for (int i = index; i < value.length; i++) {
                if(checkSqrt(i)) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override
    public Integer next() {
        int result = 0;
        for (int i = index; i < value.length; i++) {
            if (checkSqrt(value[i])) {
                result = value[i];
                index = i + 1;
                break;
            }
        }
        return result;
    }

      /**
     * The method checks the "prime number" or not.
     *
     * @param n verified number.
     * @return boolean.
     */
    private boolean checkSqrt(int n) {
        if (n == 0 || n == 1 || (n % 2 == 0 && n != 2)) {
            return false;
        } else {
            int x = (int) Math.sqrt(n);
            if (Math.pow(x, 2) == n) {
                if (checkNumber(x)) {
                    return false;
                }
            } else {
                if (checkNumber(n)) {
                    return true;
                }
            }
        }
        return false;
    }

    /**
     * Method checks whether the number n is divided by a number other than n.
     *
     * @param n verified number.
     * @return boolean.
     */
    private boolean checkNumber(int n) {
        if (n % 2 != 0 && n != 2) {
            for (int i = 3; i < Math.sqrt(n); i++) {
                if (n % i == 0) {
                    return false;
                }
                i++;
            }
        }
        return true;
    }
}


{'fraction_non_alphanumeric': 0.12342105263157895, 'fraction_numerical': 0.022105263157894735, 'mean_word_length': 1.132996632996633, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 9, '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': '5453535', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1088, 'n_words': 335}