diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-13 19:47:12 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-13 19:47:12 -0600 |
commit | 9f344f33b0fbc948815511f60296ce6804bd9c02 (patch) | |
tree | 44a10733d8cd58c72e622d406b7ea69d3e69c8b6 /boil/library/TypeFactory.java | |
parent | b0ddefd7e9a05905668bcef7110c623883e05c86 (diff) |
Complete MessageSend
Diffstat (limited to 'boil/library/TypeFactory.java')
-rw-r--r-- | boil/library/TypeFactory.java | 28 |
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; } } |