summaryrefslogtreecommitdiff
path: root/boil/library/TypeFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'boil/library/TypeFactory.java')
-rw-r--r--boil/library/TypeFactory.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/boil/library/TypeFactory.java b/boil/library/TypeFactory.java
index 8dd910e..c84f64e 100644
--- a/boil/library/TypeFactory.java
+++ b/boil/library/TypeFactory.java
@@ -13,13 +13,31 @@ public class TypeFactory {
this.map = new HashMap<>();
}
- public String addNewAlias(TypeInstance t) {
- String alias = String.format("t.%d", this.type_num++);
- this.map.put(t, alias);
+ public String alias(TypeInstance t) {
+ /**
+ * Given a TypeInstance, return the designated
+ * vapor alias. If the alias does not exist, create it.
+ */
+ String alias;
+ if ((alias = this.map.get(t)) == null) {
+ 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);
+ public String retrieveRecentList(int x) {
+ /**
+ * Given int x, retrieve a space-delimited
+ * list of the x most recent entries.
+ */
+ String rtn = "";
+ for (int i = type_num-x; i < type_num; ++i) {
+ rtn += String.format(" t.%d",
+ i);
+ }
+
+ return rtn;
}
}