blob: 534752185d2d1bc06c660be61bc94e4970cbf5a7 (
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
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.store.query.viatra.internal.matcher;
import tools.refinery.viatra.runtime.matchers.tuple.ITuple;
import tools.refinery.store.map.Cursor;
import tools.refinery.store.tuple.Tuple;
import java.util.Iterator;
class RelationalCursor implements Cursor<Tuple, Boolean> {
private final Iterator<? extends ITuple> tuplesIterator;
private boolean terminated;
private Tuple key;
public RelationalCursor(Iterator<? extends ITuple> tuplesIterator) {
this.tuplesIterator = tuplesIterator;
}
@Override
public Tuple getKey() {
return key;
}
@Override
public Boolean getValue() {
return true;
}
@Override
public boolean isTerminated() {
return terminated;
}
@Override
public boolean move() {
if (!terminated && tuplesIterator.hasNext()) {
key = MatcherUtils.toRefineryTuple(tuplesIterator.next());
return true;
}
terminated = true;
return false;
}
}
|