Search in sources :

Example 76 with Term

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);
}
Also used : NWindow(automenta.vivisect.swing.NWindow) PCanvas(automenta.vivisect.swing.PCanvas) Term(nars.language.Term) TermSyntaxVis(nars.gui.output.graph.TermSyntaxVis) Sentence(nars.entity.Sentence)

Example 77 with Term

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;
}
Also used : Term(nars.language.Term)

Example 78 with Term

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;
}
Also used : Term(nars.language.Term)

Example 79 with Term

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;
}
Also used : Term(nars.language.Term)

Example 80 with Term

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;
}
Also used : Term(nars.language.Term)

Aggregations

Term (nars.language.Term)109 CompoundTerm (nars.language.CompoundTerm)66 BudgetValue (nars.entity.BudgetValue)48 TruthValue (nars.entity.TruthValue)46 Sentence (nars.entity.Sentence)40 Task (nars.entity.Task)37 Statement (nars.language.Statement)28 Conjunction (nars.language.Conjunction)20 Inheritance (nars.language.Inheritance)19 Stamp (nars.entity.Stamp)17 Concept (nars.entity.Concept)14 Implication (nars.language.Implication)13 Product (nars.language.Product)11 NAR (nars.main.NAR)9 Interval (nars.language.Interval)8 Test (org.junit.Test)8 HashMap (java.util.HashMap)7 SetExt (nars.language.SetExt)7 SetInt (nars.language.SetInt)7 Variable (nars.language.Variable)7