All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.nicosensei.textbatch.BasicBatchState Maven / Gradle / Ivy

/**
 *
 */
package com.github.nicosensei.textbatch;

import java.text.DecimalFormat;

import com.github.nicosensei.textbatch.input.InputLine;


/**
 * @author ngiraud
 *
 */
public abstract class BasicBatchState extends AbstractBatchState {

    protected static final DecimalFormat PERCENTAGE =
        new DecimalFormat("###.##");

    protected BasicBatchState(long linesToProcess) {
        super(linesToProcess);
    }

    public synchronized void notifyLineProcessed(InputLine l) {
        incrementUnitsProcessed(1);
    }

    @Override
    public void logStatus() {
        BatchExecutor.getInstance().logInfo(getUnitsProcessed() + "/" + getUnitsToProcess()
        + " lines processed ("
        + PERCENTAGE.format(getCompletionPercentage()) + "%).");

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy