aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/containment/ContainmentInfo.java
blob: e3457fa783c03eb549666728a48be55e6a92e6fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.reasoning.translator.containment;

import tools.refinery.store.reasoning.representation.PartialRelation;
import tools.refinery.store.reasoning.translator.TranslationException;
import tools.refinery.store.reasoning.translator.multiplicity.Multiplicity;

public record ContainmentInfo(PartialRelation sourceType, Multiplicity multiplicity,
							  PartialRelation targetType) {
	public ContainmentInfo {
		if (sourceType.arity() != 1) {
			throw new TranslationException(sourceType, "Expected source type %s to be of arity 1, got %d instead"
							.formatted(sourceType, sourceType.arity()));
		}
		if (targetType.arity() != 1) {
			throw new TranslationException(targetType, "Expected target type %s to be of arity 1, got %d instead"
					.formatted(targetType, targetType.arity()));
		}
	}
}