"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cast_de_nrw_schule_svws_logger_LogConsumerVector = exports.LogConsumerVector = void 0;
const JavaObject_1 = require("../java/lang/JavaObject");
const StringBuilder_1 = require("../java/lang/StringBuilder");
const Vector_1 = require("../java/util/Vector");
const LogLevel_1 = require("../logger/LogLevel");
class LogConsumerVector extends JavaObject_1.JavaObject {
    printTime;
    printLevel;
    logData = new Vector_1.Vector();
    /**
     * Implementation for method overloads of 'constructor'
     */
    constructor(__param0, __param1) {
        super();
        if ((typeof __param0 === "undefined") && (typeof __param1 === "undefined")) {
            this.printTime = false;
            this.printLevel = false;
        }
        else if (((typeof __param0 !== "undefined") && typeof __param0 === "boolean") && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
            let printTime = __param0;
            let printLevel = __param1;
            this.printTime = printTime;
            this.printLevel = printLevel;
        }
        else
            throw new Error('invalid method overload');
    }
    /**
     * Hängt einen anderen Log vom gleichen Typ an diesen an.
     *
     * @param log   der anzuhängende Log
     */
    append(log) {
        this.logData.addAll(log.logData);
    }
    /**
     * Diese Methode implementiert das funktionale Interface java.util.function.Consumer
     * und hängt die empfangenen Log-Informationen an den Vektor an.
     *
     * @param t   die anzuhängenden Log-Informationen
     */
    accept(t) {
        if (t === null)
            return;
        this.logData.add(t);
    }
    /**
     * Gibt den Vektor mit den gesammelten Log-Informationen zurück.
     *
     * @return der Vektor mit den gesammelten Log-Informationen
     */
    getLogData() {
        return this.logData;
    }
    /**
     * Implementation for method overloads of 'getStrings'
     */
    getStrings(__param0) {
        if ((typeof __param0 === "undefined")) {
            return this.getStrings("");
        }
        else if (((typeof __param0 !== "undefined") && ((__param0 instanceof String) || (typeof __param0 === "string")))) {
            let indent = __param0;
            let result = new Vector_1.Vector();
            for (let i = 0; i < this.logData.size(); i++) {
                let data = this.logData.get(i);
                if (data === null)
                    continue;
                result.add(indent.valueOf() + data.getText().valueOf());
            }
            return result;
        }
        else
            throw new Error('invalid method overload');
    }
    /**
     * Implementation for method overloads of 'getText'
     */
    getText(__param0, __param1) {
        if ((typeof __param0 === "undefined") && (typeof __param1 === "undefined")) {
            return this.getText(LogLevel_1.LogLevel.INFO, "");
        }
        else if (((typeof __param0 !== "undefined") && ((__param0 instanceof JavaObject_1.JavaObject) && (__param0.isTranspiledInstanceOf('de.nrw.schule.svws.logger.LogLevel')))) && (typeof __param1 === "undefined")) {
            let level = (0, LogLevel_1.cast_de_nrw_schule_svws_logger_LogLevel)(__param0);
            return this.getText(level, "");
        }
        else if (((typeof __param0 !== "undefined") && ((__param0 instanceof JavaObject_1.JavaObject) && (__param0.isTranspiledInstanceOf('de.nrw.schule.svws.logger.LogLevel')))) && ((typeof __param1 !== "undefined") && ((__param1 instanceof String) || (typeof __param1 === "string")))) {
            let level = (0, LogLevel_1.cast_de_nrw_schule_svws_logger_LogLevel)(__param0);
            let indent = __param1;
            let sb = new StringBuilder_1.StringBuilder();
            for (let i = 0; i < this.logData.size(); i++) {
                let data = this.logData.get(i);
                if (data === null)
                    continue;
                if (data.getLevel().toInteger() > level.toInteger())
                    continue;
                sb.append(indent);
                sb.append(data.getText());
                sb.append("\n");
            }
            return sb.toString();
        }
        else
            throw new Error('invalid method overload');
    }
    isTranspiledInstanceOf(name) {
        return ['java.util.function.Consumer', 'de.nrw.schule.svws.logger.LogConsumerVector'].includes(name);
    }
}
exports.LogConsumerVector = LogConsumerVector;
function cast_de_nrw_schule_svws_logger_LogConsumerVector(obj) {
    return obj;
}
exports.cast_de_nrw_schule_svws_logger_LogConsumerVector = cast_de_nrw_schule_svws_logger_LogConsumerVector;
//# sourceMappingURL=LogConsumerVector.js.map