diff options
Diffstat (limited to 'model-data/src/main/java/org/eclipse/viatra/solver/data/model/ModelDiffCursor.java')
-rw-r--r-- | model-data/src/main/java/org/eclipse/viatra/solver/data/model/ModelDiffCursor.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/model-data/src/main/java/org/eclipse/viatra/solver/data/model/ModelDiffCursor.java b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/ModelDiffCursor.java new file mode 100644 index 00000000..d3551e47 --- /dev/null +++ b/model-data/src/main/java/org/eclipse/viatra/solver/data/model/ModelDiffCursor.java | |||
@@ -0,0 +1,26 @@ | |||
1 | package org.eclipse.viatra.solver.data.model; | ||
2 | |||
3 | import java.util.Map; | ||
4 | |||
5 | import org.eclipse.viatra.solver.data.map.Cursor; | ||
6 | import org.eclipse.viatra.solver.data.map.DiffCursor; | ||
7 | import org.eclipse.viatra.solver.data.model.representation.DataRepresentation; | ||
8 | |||
9 | public class ModelDiffCursor { | ||
10 | final Map<DataRepresentation<?, ?>,DiffCursor<?,?>> diffcursors; | ||
11 | |||
12 | public ModelDiffCursor(Map<DataRepresentation<?, ?>, DiffCursor<?, ?>> diffcursors) { | ||
13 | super(); | ||
14 | this.diffcursors = diffcursors; | ||
15 | } | ||
16 | |||
17 | @SuppressWarnings("unchecked") | ||
18 | public <K,V> DiffCursor<K,V> getCursor(DataRepresentation<K, V> representation) { | ||
19 | Cursor<?, ?> cursor = diffcursors.get(representation); | ||
20 | if(cursor != null) { | ||
21 | return (DiffCursor<K, V>) cursor; | ||
22 | } else { | ||
23 | throw new IllegalArgumentException("ModelCursor does not contain cursor for representation "+representation); | ||
24 | } | ||
25 | } | ||
26 | } | ||