<commit_before>/**
 * Copyright (c) 2002-2012 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This file is part of Neo4j.
 *
 * Neo4j is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.neo4j.helpers;

import java.io.PrintStream;

/**
 * A generic interface for reporting progress by a tool. Can be implemented to
 * support reporting progress from both a {@link SimpleProgress single source},
 * or for the aggregate of {@link MultiProgress multiple sources}.
 * 
 * @author <NAME> <<EMAIL>>
 */
public interface ProgressIndicator
{
    /**
     * Update the current progress count for the current source.
     * 
     * @param incremental whether this is an incremental update (
     *            <code>true</code>) or an absolute assignment (
     *            <code>false</code>) of the progress.
     * @param value the count to update the progress with.
     */
    void update( boolean incremental, long value );

    /**
     * Mark the process as done with the current source.
     * 
     * @param totalProgress the total progress reached by the source.
     */
    void done( long totalProgress );

    /**<commit_msg>Added a factory interface for ProgressIndicator.<commit_after>/**
 * Copyright (c) 2002-2012 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This file is part of Neo4j.
 *
 * Neo4j is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.neo4j.helpers;

import java.io.PrintStream;

/**
 * A generic interface for reporting progress by a tool. Can be implemented to
 * support reporting progress from both a {@link SimpleProgress single source},
 * or for the aggregate of {@link MultiProgress multiple sources}.
 * 
 * @author <NAME> <<EMAIL>>
 */
public interface ProgressIndicator
{
    /**
     * A factory interface for creating {@link ProgressIndicator}s.
     *
     * @author <NAME> <<EMAIL>>
     */
    public interface Factory
    {
        SimpleProgress newSimpleProgressIndicator(long total);

        MultiProgress newMultiProgressIndicator(long total);
    }

    /**
     * A factory implementation that creates progress indicators that log progress textually.
     *
     * @author <NAME> <<EMAIL>>
     */
    public final class Textual implements Factory
    {
        private final PrintStream out;

        public Textual( PrintStream out )
        {
            this.out = out;
        }

        @Override
        public SimpleProgress newSimpleProgressIndicator( long total )
        {
            return SimpleProgress.textual( out, total );
        }

        @Override
        public MultiProgress newMultiProgressIndicator( long total )
        {
            return MultiProgress.textual( out, total );
        }
    }

    /**
     * Update the current progress count for the current source.
     * 
     * @param incremental whether this is an incremental update (
     *            <code>true</code>) or an absolute assignment (
     *            <code>false</code>) of the progress.
     * @param value the count to update the progress with.
     */
    void update( boolean incremental, long value );

    /**
     * Mark the process as done with the current source.
     * 
     * @param totalProgress the total progress reached by the source.
     */
    void done( long totalProgress );

    /**
{'fraction_non_alphanumeric': 0.08031774051191527, 'fraction_numerical': 0.00529567519858782, 'mean_word_length': 2.755592377796189, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '4231641', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1117, 'n_words': 520}