]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/relations/SpecialCHRRelation.java
8abf73b3eae2827c16efc30d17b302ccfcb243af
[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 import gnu.trove.set.hash.THashSet;
10
11 public enum SpecialCHRRelation implements CHRRelation {    
12     EQUALS(A, A), // only in head
13     ASSIGN(A, A), // only in body
14     MEMBER(A, Types.list(A)), // only in head
15     CHECK(Types.BOOLEAN), // only in head
16     EXECUTE(Types.UNIT); // only in body
17     
18     private final TVar[] typeVariables;
19     private final Type[] parameterTypes;
20     
21     private SpecialCHRRelation(Type ... parameterTypes) {
22         this.typeVariables = Types.freeVarsArray(parameterTypes);
23         this.parameterTypes = parameterTypes;
24     }
25
26     @Override
27     public TVar[] getTypeVariables() {
28         return typeVariables;
29     }
30     
31     @Override
32     public Type[] getParameterTypes() {
33         return parameterTypes;
34     }
35     
36     public TPred[] getTypeConstraints() {
37         return TPred.EMPTY_ARRAY;
38     }
39
40     @Override
41     public void collectEnforceEffects(THashSet<Type> effects) {
42     }
43
44     @Override
45     public void collectQueryEffects(THashSet<Type> effects) {
46     }
47 }