Search in sources :

Example 1 with InteractiveModeConsole

use of org.openksavi.sponge.engine.interactive.InteractiveModeConsole in project sponge by softelnet.

the class DefaultInteractiveMode method loop.

@Override
public void loop() {
    running.set(true);
    try (InteractiveModeConsole console = consoleSupplier.get()) {
        activeConsole = console;
        if (!console.isOpen()) {
            console.open();
        }
        ScriptKnowledgeBaseInterpreter scriptInterpreter = getScriptKnowledgeBaseInterpreter();
        console.print(getWelcomeMessage());
        while (true) {
            try {
                if (!iteration(console, scriptInterpreter)) {
                    break;
                }
            } catch (Throwable e) {
                handleException("interactive", e);
            }
        }
    } finally {
        running.set(false);
    }
}
Also used : ScriptKnowledgeBaseInterpreter(org.openksavi.sponge.kb.ScriptKnowledgeBaseInterpreter) InteractiveModeConsole(org.openksavi.sponge.engine.interactive.InteractiveModeConsole)

Aggregations

InteractiveModeConsole (org.openksavi.sponge.engine.interactive.InteractiveModeConsole)1 ScriptKnowledgeBaseInterpreter (org.openksavi.sponge.kb.ScriptKnowledgeBaseInterpreter)1