static Map, Bool> ai_isRuleSuitableForFunction_cache = synchroHashMap(); static bool ai_isRuleSuitableForFunction(S rule, S f) { Pair p = pair(rule, f); Bool b = ai_isRuleSuitableForFunction_cache.get(p); if (b != null) ret b; try { callAndMake(f, rule, null); ai_isRuleSuitableForFunction_cache.put(p, true); true; } catch e { if (shortClassNameIs(e, "UnsuitableRuleException")) { ai_isRuleSuitableForFunction_cache.put(p, false); false; } else { ai_isRuleSuitableForFunction_cache.put(p, false); printException(e); throw FunctionIsBroken(f); } } }