use of nars.language.Term in project opennars by opennars.
the class SentenceTablePanel method newSelectedGraphPanel.
public void newSelectedGraphPanel() {
Term[] sel = new Term[table.getSelectedRows().length];
int k = 0;
for (int i : table.getSelectedRows()) {
Sentence w = (Sentence) table.getValueAt(i, 1);
sel[k] = w.term;
k++;
}
TermSyntaxVis tt = new TermSyntaxVis(sel);
syntaxPanel = new PCanvas(tt);
syntaxPanel.setZoom(10f);
NWindow w = new NWindow("", syntaxPanel);
w.setSize(400, 400);
w.setVisible(true);
// ProcessingGraphPanel2 pgp = new ProcessingGraphPanel2(getSelectedRows(1)) {
//
// @Override
// public DirectedMultigraph getGraph() {
//
// DefaultGraphizer graphizer = new DefaultGraphizer(true, true, true, true, 0, false, false) {
//
// protected void addSentence(NARGraph g, Sentence s) {
// Term t = s.content;
// addTerm(g, t);
// //g.addEdge(s, s.content, new NARGraph.SentenceContent());
//
// if (t instanceof CompoundTerm) {
// CompoundTerm ct = ((CompoundTerm) t);
// Set<Term> contained = ct.getContainedTerms();
//
// for (Term x : contained) {
// addTerm(g, x);
// if (ct.containsTerm(x)) {
// g.addEdge(x, t, new NARGraph.TermContent());
// }
//
// for (Term y : contained) {
// addTerm(g, y);
//
// if (x != y) {
// if (x.containsTerm(y)) {
// g.addEdge(y, x, new NARGraph.TermContent());
// }
// }
// }
// }
// }
// }
//
// @Override
// public void onTime(NARGraph g, long time) {
// super.onTime(g, time);
//
// for (Object o : getItems()) {
//
// if (o instanceof Task) {
// g.addVertex(o);
// addSentence(g, ((Task) o).sentence);
// } else if (o instanceof Sentence) {
// g.addVertex(o);
// addSentence(g, (Sentence) o);
// }
// }
// //add sentences
// }
//
// };
//
// app.updating = true;
//
// graphizer.setShowSyntax(showSyntax);
//
// NARGraph g = new NARGraph();
// g.add(nar, newSelectedGraphFilter(), graphizer);
// return g;
// }
//
// @Override
// public int edgeColor(Object edge) {
// return NARSwing.getColor(edge.toString(), 0.5f, 0.5f).getRGB();
// }
//
// @Override
// public float edgeWeight(Object edge) {
// return 10;
// }
//
// @Override
// public int vertexColor(Object vertex) {
// return NARSwing.getColor(vertex.toString(), 0.5f, 0.5f).getRGB();
// }
//
// };
// NWindow w = new NWindow("", pgp);
// w.setSize(400, 400);
// w.setVisible(true);
}
use of nars.language.Term in project opennars by opennars.
the class Activate method execute.
@Override
protected List<Task> execute(Operation operation, Term[] args, Memory memory) {
// Operation content = (Operation) task.getContent();
// Operator op = content.getOperator();
TestChamber.executed = true;
System.out.println("Executed: " + this);
for (Term t : args) {
if (t.equals(Term.SELF))
continue;
System.out.println(" --- " + t);
chamb.operateObj(t.toString(), "activate");
break;
}
return null;
}
use of nars.language.Term in project opennars by opennars.
the class Deactivate method execute.
@Override
protected List<Task> execute(Operation operation, Term[] args, Memory memory) {
// Operation content = (Operation) task.getContent();
// Operator op = content.getOperator();
TestChamber.executed = true;
System.out.println("Executed: " + this);
for (Term t : args) {
if (t.equals(Term.SELF))
continue;
System.out.println(" --- " + t);
chamb.operateObj(t.toString(), "deactivate");
break;
}
return null;
}
use of nars.language.Term in project opennars by opennars.
the class Goto method execute.
@Override
protected List<Task> execute(Operation operation, Term[] args, Memory memory) {
// Operation content = (Operation) task.getContent();
// Operator op = content.getOperator();
TestChamber.executed = true;
TestChamber.executed_going = true;
System.out.println("Executed: " + this);
for (Term t : args) {
if (t.equals(Term.SELF))
continue;
System.out.println(" --- " + t);
chamb.operateObj(t.toString(), "go-to");
break;
}
return null;
}
use of nars.language.Term in project opennars by opennars.
the class Pick method execute.
@Override
protected List<Task> execute(Operation operation, Term[] args, Memory memory) {
// Operation content = (Operation) task.getContent();
// Operator op = content.getOperator();
TestChamber.executed = true;
System.out.println("Executed: " + this);
for (Term t : args) {
if (t.equals(Term.SELF))
continue;
System.out.print(" --- " + t);
chamb.operateObj(t.toString(), "pick");
break;
}
return null;
}
Aggregations