<commit_before>/**
 * Copyright 2010 CosmoCode GmbH
 *
 * 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.
 */

package de.cosmocode.commons;

import com.google.common.base.Preconditions;

import de.cosmocode.commons.validation.AbstractRule;

/**
 * Contains string predicate.
 *
 * @since 1.6
 * @see Strings#contains(CharSequence)
 * @author <NAME>
 */
final class StringContainsRule extends AbstractRule<String> {
    
    private final CharSequence s;
    
    public StringContainsRule(CharSequence s) {
        this.s = Preconditions.checkNotNull(s, "Sequence");
    }

    @Override
    public boolean apply(String input) {
        return input.contains(s);
    };
    
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        } else if (that instanceof StringContainsRule) {
            final StringContainsRule other = StringContainsRule.class.cast(that);
            return s.equals(other.s);
        } else {
            return false;
        }
    }
    
    @Override
    public int hashCode() {
        return s.hashCode() ^ -983245472;
    }
    
    @Override
    public String toString() {
        return "Strings.contains(" + s + ")";<commit_msg>minor typo<commit_after>/**
 * Copyright 2010 CosmoCode GmbH
 *
 * 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.
 */

package de.cosmocode.commons;

import com.google.common.base.Preconditions;

import de.cosmocode.commons.validation.AbstractRule;

/**
 * Contains string predicate.
 *
 * @since 1.6
 * @see Strings#contains(CharSequence)
 * @author <NAME>
 */
final class StringContainsRule extends AbstractRule<String> {
    
    private final CharSequence s;
    
    public StringContainsRule(CharSequence s) {
        this.s = Preconditions.checkNotNull(s, "Sequence");
    }

    @Override
    public boolean apply(String input) {
        return input.contains(s);
    }
    
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        } else if (that instanceof StringContainsRule) {
            final StringContainsRule other = StringContainsRule.class.cast(that);
            return s.equals(other.s);
        } else {
            return false;
        }
    }
    
    @Override
    public int hashCode() {
        return s.hashCode() ^ -983245472;
    }
    
    @Override
    public String toString() {
        return "Strings.contains(" + s + ")";
{'fraction_non_alphanumeric': 0.09251740139211137, 'fraction_numerical': 0.011020881670533642, 'mean_word_length': 2.732683982683983, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5997935', 'n_tokens_mistral': 958, 'n_tokens_neox': 928, 'n_words': 317}