Search in sources :

Example 1 with UniqueEdge

use of nars.gui.util.NARGraph.UniqueEdge in project opennars by opennars.

the class TermSyntaxVis method addSyntax.

public static Term addSyntax(NARGraph g, Term t) {
    if (t instanceof CompoundTerm) {
        CompoundTerm ct = (CompoundTerm) t;
        g.addVertex(ct);
        int n = 0;
        for (Term s : ct.term) {
            Term v = addSyntax(g, s);
            g.addEdge(ct, v, new UniqueEdge(ct.operator() + ":" + n));
            n++;
        }
        return ct;
    } else {
        g.addVertex(t);
        return t;
    }
}
Also used : CompoundTerm(nars.language.CompoundTerm) UniqueEdge(nars.gui.util.NARGraph.UniqueEdge) CompoundTerm(nars.language.CompoundTerm) Term(nars.language.Term)

Aggregations

UniqueEdge (nars.gui.util.NARGraph.UniqueEdge)1 CompoundTerm (nars.language.CompoundTerm)1 Term (nars.language.Term)1