]> gerrit.simantics Code Review - simantics/platform.git/blob
e93ff6e8fe16a7b5eb1aeb5a45164a86302c0be2
[simantics/platform.git] /
1 package org.simantics.scl.compiler.elaboration.relations;
2
3 import org.simantics.scl.compiler.elaboration.chr.plan.PlanContext;
4 import org.simantics.scl.compiler.elaboration.expressions.Expression;
5 import org.simantics.scl.compiler.elaboration.expressions.Variable;
6 import org.simantics.scl.compiler.elaboration.query.compilation.EnforcingContext;
7 import org.simantics.scl.compiler.elaboration.query.compilation.QueryCompilationContext;
8 import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;
9 import org.simantics.scl.compiler.types.TPred;
10 import org.simantics.scl.compiler.types.TVar;
11 import org.simantics.scl.compiler.types.Type;
12
13 public interface SCLRelation {
14     
15     public static final int F = 0;
16     public static final int B = 1;
17     
18     public static final int FF = 0;
19     public static final int BF = 1;
20     public static final int FB = 2;
21     public static final int BB = 3;
22     
23     public static final int FFF = 0;
24     public static final int BFF = 1;
25     public static final int FBF = 2;
26     public static final int BBF = 3;
27     public static final int FFB = 4;
28     public static final int BFB = 5;
29     public static final int FBB = 6;
30     public static final int BBB = 7;
31     
32     TVar[] getTypeVariables();
33     Type[] getParameterTypes();
34     default TPred[] getTypeConstraints() {
35         return TPred.EMPTY_ARRAY;
36     }
37     int getPhase();
38
39     double getSelectivity(int boundVariables);
40     int getRequiredVariablesMask();
41     void generate(long location,
42             QueryCompilationContext context,
43             Type[] typeParameters,
44             Variable[] parameters, int boundVariables);
45     Expression generateEnforce(long location, EnforcingContext context,
46             Type[] typeParameters,
47             Variable[] parameters);
48     default String[] getFieldNames() {
49         return null;
50     }
51     
52     void generateIterate(
53             PlanContext context,
54             CodeWriter w,
55             long location,
56             int boundMask,
57             Variable[] variables,
58             Expression[] expressions,
59             Expression[] typeConstraintEvidenceParameters);
60     void generateEnforce(
61             PlanContext context,
62             CodeWriter w,
63             long location,
64             Expression[] parameters,
65             Expression[] typeConstraintEvidenceParameters);
66 }