<commit_before>package ar.rules;

import java.util.HashSet;

import ar.AggregateReducer;
import ar.rules.Aggregators.RLE;


public class AggregateReducers {

	public static class Count implements AggregateReducer<Integer,Integer,Integer> {
		public Integer combine(Integer left, Integer right) {return left+right;}
		public String toString() {return "Count (int x int -> int)";}
	}

	public static class MergeCOC implements AggregateReducer<RLE,RLE,RLE> {
		public RLE combine(RLE left, RLE right) {
			if (left == null || left.size()==0) {return right;}
			if (right == null || left.size()==0) {return left;}
			
			HashSet<Object> categories = new HashSet<Object>();
			categories.addAll(left.keys);
			categories.addAll(right.keys);
			
			for (Object category: categories) {
				int v1 = left.val(category);
				int v2 = right.val(category);
				left.add(category, v1+v2);
			}
			return left;
		}
		public String toString() {return "CoC (RLE x RLE -> RLE)";}
	}

	
}<commit_msg>Fixed CoC merge error.<commit_after>package ar.rules;

import java.util.HashSet;

import ar.AggregateReducer;
import ar.rules.Aggregators.RLE;


public class AggregateReducers {

	public static class Count implements AggregateReducer<Integer,Integer,Integer> {
		public Integer combine(Integer left, Integer right) {return left+right;}
		public String toString() {return "Count (int x int -> int)";}
	}

	public static class MergeCOC implements AggregateReducer<RLE,RLE,RLE> {
		public RLE combine(RLE left, RLE right) {
			if (left == null || left.size()==0) {return right;}
			if (right == null || left.size()==0) {return left;}
			
			HashSet<Object> categories = new HashSet<Object>();
			categories.addAll(left.keys);
			categories.addAll(right.keys);
			
			RLE total = new RLE();
			
			for (Object category: categories) {
				int v1 = left.val(category);
				int v2 = right.val(category);
				total.add(category, v1+v2);
			}
			return total;
		}
		
		public String toString() {return "CoC (RLE x RLE -> RLE)";}
	}

	
}
{'fraction_non_alphanumeric': 0.1318407960199005, 'fraction_numerical': 0.005970149253731343, 'mean_word_length': 4.0275, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6955775', 'n_tokens_mistral': 758, 'n_tokens_neox': 668, 'n_words': 181}