aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeInfo.java
blob: e6bdaff2594094dad7d14ab2942cd1392fca4673 (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
/*
 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: EPL-2.0
 */
package tools.refinery.store.reasoning.translator.typehierarchy;

import tools.refinery.store.reasoning.representation.PartialRelation;

import java.util.*;

public record TypeInfo(Set<PartialRelation> supertypes, boolean abstractType) {
	public TypeInfo(Collection<PartialRelation> supertypes, boolean abstractType) {
		this(Set.copyOf(supertypes), abstractType);
	}

	public TypeInfo addSupertype(PartialRelation newSupertype) {
		var newSupertypes = new ArrayList<PartialRelation>(supertypes.size() + 1);
		newSupertypes.addAll(supertypes);
		newSupertypes.add(newSupertype);
		return new TypeInfo(newSupertypes, abstractType);
	}
}