diff options
Diffstat (limited to 'subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/ITuple.java')
-rw-r--r-- | subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/ITuple.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/ITuple.java b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/ITuple.java new file mode 100644 index 00000000..92014781 --- /dev/null +++ b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/ITuple.java | |||
@@ -0,0 +1,64 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2017, Zoltan Ujhelyi, IncQuery Labs 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 | import java.util.Map; | ||
13 | import java.util.Set; | ||
14 | |||
15 | /** | ||
16 | * Represents both mutable and immutable tuples | ||
17 | * | ||
18 | * @author Zoltan Ujhelyi | ||
19 | * @since 1.7 | ||
20 | * | ||
21 | */ | ||
22 | public interface ITuple { | ||
23 | |||
24 | /** | ||
25 | * @pre: 0 <= index < getSize() | ||
26 | * | ||
27 | * @return the element at the specified index | ||
28 | */ | ||
29 | Object get(int index); | ||
30 | |||
31 | /** | ||
32 | * As the tuple is supposed to be immutable, do not modify the returned array. | ||
33 | * @return the array containing all elements of this Tuple | ||
34 | */ | ||
35 | Object[] getElements(); | ||
36 | |||
37 | /** | ||
38 | * @return the set containing all distinct elements of this Tuple, cast as type T | ||
39 | */ | ||
40 | <T> Set<T> getDistinctElements(); | ||
41 | |||
42 | /** | ||
43 | * @return number of elements | ||
44 | */ | ||
45 | int getSize(); | ||
46 | |||
47 | /** | ||
48 | * Calculates an inverted index of the elements of this pattern. For each element, the index of the (last) | ||
49 | * occurrence is calculated. | ||
50 | * | ||
51 | * @return the inverted index mapping each element of this pattern to its index in the array | ||
52 | */ | ||
53 | Map<Object, Integer> invertIndex(); | ||
54 | |||
55 | /** | ||
56 | * Calculates an inverted index of the elements of this pattern. For each element, the index of all of its | ||
57 | * occurrences is calculated. | ||
58 | * | ||
59 | * @return the inverted index mapping each element of this pattern to its index in the array | ||
60 | */ | ||
61 | Map<Object, List<Integer>> invertIndexWithMupliplicity(); | ||
62 | |||
63 | Tuple toImmutable(); | ||
64 | } \ No newline at end of file | ||