From 9f344f33b0fbc948815511f60296ce6804bd9c02 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Sat, 13 Apr 2024 19:47:12 -0600 Subject: Complete MessageSend --- boil/library/TypeFactory.java | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'boil/library/TypeFactory.java') 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; } } -- cgit v1.2.3