<commit_before>/*
 * Copyright (c) 2002-2016 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This product is licensed to you under the Apache License, Version 2.0 (the "License").
 * You may not use this product except in compliance with the License.
 *
 * This product may include a number of subcomponents with
 * separate copyright notices and license terms. Your use of the source
 * code for these subcomponents is subject to the terms and
 *  conditions of the subcomponent's license, as noted in the LICENSE file.
 */
package org.neo4j.ogm.cypher;

import org.neo4j.ogm.cypher.function.FilterFunction;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
 * @author <NAME>
 */
public class Filters implements Iterable<Filter> {

    private List<Filter> filters = new ArrayList<>();

    public Filters add(Filter... filters) {
        Collections.addAll(this.filters, filters);
        return this;
    }

    public Filters add(String key, Object value) {
        this.filters.add(new Filter(key, value));
        return this;
    }

    public Filters add(FilterFunction function) {
        this.filters.add(new Filter(function));
        return this;
    }

    @Override
    public Iterator<Filter> iterator() {
        return filters.iterator();
    }

    public boolean isEmpty() {
        return filters.isEmpty();
    }
}<commit_msg>Improved Filter API. Closes #206.<commit_after>/*
 * Copyright (c) 2002-2016 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This product is licensed to you under the Apache License, Version 2.0 (the "License").
 * You may not use this product except in compliance with the License.
 *
 * This product may include a number of subcomponents with
 * separate copyright notices and license terms. Your use of the source
 * code for these subcomponents is subject to the terms and
 *  conditions of the subcomponent's license, as noted in the LICENSE file.
 */
package org.neo4j.ogm.cypher;

import org.neo4j.ogm.cypher.function.FilterFunction;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
 * @author <NAME>
 */
public class Filters implements Iterable<Filter> {

    private List<Filter> filters = new ArrayList<>();


    public Filters() {
    }

    public Filters(String key, Object value) {
        add(key, value);
    }

    public Filters(Filter... filters) {
        add(filters);
    }

    public Filters(Iterable<Filter> filters) {
        add(filters);
    }


    public Filters add(String key, Object value) {
        this.filters.add(new Filter(key, value));
        return this;
    }

    public Filters add(Filter... filters) {
        Collections.addAll(this.filters, filters);
        return this;
    }

    public Filters add(Iterable<Filter> filters) {
        for (Filter filter : filters) {
            this.filters.add(filter);
        }
        return this;
    }

    public Filters add(FilterFunction function) {
        this.filters.add(new Filter(function));
        return this;
    }

    @Override
    public Iterator<Filter> iterator() {
        return filters.iterator();
    }

    public boolean isEmpty() {
        return filters.isEmpty();
    }
}
{'fraction_non_alphanumeric': 0.10080524903071876, 'fraction_numerical': 0.008052490307187594, 'mean_word_length': 2.955188679245283, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2490287', 'n_tokens_mistral': 968, 'n_tokens_neox': 912, 'n_words': 318}