Skip to content

Commit 502a61d

Browse files
committed
Extend ExecutorFactory to account for different solvers
1 parent 0b11974 commit 502a61d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

com.siemens.jminizinc.core/src/main/java/at/siemens/ct/jmz/executor/ExecutorFactory.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,20 @@ public ExecutorFactory(Class<E> executorClass) {
2525
this.executorClass = executorClass;
2626
}
2727

28-
public E createExecutor(String identifier) {
28+
public E createExecutor(String identifier, MiniZincSolver miniZincSolver) {
2929
try {
30-
Constructor<E> constructor = executorClass.getConstructor(String.class);
31-
return constructor.newInstance(identifier);
30+
Constructor<E> constructor = executorClass.getConstructor(String.class, MiniZincSolver.class);
31+
return constructor.newInstance(identifier, miniZincSolver);
32+
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException
33+
| IllegalArgumentException | InvocationTargetException e) {
34+
throw new IllegalStateException(e);
35+
}
36+
}
37+
38+
public E createExecutor(String identifier, FlatZincSolver flatZincSolver) {
39+
try {
40+
Constructor<E> constructor = executorClass.getConstructor(String.class, FlatZincSolver.class);
41+
return constructor.newInstance(identifier, flatZincSolver);
3242
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException
3343
| IllegalArgumentException | InvocationTargetException e) {
3444
throw new IllegalStateException(e);

0 commit comments

Comments
 (0)