Warning: session_start(): open(/var/lib/php/sessions/sess_ig3k3hfi5qplpofrg971o57krd, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// script that recognizes images or performs some kind of analysis on an image
concept G22RecognizerScript > G22LeftArrowScript {
@Override GazelleV_LeftArrowScriptParser makeParser() {
var parser = super.makeParser();
parser.addVar("image", BufferedImage.class, false);
parser.allowTheWorld();
ret parser;
}
sclass AnalysisContext {
BufferedImage image;
Map analyzerResults = syncMap();
static O calculating;
O callAnalyzer(long analyzerID) {
var analyzer = getConcept G22RecognizerScript(analyzerID);
if (analyzer == null)
fail("Analyzer with ID " + analyzerID + " not found");
ret callAnalyzer(analyzer);
}
O callAnalyzer(G22RecognizerScript analyzer) {
ret analyzer.get(this);
}
}
class CompiledAnalyzer > LASCompileResult {
settable double timeout = 10;
O get(BufferedImage image) {
AnalysisContext context = new(image);
ret get(context);
}
O get(AnalysisContext context) {
if (context.containsKey(this)) {
O value = context.get(this);
if (value == AnalysisContext.calculating)
fail("Recursive call to analyzer " + this);
ret ((OKOrError) value)!;
}
context.put(this, AnalysisContext.calculating);
context.put(this, okOrError(-> {
if (parsedScript == null) rethrow(compileError);
if (image == null) fail("Need image");
ret evalWithTimeoutOrFail(timeout, -> {
new VarContext ctx;
ctx.set(+image);
ret parsedScript.get(ctx);
});
}));
}
}
LASCompileResult newCompileResult() { ret new CompiledAnalyzer; }
CompiledAnalyzer compileForAutoRun() {
ret (CompiledAnalyzer) super.compileForAutoRun();
}
}