Search in sources :

Example 1 with Delta

use of catdata.fql.decl.TransExp.Delta in project fql by CategoricalData.

the class TransChecker method visit.

@Override
public Pair<String, String> visit(FQLProgram env, Delta e) {
    Pair<String, String> ht = e.h.type(env);
    InstExp i1 = env.insts.get(e.src);
    if (!(i1 instanceof InstExp.Delta)) {
        throw new RuntimeException(i1 + " is not a delta in " + e);
    }
    String i1x = ((InstExp.Delta) i1).I;
    if (!i1x.equals(ht.first)) {
        throw new RuntimeException("Source mismatch on " + e + ": " + i1x + " and " + ht.first);
    }
    InstExp i2 = env.insts.get(e.dst);
    if (!(i2 instanceof InstExp.Delta)) {
        throw new RuntimeException(i2 + " is not a delta in " + e);
    }
    String i2x = ((InstExp.Delta) i2).I;
    if (!i2x.equals(ht.second)) {
        throw new RuntimeException("Target mismatch on " + e + ": " + i2x + " and " + ht.second);
    }
    return new Pair<>(e.src, e.dst);
}
Also used : InstExp(catdata.fql.decl.InstExp) Delta(catdata.fql.decl.TransExp.Delta) Pair(catdata.Pair)

Aggregations

Pair (catdata.Pair)1 InstExp (catdata.fql.decl.InstExp)1 Delta (catdata.fql.decl.TransExp.Delta)1