package jp.hasc.hasctool.core.runtime.filter.file.count;

import jp.hasc.hasctool.core.data.EnumCommand;
import jp.hasc.hasctool.core.runtime.filter.AbstractFilter;

/**
 * ファイル数をカウントします
 * @author hiro
 */

public class FileCounter extends AbstractFilter{

	int count_ = 0;

	@Override
	public void processMessage(Object message) throws InterruptedException {
		if (message instanceof String) {
			count();
		} else if (message == EnumCommand.END) {
			outputMessage("A Number Of File is :" + count_);
			outputMessage(EnumCommand.END);
		} else {
			//BEGIN message
			outputMessage(message);
		}
	}

	private void count(){
		count_++;
	}
}
