| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-07-19 20:24:40 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-07-19 20:24:40 +0200 |
| commit | 158f8ef180d4ea448b351599529db53ff5e88f8c (patch) | |
| tree | 2982efaacb22dea8fb86850abc149b768ee428db /ast-to-instr/src/Strings.java | |
| parent | 0362751e41f731b22b7bfe511af4aa71a02be70a (diff) | |
Starting a Java implementation of ast-to-instr.
Keeping things clean, this time.
Diffstat (limited to 'ast-to-instr/src/Strings.java')
| -rw-r--r-- | ast-to-instr/src/Strings.java | 30 |
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; + } +} |


