<commit_before>package org.openlca.app.results.requirements;

import org.eclipse.swt.graphics.Image;
import org.openlca.app.components.ContributionImage;
import org.openlca.app.db.Database;
import org.openlca.app.rcp.images.Images;
import org.openlca.app.results.DQLabelProvider;
import org.openlca.app.util.Labels;
import org.openlca.app.util.Numbers;
import org.openlca.core.database.CurrencyDao;
import org.openlca.core.math.data_quality.DQResult;
import org.openlca.core.model.FlowType;
import org.openlca.core.model.ModelType;
import org.openlca.core.model.descriptors.FlowDescriptor;

class LabelProvider extends DQLabelProvider {

	private final ContributionImage cimg = new ContributionImage();
	private final DQResult dqResult;
	private final Costs costs;
	private final String currency;

	public LabelProvider(DQResult dqResult, Costs costs) {
		super(dqResult,
			dqResult == null ? null : dqResult.setup.processSystem,
			costs == Costs.NONE ? 4 : 5);
		this.dqResult = dqResult;
		this.costs = costs;
		var currency = costs != null && costs != Costs.NONE
			? new CurrencyDao(Database.get()).getReferenceCurrency()
			: null;
		this.currency = currency == null
			? "?"
			: currency.code;
	}

	@Override
	public void dispose() {
		cimg.dispose();
		super.dispose();
	}

	@Override
	public Image getImage(Object obj, int col) {
		if (!(obj instanceof Item))
			return null;
		Item item = (Item) obj;
		switch (col) {

			case 0:
				return item.isCategory()
					? Images.getForCategory(ModelType.PROCESS)
					: Images.get(ModelType.PROCESS);

			// flow icon
			case 1:
				if (item.isCategory() || item.isChild())
					return null;
				return item.asProvider().hasWasteFlow()
					? Images.get(FlowType.WASTE_FLOW)
					: Images.get(FlowType.PRODUCT_FLOW);<commit_msg>show product system icons for sub-systems in<commit_after>package org.openlca.app.results.requirements;

import org.eclipse.swt.graphics.Image;
import org.openlca.app.components.ContributionImage;
import org.openlca.app.db.Database;
import org.openlca.app.rcp.images.Images;
import org.openlca.app.results.DQLabelProvider;
import org.openlca.app.util.Labels;
import org.openlca.app.util.Numbers;
import org.openlca.core.database.CurrencyDao;
import org.openlca.core.math.data_quality.DQResult;
import org.openlca.core.model.FlowType;
import org.openlca.core.model.ModelType;
import org.openlca.core.model.descriptors.FlowDescriptor;

class LabelProvider extends DQLabelProvider {

	private final ContributionImage cimg = new ContributionImage();
	private final DQResult dqResult;
	private final Costs costs;
	private final String currency;

	public LabelProvider(DQResult dqResult, Costs costs) {
		super(dqResult,
			dqResult == null ? null : dqResult.setup.processSystem,
			costs == Costs.NONE ? 4 : 5);
		this.dqResult = dqResult;
		this.costs = costs;
		var currency = costs != null && costs != Costs.NONE
			? new CurrencyDao(Database.get()).getReferenceCurrency()
			: null;
		this.currency = currency == null
			? "?"
			: currency.code;
	}

	@Override
	public void dispose() {
		cimg.dispose();
		super.dispose();
	}

	@Override
	public Image getImage(Object obj, int col) {
		if (!(obj instanceof Item))
			return null;
		Item item = (Item) obj;
		switch (col) {

			// process, sub-system, or category icon
			case 0:
				if (item.isCategory())
					return Images.getForCategory(ModelType.PROCESS);
				if (item.isChild()) {
					var product = item.asChild().product;
					return product == null
						? Images.get(ModelType.PROCESS)
					    : Images.get(product.process());
				}
				if (item.isProvider()) {
					var provider = item.asProvider().product;
					return provider == null
						? Images.get(ModelType.PROCESS)
						: Images.get(provider.process());
				}
				return null;

			// flow icon
			case 1:
				if (item.isCategory() || item.isChild())
					return null;
				return item.asProvider().hasWasteFlow()
					? Images.get(FlowType.WASTE_FLOW)
					: Images.get(FlowType.PRODUCT_FLOW);
{'fraction_non_alphanumeric': 0.12131065532766383, 'fraction_numerical': 0.002001000500250125, 'mean_word_length': 3.9127764127764126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '139467', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1305, 'n_words': 278}