<commit_before>package eu.ydp.empiria.player.client.module.item;

import com.google.common.collect.Range;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.NodeList;

public class ReportFeedbacksParser {

	public ProgressToStringRangeMap parse(NodeList feedbacks) {
		ProgressToStringRangeMap reportFeedbacks = new ProgressToStringRangeMap();

		for (int i = 0; i < feedbacks.getLength(); i++) {
			Element feedbackElement = (Element) feedbacks.item(i);

			Range<Integer> range = getRangeFromElement(feedbackElement);
			String feedback = feedbackElement.getFirstChild().toString();

			reportFeedbacks.addValueForRange(range, feedback);
		}
		return reportFeedbacks;
	}

	private static Range<Integer> getRangeFromElement(Element feedbackElement) {
		int from = Integer.parseInt(feedbackElement.getAttribute("from"));
		int to = Integer.parseInt(feedbackElement.getAttribute("to"));
		return Range.closed(from, to);
	}
}<commit_msg>[YPUB-6280] report feedbacks added (review refactor)<commit_after>package eu.ydp.empiria.player.client.module.item;

import com.google.common.collect.Range;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.NodeList;

public class ReportFeedbacksParser {

	public ProgressToStringRangeMap parse(NodeList feedbacks) {
		ProgressToStringRangeMap reportFeedbacks = new ProgressToStringRangeMap();

		for (int i = 0; i < feedbacks.getLength(); i++) {
			Element feedbackElement = (Element) feedbacks.item(i);

			Range<Integer> range = getRangeFromElement(feedbackElement);
			String feedback = feedbackElement.getFirstChild().toString();

			reportFeedbacks.addValueForRange(range, feedback);
		}
		return reportFeedbacks;
	}

	private Range<Integer> getRangeFromElement(Element feedbackElement) {
		int from = Integer.parseInt(feedbackElement.getAttribute("from"));
		int to = Integer.parseInt(feedbackElement.getAttribute("to"));
		return Range.closed(from, to);
	}
}
{'fraction_non_alphanumeric': 0.11333333333333333, 'fraction_numerical': 0.003076923076923077, 'mean_word_length': 6.017985611510792, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '7661691', 'n_tokens_mistral': 605, 'n_tokens_neox': 560, 'n_words': 112}