Do not allow placing task on the wrong machine

This commit is contained in:
Arthur Bit-Monnot 2021-04-12 18:17:14 +02:00
parent ddded7da0d
commit fcf0a8b19a

View file

@ -55,6 +55,9 @@ public final class ResourceOrder extends Encoding {
/** Adds the given task to the queue of the given machine. */
public void addTaskToMachine(int machine, Task task) {
if(instance.machine(task) != machine) {
throw new RuntimeException("Task " + task + " cannot be scheduled on machine "+machine);
}
tasksByMachine[machine][nextFreeSlot[machine]] = task;
nextFreeSlot[machine] += 1;
}