package com.menzus.gcj._2012.qualification.b;

import com.menzus.gcj.common.InputBlockParser;
import com.menzus.gcj.common.OutputProducer;
import com.menzus.gcj.common.impl.AbstractProcessorFactory;

public class BProcessorFactory extends AbstractProcessorFactory<BInput, BOutputEntry> {
    public BProcessorFactory(String inputFileName) {
	super(inputFileName);
    }

    @Override
    protected InputBlockParser<BInput> createInputBlockParser() {
	return new BInputBlockParser();
    }

    @Override
    protected OutputProducer<BInput, BOutputEntry> createOutputProducer() {
	return new BOutputProducer();
    }
}

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;


public class Writer {
	private String fileName;
	private BufferedWriter writer;
	private int i = 1;
	
	public Writer(String fileName){
		this.fileName = fileName;
	}
	
	public void open() throws Exception{
		writer = new BufferedWriter(new FileWriter(new File(fileName)));
	}
	
	public void close() throws Exception{
		writer.close();
	}
	
	public void write(String erg) throws Exception{
		writer.write("Case #" + i +": " + erg + "\n");
		i++;
	}
}
