diff options
Diffstat (limited to 'subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java')
-rw-r--r-- | subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java new file mode 100644 index 00000000..c6e31cb7 --- /dev/null +++ b/subprojects/store/src/main/java/tools/refinery/store/representation/cardinality/UpperCardinality.java | |||
@@ -0,0 +1,22 @@ | |||
1 | package tools.refinery.store.representation.cardinality; | ||
2 | |||
3 | public sealed interface UpperCardinality extends Comparable<UpperCardinality> permits FiniteUpperCardinality, | ||
4 | UnboundedUpperCardinality { | ||
5 | default UpperCardinality min(UpperCardinality other) { | ||
6 | return this.compareTo(other) <= 0 ? this : other; | ||
7 | } | ||
8 | |||
9 | default UpperCardinality max(UpperCardinality other) { | ||
10 | return this.compareTo(other) >= 0 ? this : other; | ||
11 | } | ||
12 | |||
13 | UpperCardinality add(UpperCardinality other); | ||
14 | |||
15 | UpperCardinality multiply(UpperCardinality other); | ||
16 | |||
17 | int compareToInt(int value); | ||
18 | |||
19 | static UpperCardinality of(int upperBound) { | ||
20 | return UpperCardinalities.valueOf(upperBound); | ||
21 | } | ||
22 | } | ||