<commit_before>package fr.inria.diverse.trace.benchmark

import java.util.Set

//model_size,nbMut,timeStep,traceSize,traceMemoryFootprint,meanJumpTime,allJumpTimes
class Result {

	public String languageName = ""
	public String debuggerName = ""
	public String modelName = ""
	public Integer modelNbElements = 0
	public Integer modelNbMutFields = 0
	public Long timeExe = new Long(0)
	public Long timeInit = new Long(0)
	public Long timeJumpMean = new Long(0)
	public Integer traceNbStates = 0
	public Integer traceMemoryFootprint = 0
	

	/**
 * TODO
 */
	def static Result merge(Set<Result> results) {
		val ret = new Result

		for (p : Result.declaredFields) {
			switch (p.type) {
				Class<String>: {
					p.set(ret, p.get(results.get(0)))
				}
				Class<Long>: {
					var long sum = 0
					for (r : results) {
						sum = sum + p.getLong(r)
					}
					val long mean = sum / results.size
					p.setLong(ret, mean)
				}
				Class<Integer>: {
					var int sum = 0<commit_msg>Adding the amount of retries in results.<commit_after>package fr.inria.diverse.trace.benchmark

import java.util.Set

//model_size,nbMut,timeStep,traceSize,traceMemoryFootprint,meanJumpTime,allJumpTimes
class Result {

	public String languageName = ""
	public String debuggerName = ""
	public String modelName = ""
	public Integer modelNbElements = 0
	public Integer modelNbMutFields = 0
	public Long timeExe = new Long(0)
	public Long timeInit = new Long(0)
	public Long timeJumpMean = new Long(0)
	public Integer traceNbStates = 0
	public Integer traceMemoryFootprint = 0
	public Integer nbRetries = 0
	

	/**
 * TODO
 */
	def static Result merge(Set<Result> results) {
		
//		if (results.size < 2)
//			throw new Exception ("Cannot merge less than two results!")
		
		val ret = new Result

		for (p : Result.declaredFields) {
			switch (p.type) {
				Class<String>: {
					p.set(ret, p.get(results.get(0)))
				}
				Class<Long>: {
					var long sum = 0
					for (r : results) {
						sum = sum + p.getLong(r)
					}
					val long mean = sum / results.size
					p.setLong(ret, mean)
				}
				Class<Integer>: {
					var int sum = 0
{'fraction_non_alphanumeric': 0.1054872280037843, 'fraction_numerical': 0.010406811731315043, 'mean_word_length': 3.1881188118811883, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, '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': '2280604', 'n_tokens_mistral': 834, 'n_tokens_neox': 698, 'n_words': 198}