"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cast_de_nrw_schule_svws_core_kursblockung_KursblockungAlgorithmus = exports.KursblockungAlgorithmus = void 0;
const KursblockungOutputs_1 = require("../../core/data/kursblockung/KursblockungOutputs");
const KursblockungAlgorithmusKMatching_1 = require("../../core/kursblockung/KursblockungAlgorithmusKMatching");
const KursblockungDynDaten_1 = require("../../core/kursblockung/KursblockungDynDaten");
const Service_1 = require("../../core/Service");
const KursblockungAlgorithmusSZufaellig_1 = require("../../core/kursblockung/KursblockungAlgorithmusSZufaellig");
const Vector_1 = require("../../java/util/Vector");
const System_1 = require("../../java/lang/System");
class KursblockungAlgorithmus extends Service_1.Service {
    constructor() {
        super();
    }
    handle(input) {
        this.logger.modifyIndent(+4);
        let kursblockungOutputs = new KursblockungOutputs_1.KursblockungOutputs();
        kursblockungOutputs.outputs = new Vector_1.Vector();
        let dynDaten = new KursblockungDynDaten_1.KursblockungDynDaten(this.logger, input);
        let timeMaxGlobal = dynDaten.gibBlockungszeitMillis();
        let algorithmenK = [new KursblockungAlgorithmusKMatching_1.KursblockungAlgorithmusKMatching(this.logger, dynDaten)];
        let algorithmenS = [new KursblockungAlgorithmusSZufaellig_1.KursblockungAlgorithmusSZufaellig(this.logger, dynDaten, false)];
        let timeStart = System_1.System.currentTimeMillis();
        let timeMaxLocal = 1000;
        do {
            for (let iK = 0; iK < algorithmenK.length; iK++) {
                for (let iS = 0; iS < algorithmenS.length; iS++) {
                    algorithmenK[iK].berechne(timeMaxLocal);
                    algorithmenS[iS].berechne(timeMaxLocal);
                    let out = dynDaten.gibErzeugtesKursblockungOutput();
                    kursblockungOutputs.outputs.add(out);
                }
            }
            timeMaxLocal += 100;
        } while (System_1.System.currentTimeMillis() - timeStart < timeMaxGlobal);
        this.logger.modifyIndent(-4);
        return kursblockungOutputs;
    }
    isTranspiledInstanceOf(name) {
        return ['de.nrw.schule.svws.core.Service', 'de.nrw.schule.svws.core.kursblockung.KursblockungAlgorithmus'].includes(name);
    }
}
exports.KursblockungAlgorithmus = KursblockungAlgorithmus;
function cast_de_nrw_schule_svws_core_kursblockung_KursblockungAlgorithmus(obj) {
    return obj;
}
exports.cast_de_nrw_schule_svws_core_kursblockung_KursblockungAlgorithmus = cast_de_nrw_schule_svws_core_kursblockung_KursblockungAlgorithmus;
//# sourceMappingURL=KursblockungAlgorithmus.js.map