From 1080b37bbe40fe56b919d22804c159cccdca3c95 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Wed, 10 Apr 2024 23:40:25 -0600 Subject: Library rename, created A4 directories --- boil/library/TypeFactory.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 boil/library/TypeFactory.java (limited to 'boil/library/TypeFactory.java') 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 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); + } +} -- cgit v1.2.3