<commit_before>package org.drools.analytics.report.components;

import java.io.Serializable;

/**
 * 
 * @author <NAME>
 */
abstract public class AnalyticsMessageBase implements Serializable,
		Comparable<AnalyticsMessageBase> {
	private static final long serialVersionUID = 9190003495068712452L;

	private static int index = 0;

	public static enum Severity {
		NOTE("Note", "Notes"), WARNING("Warning", "Warnings"), ERROR("Error",
				"Errors");

		private String singular;
		private String tuple;

		private Severity(String singular, String tuple) {
			this.singular = singular;
			this.tuple = tuple;
		}

		public String getSingular() {
			return singular;
		}

		public String getTuple() {
			return tuple;
		}

		@Override
		public String toString() {
			return singular;
		}
	}

	public static enum MessageType {
		NOT_SPECIFIED, RANGE_CHECK, MISSING_EQUALITY, REDUNDANCY, SUBSUMPTION, MISSING_COMPONENT, OPTIMISATION, INCOHERENCE
	}

	protected Severity severity;
	protected MessageType messageType;

	protected int id = index++;
	protected Cause faulty;
	protected String message;

	public int compareTo(AnalyticsMessageBase o) {
		if (id == o.getId()) {
			return 0;
		}

		return (id > o.getId() ? 1 : -1);
	}

	protected AnalyticsMessageBase(Severity severity, MessageType messageType,
			Cause faulty, String message) {
		this.severity = severity;
		this.messageType = messageType;
		this.faulty = faulty;
		this.message = message;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Cause getFaulty() {
		return faulty;
	}

	public void setFaulty(Cause faulty) {
		this.faulty = faulty;
	}

	public MessageType getMessageType() {
		return messageType;
	}

	public void setMessageType(MessageType messageType) {
		this.messageType = messageType;
	}

	public Severity getSeverity() {
		return severity;
	}

	public void setSeverity(Severity severity) {
		this.severity = severity;
	}

	@Override
	public String toString() {
		StringBuffer str = new StringBuffer(severity.singular);

		str.append(" id = ");
		str.append(id);
		str.append(":\n");

		if (faulty != null) {
			str.append("faulty : ");
			str.append(faulty);
			str.append(", ");
		}

		str.append(message);

		str.append("\t]");

		return str.toString();
	}<commit_msg>JBRULES-1393 Analysis improvements and integration<commit_after>package org.drools.analytics.report.components;

import java.io.Serializable;
import java.util.Collection;

/**
 *
 * @author <NAME>
 */
abstract public class AnalyticsMessageBase implements Serializable,
		Comparable<AnalyticsMessageBase> {
	private static final long serialVersionUID = 9190003495068712452L;

	private static int index = 0;

	public static enum Severity {
		NOTE("Note", "Notes"), WARNING("Warning", "Warnings"), ERROR("Error",
				"Errors");

		private String singular;
		private String tuple;

		private Severity(String singular, String tuple) {
			this.singular = singular;
			this.tuple = tuple;
		}

		public String getSingular() {
			return singular;
		}

		public String getTuple() {
			return tuple;
		}

		@Override
		public String toString() {
			return singular;
		}
	}

	public static enum MessageType {
		NOT_SPECIFIED, RANGE_CHECK, MISSING_EQUALITY, REDUNDANCY, SUBSUMPTION, MISSING_COMPONENT, OPTIMISATION, INCOHERENCE
	}

	protected Severity severity;
	protected MessageType messageType;

	protected int id = index++;
	protected Cause faulty;
	protected String message;

	public int compareTo(AnalyticsMessageBase o) {
		if (id == o.getId()) {
			return 0;
		}

		return (id > o.getId() ? 1 : -1);
	}

	protected AnalyticsMessageBase(Severity severity, MessageType messageType,
			Cause faulty, String message) {
		this.severity = severity;
		this.messageType = messageType;
		this.faulty = faulty;
		this.message = message;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Cause getFaulty() {
		return faulty;
	}

	public void setFaulty(Cause faulty) {
		this.faulty = faulty;
	}

	public MessageType getMessageType() {
		return messageType;
	}

	public void setMessageType(MessageType messageType) {
		this.messageType = messageType;
	}

	public Severity getSeverity() {
		return severity;
	}

	public void setSeverity(Severity severity) {
		this.severity = severity;
	}

	@Override
	public String toString() {
		StringBuffer str = new StringBuffer(severity.singular);

		str.append(" id = ");
		str.append(id);
		str.append(":\n");

		if (faulty != null) {
			str.append("faulty : ");
			str.append(faulty);
			str.append(", ");
		}

		str.append(message);

		str.append("\t]");

		return str.toString();
	}

	public abstract Collection<? extends Cause> getCauses();
{'fraction_non_alphanumeric': 0.11209677419354838, 'fraction_numerical': 0.010080645161290322, 'mean_word_length': 3.946161515453639, 'pattern_counts': {'":': 2, '<': 8, '<?xml version=': 0, '>': 10, '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': '3233665', 'n_tokens_mistral': 1853, 'n_tokens_neox': 1584, 'n_words': 414}