<commit_before>package uk.ac.ebi.quickgo.rest.search.query;

/**
 * Created 13/01/17
 * @author Edd
 */
public class RegularPage extends Page {
    private final int pageNum;

    private RegularPage(int pageSize) {
        this(1, pageSize);
    }

    public RegularPage(int pageNum, int pageSize) {
        super(pageSize);
        this.pageNum = pageNum;
    }

    public int getPageNumber() {
        return pageNum;
    }

    @Override public <V> void accept(PageVisitor<V> visitor, V subject) {
        visitor.visit(this, subject);
    }

    @Override public int hashCode() {
        return pageNum;
    }

    @Override public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        RegularPage that = (RegularPage) o;

        return pageNum == that.pageNum;
    }

    @Override public String toString() {
        return "RegularPage{" +
                "pageNum=" + pageNum +
                '}';
    }
}<commit_msg>add precondition on new instance argument<commit_after>package uk.ac.ebi.quickgo.rest.search.query;

import com.google.common.base.Preconditions;

/**
 * Created 13/01/17
 * @author Edd
 */
public class RegularPage extends Page {
    // todo add creation tests
    private final int pageNumber;

    public RegularPage(int pageNumber, int pageSize) {
        super(pageSize);
        Preconditions.checkArgument(pageNumber >= 0, "Page number cannot be less than 0");
        this.pageNumber = pageNumber;
    }

    public int getPageNumber() {
        return pageNumber;
    }

    @Override public <V> void accept(PageVisitor<V> visitor, V subject) {
        visitor.visit(this, subject);
    }

    @Override public int hashCode() {
        return pageNumber;
    }

    @Override public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        RegularPage that = (RegularPage) o;

        return pageNumber == that.pageNumber;
    }

    @Override public String toString() {
        return "RegularPage{" +
                "pageNumber=" + pageNumber +
                '}';
    }
}
{'fraction_non_alphanumeric': 0.11072056239015818, 'fraction_numerical': 0.006590509666080844, 'mean_word_length': 2.0646029609690446, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '3405937', 'n_tokens_mistral': 674, 'n_tokens_neox': 641, 'n_words': 178}