package innovimax.mixthem.operation;

import innovimax.mixthem.MixException;
import innovimax.mixthem.arguments.RuleParam;
import innovimax.mixthem.arguments.ParamValue;

import java.util.Arrays;
import java.util.Map;

/**
* <p>Zips two characters.</p>
* @see CharOperation
* @author Innovimax
* @version 1.0
*/
public class DefaultCharZipping extends AbstractCharOperation {
	
	private final String sep;

	/**
	* Constructor
 	* @param params The list of parameters (maybe empty)
	* @see innovimax.mixthem.arguments.RuleParam
	* @see innovimax.mixthem.arguments.ParamValue
	*/
	public DefaultCharZipping(Map<RuleParam, ParamValue> params) {
		super(params);		
		this.sep = params.getOrDefault(RuleParam.ZIP_SEP, ZipOperation.DEFAULT_ZIP_SEPARATOR.getValue()).asString();
	}
	
	@Override
	public void process(final int c1, final int c2, final CharResult result) throws MixException {
		result.reset();
		final int len = (c1 != -1 ? 1 : 0) + sep.length() + (c2 != -1 ? 1 : 0);
        	final int[] array = new int[len];
		if (c1 != -1) { 
			array[0] = c1; 
		}		
        	for (int i = 0; i < sep.length(); i++) {			
			array[i + 1] = (int) sep.charAt(i);
		}		
		if (c2 != -1) { 
			array[array.length - 1] = c2; 
		}        	
		result.setResult(Arrays.stream(array));
	}

	@Override
	public void process(final int[] charRange, final CharResult result) throws MixException {
		//TODO
	}
	
}

@@ -397,16 +397,38 @@
 ing sep;
+%0A%09private int channel;
 %0A%0A%09/**%0A%09
@@ -787,16 +787,36 @@
 ring();%0A
+%09%09this.channel = 0;%0A
 %09%7D%0A%09%0A%09@O
@@ -1416,14 +1416,520 @@
 %7B%0A%09%09
-//TODO
+result.reset();%0A%09%09int len = 0;%0A%09%09for (int i=0; i %3C charRange.length(); i++) %7B%09%09%09%0A%09%09%09if (charRange%5Bi%5D != -1) %7B%0A%09%09%09%09len++;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09len += (charRange.length() - 1) * sep.length;%0A%09%09final int%5B%5D array = new int%5Blen%5D;%0A%09%09int index = 0;%0A%09%09for (int i=0; i %3C charRange.length(); i++) %7B%09%09%09%0A%09%09%09if (charRange%5Bi%5D != -1) %7B%0A%09%09%09%09array%5Bindex++%5D = charRange%5Bi%5D;%0A%09%09%09%7D esle %7B%0A        %09%09%09for (int j = 0; j %3C sep.length(); j++) %7B%0A%09%09%09%09%09array%5Bindex++%5D = (int) sep.charAt(j);%0A%09%09%09%09%7D%09%09%09%09%0A%09%09%09%7D%0A%09%09%7D%0A%09%09result.setResult(Arrays.stream(array));
 %0A%09%7D%0A

Update DefaultCharZipping.java