use of catdata.fql.decl.FullQueryExp in project fql by CategoricalData.
the class FqlDisplay method handleInstanceFlowEdge.
private void handleInstanceFlowEdge(Object o) {
InstExp i = (InstExp) o;
Object f = i.accept(new Unit(), new InstExpVisitor<Object, Unit>() {
@Override
public MapExp visit(Unit env, Zero e) {
return null;
}
@Override
public MapExp visit(Unit env, One e) {
return null;
}
@Override
public MapExp visit(Unit env, Two e) {
throw new RuntimeException();
}
@Override
public MapExp visit(Unit env, Plus e) {
return null;
}
@Override
public MapExp visit(Unit env, Times e) {
return null;
}
@Override
public MapExp visit(Unit env, Exp e) {
throw new RuntimeException();
}
@Override
public MapExp visit(Unit env, Const e) {
return null;
}
@Override
public MapExp visit(Unit env, Delta e) {
return e.F;
}
@Override
public MapExp visit(Unit env, Sigma e) {
return e.F;
}
@Override
public MapExp visit(Unit env, Pi e) {
return e.F;
}
@Override
public MapExp visit(Unit env, FullSigma e) {
return e.F;
}
@Override
public Unit visit(Unit env, Relationalize e) {
return null;
}
@Override
public Unit visit(Unit env, External e) {
return null;
}
@Override
public Object visit(Unit env, Eval e) {
return e.q;
}
@Override
public Object visit(Unit env, FullEval e) {
return e.q;
}
@Override
public Object visit(Unit env, Kernel e) {
return null;
}
@Override
public Object visit(Unit env, Step e) {
// (Step) this should return a pair
return null;
}
});
if (f == null) {
return;
}
if (f instanceof QueryExp) {
QueryExp q = (QueryExp) f;
if (q instanceof QueryExp.Var) {
QueryExp.Var qq = (QueryExp.Var) q;
yyy.setSelectedValue(indices.get(qq.v), true);
return;
}
String k = FQLProgram.revLookup(prog.queries, q);
if (k != null) {
yyy.setSelectedValue(indices.get(k), true);
return;
}
String str = q.toString();
if (!extraInsts.contains(str)) {
Query view = q.toQuery(prog);
JPanel p = showQuery(prog, env, view);
x.add(p, str);
extraInsts.add(str);
}
yyy.clearSelection();
cl.show(x, str);
} else if (f instanceof FullQueryExp) {
FullQueryExp q = (FullQueryExp) f;
if (q instanceof FullQueryExp.Var) {
FullQueryExp.Var qq = (FullQueryExp.Var) q;
yyy.setSelectedValue(indices.get(qq.v), true);
return;
}
String k = FQLProgram.revLookup(prog.full_queries, q);
if (k != null) {
yyy.setSelectedValue(indices.get(k), true);
return;
}
String str = q.toString();
if (!extraInsts.contains(str)) {
FullQuery view = q.toFullQuery(prog);
JPanel p = showFullQuery(prog, env, view, q);
x.add(p, str);
extraInsts.add(str);
}
yyy.clearSelection();
cl.show(x, str);
} else if (f instanceof MapExp) {
MapExp q = (MapExp) f;
if (q instanceof MapExp.Var) {
MapExp.Var qq = (MapExp.Var) q;
yyy.setSelectedValue(indices.get(qq.v), true);
return;
}
String k = FQLProgram.revLookup(prog.maps, q);
if (k != null) {
yyy.setSelectedValue(indices.get(k), true);
return;
}
String str = q.toString();
if (!extraInsts.contains(str)) {
Mapping view = q.toMap(prog);
JPanel p = showMapping(env, prog.smap(view.source.toConst()), prog.smap(view.target.toConst()), view);
x.add(p, str);
extraInsts.add(str);
}
yyy.clearSelection();
cl.show(x, str);
} else {
throw new RuntimeException();
}
}
Aggregations