use of suite.lp.compile.impl.CompileGeneralizerImpl in project suite by stupidsing.
the class GeneralizerFactoryTest method test.
private void test(String pattern, String match) {
for (GeneralizerFactory gf : new GeneralizerFactory[] { new CompileGeneralizerImpl(), new SewingGeneralizerImpl() }) {
Generalize_ p = gf.generalizer(Suite.parse(pattern));
assertTrue(Binder.bind(p.apply(gf.mapper().env()), Suite.parse(match), new Trail()));
}
}
use of suite.lp.compile.impl.CompileGeneralizerImpl in project suite by stupidsing.
the class CommandDispatcher method elaborate.
private void elaborate(Node node0, Sink<Node> sink) {
int[] count = { 0 };
NodeEnv<Atom> ne = new CompileGeneralizerImpl().g(node0).source();
Node node1 = ne.node;
Node elab = new Data<Source<Boolean>>(() -> {
String dump = ne.dumpVariables();
if (!dump.isEmpty())
opt.prompt().println(dump);
count[0]++;
return Boolean.FALSE;
});
sink.sink(Tree.of(TermOp.AND___, node1, elab));
if (count[0] == 1)
opt.prompt().println(count[0] + " solution\n");
else
opt.prompt().println(count[0] + " solutions\n");
}
Aggregations