sclass BEACalculations { GazelleBEA mod; void reactAllInputsWithSomePatterns() { forEach reactInputWithSomePatterns(mod.beaObjectsOfType("input")); } void reactInputWithSomePatterns(BEAObject input) { S text = getString text(input); if (empty(text)) ret; int max = 3, n = countConceptsWhereIC BEAObject(+input, type := "match"); for (BEAObject pattern : conceptsWhereIC BEAObject(type := "Pattern")) { if (n >= max) break; if (reactInputWithPattern(input, pattern) != null) ++n; ++n; } } SS matchInputWithPattern(BEAObject input, BEAObject pattern) { ret flexMatchAngleBracketVarsIC_first(getString text(pattern), getString text(input)); } BEAObject reactInputWithPattern(BEAObject input, BEAObject pattern) { SS mapping = matchInputWithPattern(pattern, input); if (mapping == null) null; ret cnew(BEAObject, type := "Match", +input, +pattern, +mapping); } }