]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/relations/SpecialCHRRelation.java
CHR query translation and support for assignment in CHR bodies
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / chr / relations / SpecialCHRRelation.java
1 package org.simantics.scl.compiler.elaboration.chr.relations;
2
3 import org.simantics.scl.compiler.elaboration.chr.CHRRelation;
4 import org.simantics.scl.compiler.types.TPred;
5 import org.simantics.scl.compiler.types.TVar;
6 import org.simantics.scl.compiler.types.Type;
7 import org.simantics.scl.compiler.types.Types;
8
9 public enum SpecialCHRRelation implements CHRRelation {    
10     EQUALS(A, A), // only in head
11     ASSIGN(A, A), // only in body
12     MEMBER(A, Types.list(A)), // only in head
13     CHECK(Types.BOOLEAN), // only in head
14     EXECUTE(Types.UNIT); // only in body
15     
16     private final TVar[] typeVariables;
17     private final Type[] parameterTypes;
18     
19     private SpecialCHRRelation(Type ... parameterTypes) {
20         this.typeVariables = Types.freeVarsArray(parameterTypes);
21         this.parameterTypes = parameterTypes;
22     }
23
24     @Override
25     public TVar[] getTypeVariables() {
26         return typeVariables;
27     }
28     
29     @Override
30     public Type[] getParameterTypes() {
31         return parameterTypes;
32     }
33     
34     public TPred[] getTypeConstraints() {
35         return TPred.EMPTY_ARRAY;
36     }
37 }