]> gerrit.simantics Code Review - simantics/platform.git/blob
5e7aec1a0b4b9ded0efff5298963158578a37b2f
[simantics/platform.git] /
1 package org.simantics.scl.compiler.internal.types;
2
3 import gnu.trove.map.hash.TObjectIntHashMap;
4
5 import org.simantics.scl.compiler.types.TVar;
6
7 public class TypeHashCodeContext {
8         
9     public static final int APPLY = 0x12345678;
10     public static final int FORALL = 0xf2341233;
11     public static final int UNION = 0x9f8f7f6f;
12     public static final int FUN = 0xff294313;
13     
14     int result;
15     TObjectIntHashMap<TVar> varHashCode;
16     
17     public void append(int hash) {
18         result = result*31 + hash;
19     }
20     
21     public int getResult() {
22         return result;
23     }
24     
25     public TObjectIntHashMap<TVar> getVarHashCode() {
26         return varHashCode;
27     }
28     
29     public TObjectIntHashMap<TVar> createVarHashCode() {
30         if(varHashCode == null)
31             varHashCode = new TObjectIntHashMap<TVar>();
32         return varHashCode;
33     }
34 }