]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/types/TypeHashCodeContext.java
migrated to svn revision 33108
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / types / TypeHashCodeContext.java
1 package org.simantics.scl.compiler.internal.types;
2
3 import org.simantics.scl.compiler.types.TVar;
4
5 import gnu.trove.map.hash.TObjectIntHashMap;
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 }