astra.reasoner.NewReasoner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of astra-interpreter Show documentation
Show all versions of astra-interpreter Show documentation
Core interpreter artifact for the ASTRA Language
package astra.reasoner;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import astra.core.Agent;
import astra.formula.AND;
import astra.formula.Bind;
import astra.formula.BooleanTermFormula;
import astra.formula.BracketFormula;
import astra.formula.Comparison;
import astra.formula.Formula;
import astra.formula.IsDone;
import astra.formula.ModuleFormula;
import astra.formula.NOT;
import astra.formula.OR;
import astra.formula.Predicate;
import astra.reasoner.node.ANDReasonerNodeFactory;
import astra.reasoner.node.BindReasonerNodeFactory;
import astra.reasoner.node.BooleanTermFormulaNodeFactory;
import astra.reasoner.node.BracketReasonerNodeFactory;
import astra.reasoner.node.ComparisonReasonerNodeFactory;
import astra.reasoner.node.IsDoneReasonerNodeFactory;
import astra.reasoner.node.ModuleFormulaReasonerNodeFactory;
import astra.reasoner.node.NOTReasonerNodeFactory;
import astra.reasoner.node.ORReasonerNodeFactory;
import astra.reasoner.node.PredicateReasonerNodeFactory;
import astra.reasoner.node.ReasonerNode;
import astra.reasoner.node.ReasonerNodeFactory;
import astra.term.Term;
public class NewReasoner implements Reasoner {
public static Map, ReasonerNodeFactory extends Formula>> factories = new HashMap<>();
static {
factories.put(Predicate.class, new PredicateReasonerNodeFactory());
factories.put(AND.class, new ANDReasonerNodeFactory());
factories.put(OR.class, new ORReasonerNodeFactory());
factories.put(NOT.class, new NOTReasonerNodeFactory());
factories.put(BracketFormula.class, new BracketReasonerNodeFactory());
factories.put(Comparison.class, new ComparisonReasonerNodeFactory());
// factories.put(AcreFormula.class, new AcreFormulaReasonerNodeFactory());
factories.put(IsDone.class, new IsDoneReasonerNodeFactory());
factories.put(Bind.class, new BindReasonerNodeFactory());
factories.put(ModuleFormula.class, new ModuleFormulaReasonerNodeFactory());
factories.put(BooleanTermFormula.class, new BooleanTermFormulaNodeFactory());
}
List sources = new LinkedList();
Agent agent;
public NewReasoner(Agent agent) {
this.agent = agent;
}
@Override
public void addSource(Queryable source) {
sources.add(source);
}
@Override
public List