blob: 3157c9f021659682bd32d1bb33f85dca091d7b9b (
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
|
package org.eclipse.viatra.solver.data.model;
import java.util.Map;
import org.eclipse.viatra.solver.data.map.Cursor;
import org.eclipse.viatra.solver.data.model.representation.DataRepresentation;
public class ModelCursor {
final Map<DataRepresentation<?, ?>,Cursor<?,?>> cursors;
public ModelCursor(Map<DataRepresentation<?, ?>, Cursor<?, ?>> cursors) {
super();
this.cursors = cursors;
}
@SuppressWarnings("unchecked")
public <K,V> Cursor<K,V> getCursor(DataRepresentation<K, V> representation) {
Cursor<?, ?> cursor = cursors.get(representation);
if(cursor != null) {
return (Cursor<K, V>) cursor;
} else {
throw new IllegalArgumentException("ModelCursor does not contain cursor for representation "+representation);
}
}
}
|