All Downloads are FREE. Search and download functionalities are using the official Maven repository.

astra.reasoner.node.BindReasonerNode Maven / Gradle / Ivy

There is a newer version: 1.4.2
Show newest version
package astra.reasoner.node;

import java.util.Map;
import java.util.Stack;

import astra.formula.Bind;
import astra.reasoner.Reasoner;
import astra.reasoner.util.BindingsEvaluateVisitor;
import astra.term.Term;

public class BindReasonerNode extends ReasonerNode {
    Bind bind;

    public BindReasonerNode(ReasonerNode parent, Bind bind, Map initial, boolean singleResult) {
        super(parent, singleResult);

        this.bind = bind;
        this.initial = initial;
    }

    @Override
    public boolean solve(Reasoner reasoner, Stack stack) {
        visitor = new BindingsEvaluateVisitor(initial, reasoner.agent());
        initial.put(bind.variable().id(), (Term) bind.accept(visitor));
        solutions.add(initial);
        finished = true;
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy