package innovimax.mixthem.operation;

import innovimax.mixthem.MixException;
import innovimax.mixthem.arguments.RuleParam;
import innovimax.mixthem.arguments.ParamValue;
import innovimax.mixthem.io.DefaultLineReader;
import innovimax.mixthem.io.DefaultLineWriter;
import innovimax.mixthem.io.IInputLine;
import innovimax.mixthem.io.IOutputLine;
import innovimax.mixthem.io.InputResource;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;

/**
* <p>Abstract class for all line operation.</p>
* @see ILineOperation
* @author Innovimax
* @version 1.0
*/
public abstract class AbstractLineOperation extends AbstractOperation implements ILineOperation {
	
	/**
	* Constructor
 	* @param params The list of parameters (maybe empty)
	* @see innovimax.mixthem.arguments.RuleParam
	* @see innovimax.mixthem.arguments.ParamValue
	*/
	public AbstractLineOperation(Map<RuleParam, ParamValue> params) {
		super(params);
	}

	@Override
	public void processFiles(InputResource input1, InputResource input2, OutputStream out) throws MixException, IOException {
		IInputLine reader1 = new DefaultLineReader(input1);
		IInputLine reader2 = new DefaultLineReader(input2);
		IOutputLine writer = new DefaultLineWriter(out);
		LineResult result = new LineResult();
		while (reader1.hasLine() || reader2.hasLine()) {
			final String line1 = result.readingFirstFile() ? reader1.nextLine() : result.getFirstLine();
			final String line2 = result.readingSecondFile() ? reader2.nextLine() : result.getSecondLine();
			process(line1, line2, result);
			if (result.hasResult()) {
				writer.writeLine(result.getResult());
			}
        	}
        	reader1.close();
        	reader2.close();
        	writer.close();				
    	}

}

@@ -876,16 +876,22 @@
 eration(
+final 
 Map%3CRule
@@ -977,16 +977,22 @@
 ssFiles(
+final 
 InputRes
@@ -1004,16 +1004,22 @@
  input1,
+ final
  InputRe
@@ -1032,16 +1032,22 @@
  input2,
+ final
  OutputS
@@ -1094,16 +1094,22 @@
 ion %7B%0A%09%09
+final 
 IInputLi
@@ -1154,16 +1154,22 @@
 ut1);%0A%09%09
+final 
 IInputLi
@@ -1214,16 +1214,22 @@
 ut2);%0A%09%09
+final 
 IOutputL
@@ -1271,16 +1271,22 @@
 out);%0A%09%09
+final 
 LineResu

Update AbstractLineOperation.java