Search in sources :

Example 16 with Times

use of catdata.fql.decl.InstExp.Times in project fql by CategoricalData.

the class TransChecker method visit.

@Override
public Pair<String, String> visit(FQLProgram env, And e) {
    InstExp v = env.insts.get(e.prop);
    if (v == null) {
        throw new RuntimeException("Missing instance: " + e.prop);
    }
    if (!(v instanceof Times)) {
        throw new RuntimeException("Not a product in " + e);
    }
    Times v0 = (Times) v;
    if (!v0.a.equals(v0.b)) {
        throw new RuntimeException("Not the same prop in " + e);
    }
    if (!(env.insts.get(v0.a) instanceof Two)) {
        throw new RuntimeException("Not a prop in " + e);
    }
    return new Pair<>(e.prop, v0.a);
}
Also used : InstExp(catdata.fql.decl.InstExp) Times(catdata.fql.decl.InstExp.Times) Two(catdata.fql.decl.InstExp.Two) Pair(catdata.Pair)

Aggregations

Times (catdata.fql.decl.InstExp.Times)16 Pair (catdata.Pair)9 InstExp (catdata.fql.decl.InstExp)9 Exp (catdata.fql.decl.InstExp.Exp)8 ExpPSM (catdata.fql.sql.ExpPSM)7 PSM (catdata.fql.sql.PSM)7 PropPSM (catdata.fql.sql.PropPSM)7 LinkedList (java.util.LinkedList)7 Two (catdata.fql.decl.InstExp.Two)6 External (catdata.fql.decl.InstExp.External)5 Kernel (catdata.fql.decl.InstExp.Kernel)5 One (catdata.fql.decl.InstExp.One)5 Delta (catdata.fql.decl.InstExp.Delta)4 Eval (catdata.fql.decl.InstExp.Eval)4 FullEval (catdata.fql.decl.InstExp.FullEval)4 FullSigma (catdata.fql.decl.InstExp.FullSigma)4 Plus (catdata.fql.decl.InstExp.Plus)4 Relationalize (catdata.fql.decl.InstExp.Relationalize)4 Step (catdata.fql.decl.InstExp.Step)4 Zero (catdata.fql.decl.InstExp.Zero)4