<commit_before>package org.openlca.core.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "tbl_impact_categories")
public class ImpactCategory extends RootEntity {

	@OneToMany(cascade = { CascadeType.ALL }, orphanRemoval = true)
	@JoinColumn(name = "f_impact_category")
	public final List<ImpactFactor> impactFactors = new ArrayList<>();

	@Column(name = "reference_unit")
	public String referenceUnit;

	@Override
	public ImpactCategory clone() {
		ImpactCategory clone = new ImpactCategory();
		Util.cloneRootFields(this, clone);
		clone.referenceUnit = referenceUnit;
		for (ImpactFactor f : impactFactors)
			clone.impactFactors.add(f.clone());
		return clone;
	}

}<commit_msg>Added getFactor(Flow) and getFactor(refId) method to impact category<commit_after>package org.openlca.core.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "tbl_impact_categories")
public class ImpactCategory extends RootEntity {

	@OneToMany(cascade = { CascadeType.ALL }, orphanRemoval = true)
	@JoinColumn(name = "f_impact_category")
	public final List<ImpactFactor> impactFactors = new ArrayList<>();

	@Column(name = "reference_unit")
	public String referenceUnit;
	
	@Override
	public ImpactCategory clone() {
		ImpactCategory clone = new ImpactCategory();
		Util.cloneRootFields(this, clone);
		clone.referenceUnit = referenceUnit;
		for (ImpactFactor f : impactFactors)
			clone.impactFactors.add(f.clone());
		return clone;
	}

	public ImpactFactor getFactor(Flow flow) {
		if (flow == null)
			return null;
		return getFactor(flow.refId);
	}

	public ImpactFactor getFactor(String refId) {
		for (ImpactFactor factor : impactFactors)
			if (factor.flow != null && factor.flow.refId.equals(refId))
				return factor;
		return null;
	}
	
}
{'fraction_non_alphanumeric': 0.10654627539503386, 'fraction_numerical': 0.0, 'mean_word_length': 5.674698795180723, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6889369', 'n_tokens_mistral': 706, 'n_tokens_neox': 673, 'n_words': 158}