package innovimax.mixthem.operation;

import innovimax.mixthem.MixException;
import innovimax.mixthem.arguments.RuleParam;
import innovimax.mixthem.arguments.ParamValue;
//import innovimax.mixthem.io.DefaultCharReader;
import innovimax.mixthem.io.DefaultCharWriter;
//import innovimax.mixthem.io.ICharInput;
import innovimax.mixthem.io.ICharOutput;
import innovimax.mixthem.io.IMultiChannelCharInput;
import innovimax.mixthem.io.InputResource;
import innovimax.mixthem.io.MultiChannelCharReader;

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

/**
* <p>Abstract class for all character operation.</p>
* @see ICharOperation
* @author Innovimax
* @version 1.0
*/
public abstract class AbstractCharOperation extends AbstractOperation implements ICharOperation {

	/**
	* Constructor
 	* @param params The list of parameters (maybe empty)
	* @see innovimax.mixthem.arguments.RuleParam
	* @see innovimax.mixthem.arguments.ParamValue
	*/
	public AbstractCharOperation(final Map<RuleParam, ParamValue> params) {
		super(params);
	}

	@Override
    	public void processFiles(final List<InputResource> inputs, final OutputStream output) throws MixException, IOException {				
		/*final ICharInput reader1 = new DefaultCharReader(inputs.get(0));
		final ICharInput reader2 = new DefaultCharReader(inputs.get(1));
		final ICharOutput writer = new DefaultCharWriter(output);
		final CharResult result = new CharResult();
        	while (reader1.hasCharacter() || reader2.hasCharacter()) {
			final int c1 = reader1.nextCharacter();
			final int c2 = reader2.nextCharacter();			
			process(c1, c2, result);
			if (result.hasResult()) {
				result.getResult().forEach(i -> {
					try {
						writer.writeCharacter((char) i);
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
				});
			}
        	}
        	reader1.close();
        	reader2.close();
        	writer.close();*/
		final IMultiChannelCharInput reader = new MultiChannelCharReader(inputs);
		final ICharOutput writer = new DefaultCharWriter(output);
		final CharResult result = new CharResult();
		while (reader.hasCharacter()) {
			final int[] charRange = reader.nextCharacterRange();
			process(charRange, result);
			if (result.hasResult()) {
				result.getResult().forEach(i -> {
					try {
						writer.writeCharacter((char) i);
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
				});
			}
		}
		reader.close();
		writer.close();
    	}

}

@@ -167,57 +167,8 @@
 ue;%0A
-//import innovimax.mixthem.io.DefaultCharReader;%0A
 impo
@@ -214,50 +214,8 @@
 er;%0A
-//import innovimax.mixthem.io.ICharInput;%0A
 impo
@@ -1129,730 +1129,8 @@
 %09%09%09%0A
-%09%09/*final ICharInput reader1 = new DefaultCharReader(inputs.get(0));%0A%09%09final ICharInput reader2 = new DefaultCharReader(inputs.get(1));%0A%09%09final ICharOutput writer = new DefaultCharWriter(output);%0A%09%09final CharResult result = new CharResult();%0A        %09while (reader1.hasCharacter() %7C%7C reader2.hasCharacter()) %7B%0A%09%09%09final int c1 = reader1.nextCharacter();%0A%09%09%09final int c2 = reader2.nextCharacter();%09%09%09%0A%09%09%09process(c1, c2, result);%0A%09%09%09if (result.hasResult()) %7B%0A%09%09%09%09result.getResult().forEach(i -%3E %7B%0A%09%09%09%09%09try %7B%0A%09%09%09%09%09%09writer.writeCharacter((char) i);%0A%09%09%09%09%09%7D catch (IOException e) %7B%0A%09%09%09%09%09%09throw new RuntimeException(e);%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D);%0A%09%09%09%7D%0A        %09%7D%0A        %09reader1.close();%0A        %09reader2.close();%0A        %09writer.close();*/%0A
 %09%09fi

Update AbstractCharOperation.java