diff options
Diffstat (limited to 'boil/library/TypeFactory.java')
-rw-r--r-- | boil/library/TypeFactory.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/boil/library/TypeFactory.java b/boil/library/TypeFactory.java new file mode 100644 index 0000000..8dd910e --- /dev/null +++ b/boil/library/TypeFactory.java @@ -0,0 +1,25 @@ +package boil.library; + +import java.util.HashMap; +import st.TypeInstance; + +public class TypeFactory { + + private int type_num; + private HashMap<TypeInstance,String> map; + + public void reset() { + this.type_num = 0; + this.map = new HashMap<>(); + } + + public String addNewAlias(TypeInstance t) { + String alias = String.format("t.%d", this.type_num++); + this.map.put(t, alias); + return alias; + } + + public String retrieveAlias(TypeInstance t) { + return this.map.get(t); + } +} |