<commit_before>package com.adiguzel.shopr.explanation.model;

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;

import com.uwetrottmann.shopr.algorithm.model.Item;

public class Explanation {
	private Item item;
	private Set<DimensionArgument> primaryArguments;
	private Set<DimensionArgument> supportingArguments;
	private Set<ContextArgument> contextArguments;
	private String branch;
	
	public Explanation(Item item) {
		this.item = item;
		primaryArguments = new LinkedHashSet<DimensionArgument>();
		supportingArguments = new LinkedHashSet<DimensionArgument>();
		contextArguments = new LinkedHashSet<ContextArgument>();
	}
	
	public Explanation branch(String branch) {
		this.branch = branch;
		return this;
	}
	
	public String branch() {
		return branch;
	}

	public Set<DimensionArgument> primaryArguments() {
		return primaryArguments;
	}
	
	public Set<DimensionArgument> supportingArguments() {
		return supportingArguments;
	}
	
	public Set<DimensionArgument> contexArguments() {
		return supportingArguments;
	}


	public DimensionArgument mainArgument() {
		if (primaryArguments.iterator().hasNext())
			return primaryArguments.iterator().next();
		else
			return null;
	}

	public void addPrimaryArgument(DimensionArgument argument) {
		primaryArguments.add(argument);
	}
	
	public void addPrimaryArguments(Collection<DimensionArgument> arguments) {
		primaryArguments.addAll(arguments);
	}
	
	public void addSupportingArgument(DimensionArgument argument) {
		supportingArguments.add(argument);
	}
	
	public void addSupportingArguments(Collection<DimensionArgument> arguments) {
		supportingArguments.addAll(arguments);
	}
	
	public void addContextArgument(ContextArgument argument) {
		contextArguments.add(argument);
	}
	
	public void addContextArguments(Collection<ContextArgument> arguments) {
		contextArguments.addAll(arguments);
	}

	public Item item() {
		return item;
	}
}<commit_msg>Expanded Explanation interface with convenience methods.<commit_after>package com.adiguzel.shopr.explanation.model;

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;

import com.uwetrottmann.shopr.algorithm.model.Item;

public class Explanation {
	private Item item;
	private Set<DimensionArgument> primaryArguments;
	private Set<DimensionArgument> supportingArguments;
	private Set<ContextArgument> contextArguments;
	private String branch;
	
	public Explanation(Item item) {
		this.item = item;
		primaryArguments = new LinkedHashSet<DimensionArgument>();
		supportingArguments = new LinkedHashSet<DimensionArgument>();
		contextArguments = new LinkedHashSet<ContextArgument>();
	}
	
	public Explanation branch(String branch) {
		this.branch = branch;
		return this;
	}
	
	public String branch() {
		return branch;
	}

	public Set<DimensionArgument> primaryArguments() {
		return primaryArguments;
	}
	
	public Set<DimensionArgument> supportingArguments() {
		return supportingArguments;
	}
	
	public Set<ContextArgument> contextArguments() {
		return contextArguments;
	}
	
	public DimensionArgument mainArgument() {
		if (primaryArguments.iterator().hasNext())
			return primaryArguments.iterator().next();
		else
			return null;
	}

	public void addPrimaryArgument(DimensionArgument argument) {
		primaryArguments.add(argument);
	}
	
	public void addPrimaryArguments(Collection<DimensionArgument> arguments) {
		primaryArguments.addAll(arguments);
	}
	
	public void addSupportingArgument(DimensionArgument argument) {
		supportingArguments.add(argument);
	}
	
	public void addSupportingArguments(Collection<DimensionArgument> arguments) {
		supportingArguments.addAll(arguments);
	}
	
	public void addContextArgument(ContextArgument argument) {
		contextArguments.add(argument);
	}
	
	public void addContextArguments(Collection<ContextArgument> arguments) {
		contextArguments.addAll(arguments);
	}
	
	public boolean hasPrimaryArguments() {
		return primaryArguments.size() > 0;
	}
	
	public boolean hasSupportingArguments() {
		return supportingArguments.size() > 0;
	}
	
	public boolean hasContextArguments() {
		return contextArguments.size() > 0;
	}

	public Item item() {
		return item;
	}
}
{'fraction_non_alphanumeric': 0.09003831417624521, 'fraction_numerical': 0.0007183908045977011, 'mean_word_length': 5.769854132901134, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 30, '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': '2020307', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1123, 'n_words': 253}