diff options
Diffstat (limited to 'subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/KeyedEnumerablePConstraint.java')
-rw-r--r-- | subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/KeyedEnumerablePConstraint.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/KeyedEnumerablePConstraint.java b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/KeyedEnumerablePConstraint.java new file mode 100644 index 00000000..91eea817 --- /dev/null +++ b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/KeyedEnumerablePConstraint.java | |||
@@ -0,0 +1,39 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2004-2010 Gabor Bergmann and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | |||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | ||
11 | |||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | ||
13 | |||
14 | /** | ||
15 | * @author Gabor Bergmann | ||
16 | * | ||
17 | */ | ||
18 | public abstract class KeyedEnumerablePConstraint<KeyType> extends EnumerablePConstraint { | ||
19 | |||
20 | protected KeyType supplierKey; | ||
21 | |||
22 | public KeyedEnumerablePConstraint(PBody pBody, Tuple variablesTuple, | ||
23 | KeyType supplierKey) { | ||
24 | super(pBody, variablesTuple); | ||
25 | this.supplierKey = supplierKey; | ||
26 | } | ||
27 | |||
28 | @Override | ||
29 | protected String toStringRestRest() { | ||
30 | return supplierKey == null ? "$any(null)" : keyToString(); | ||
31 | } | ||
32 | |||
33 | protected abstract String keyToString(); | ||
34 | |||
35 | public KeyType getSupplierKey() { | ||
36 | return supplierKey; | ||
37 | } | ||
38 | |||
39 | } | ||