package innovimax.mixthem.operation;

import innovimax.mixthem.MixException;
import innovimax.mixthem.arguments.RuleParam;
import innovimax.mixthem.arguments.ParamValue;
import innovimax.mixthem.io.DefaultCharWriter;
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 IMultiChannelCharInput reader = new MultiChannelCharReader(inputs);
		final ICharOutput writer = new DefaultCharWriter(output);
		final CharResult result = new CharResult();
		while (reader.hasCharacter()) {
			result.reset();
			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();
    	}

}

@@ -500,16 +500,38 @@
 til.Map;
+%0Aimport java.util.Set;
 %0A%0A/**%0A* 
@@ -760,16 +760,75 @@
 tructor%0A
+%09* @param selection The file index selection (maybe empty)%0A
  %09* @par
@@ -1007,16 +1007,46 @@
 n(final 
+Set%3CInteger%3E selection, final 
 Map%3CRule
@@ -1082,16 +1082,27 @@
 %09%09super(
+selection, 
 params);

Update AbstractCharOperation.java