blob: 9f897e463999667cea7508c88bd2651cb5ef6d0b (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/*
* 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(Collection<PartialRelation> supertypes, boolean abstractType) {
public static Builder builder() {
return new Builder();
}
public static class Builder {
private final Set<PartialRelation> supertypes = new LinkedHashSet<>();
private boolean abstractType;
private Builder() {
}
public Builder supertypes(Collection<PartialRelation> supertypes) {
this.supertypes.addAll(supertypes);
return this;
}
public Builder supertypes(PartialRelation... supertypes) {
return supertypes(List.of(supertypes));
}
public Builder supertype(PartialRelation supertype) {
supertypes.add(supertype);
return this;
}
public Builder abstractType(boolean abstractType) {
this.abstractType = abstractType;
return this;
}
public Builder abstractType() {
return abstractType(true);
}
public TypeInfo build() {
return new TypeInfo(Collections.unmodifiableSet(supertypes), abstractType);
}
}
}
|