summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ast-to-instr/src/Strings.java')
-rw-r--r--ast-to-instr/src/Strings.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/ast-to-instr/src/Strings.java b/ast-to-instr/src/Strings.java
new file mode 100644
index 0000000..bc1778f
--- /dev/null
+++ b/ast-to-instr/src/Strings.java
@@ -0,0 +1,30 @@
+import java.util.Map;
+import java.util.HashMap;
+
+public class Strings
+{
+ private static final Map<String, IDs> TO_ID;
+
+ static
+ {
+ TO_ID = new HashMap<String, IDs>();
+ }
+
+ private Strings () {} /* Utility class. */
+
+ public static IDs get_id_from_string (final String string)
+ {
+ IDs result;
+
+ result = TO_ID.get(string);
+
+ if (result == null)
+ {
+ result = IDs.generate_new_id("string");
+
+ TO_ID.put(string, result);
+ }
+
+ return result;
+ }
+}