diff options
Diffstat (limited to 'subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMaskIdentity.java')
-rw-r--r-- | subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMaskIdentity.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMaskIdentity.java b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMaskIdentity.java new file mode 100644 index 00000000..62746587 --- /dev/null +++ b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMaskIdentity.java | |||
@@ -0,0 +1,51 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2017, Gabor Bergmann, IncQueryLabs Ltd. | ||
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 | package tools.refinery.viatra.runtime.matchers.tuple; | ||
10 | |||
11 | import java.util.List; | ||
12 | |||
13 | /** | ||
14 | * @author Gabor Bergmann | ||
15 | * @since 1.7 | ||
16 | */ | ||
17 | public final class TupleMaskIdentity extends TupleMask { | ||
18 | |||
19 | TupleMaskIdentity(int sourceWidth) { | ||
20 | this(constructLinearSequence(sourceWidth), sourceWidth); | ||
21 | } | ||
22 | TupleMaskIdentity(int[] indices, int sourceWidth) { | ||
23 | super(indices, sourceWidth, indices, true); | ||
24 | } | ||
25 | |||
26 | @Override | ||
27 | public <T> List<T> transform(List<T> original) { | ||
28 | return original; | ||
29 | } | ||
30 | |||
31 | @Override | ||
32 | public Tuple transform(ITuple original) { | ||
33 | return original.toImmutable(); | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | public TupleMask transform(TupleMask mask) { | ||
38 | return mask; | ||
39 | } | ||
40 | |||
41 | @Override | ||
42 | public Tuple revertFrom(ITuple masked) { | ||
43 | return masked.toImmutable(); | ||
44 | } | ||
45 | |||
46 | @Override | ||
47 | public boolean isIdentity() { | ||
48 | return true; | ||
49 | } | ||
50 | |||
51 | } | ||