| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-08-29 00:05:39 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-08-29 00:05:39 +0200 |
| commit | f1dfb1eb04a705521238dba64e09bb9ecdea794f (patch) | |
| tree | e8cd8d7349cd5008160e4a19c1e788241dd11b7b /instance-calculator/src/Waveforms.java | |
| parent | ee9d405bc917be3f596ccd2ffd2d7ddc01687d31 (diff) | |
Starting to get an idea of how it's going to work.
Diffstat (limited to 'instance-calculator/src/Waveforms.java')
| -rw-r--r-- | instance-calculator/src/Waveforms.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/instance-calculator/src/Waveforms.java b/instance-calculator/src/Waveforms.java new file mode 100644 index 0000000..e7a4c8c --- /dev/null +++ b/instance-calculator/src/Waveforms.java @@ -0,0 +1,64 @@ +import java.util.Map; +import java.util.HashMap; + +public class Waveforms +{ + private static final Map<String, String> FROM_WAVEFORM; + private static final Map<String, String> TO_WAVEFORM; + + static + { + FROM_WAVEFORM = new HashMap<String, String>(); + TO_WAVEFORM = new HashMap<String, String>(); + } + + private Waveforms () {} /* Utility class. */ + + public static void register_map (final String wfm_id, final String elem_id) + { + FROM_WAVEFORM.put(wfm_id, elem_id); + TO_WAVEFORM.put(elem_id, wfm_id); + } + + public static String get_id_from_waveform_id (final String wfm_id) + { + final String result; + + result = FROM_WAVEFORM.get(wfm_id); + + if (result == null) + { + System.err.println + ( + "[F] There is no element associated with waveform \"" + + wfm_id + + "\". Is the model complete?" + ); + + System.exit(-1); + } + + return result; + } + + public static String get_waveform_id_from_id (final String src_id) + { + final String result; + + result = TO_WAVEFORM.get(src_id); + + if (result == null) + { + System.err.println + ( + "[F] There is no waveform associated with the element \"" + + src_id + + "\". Is the model complete?" + ); + + System.exit(-1); + } + + return result; + } +} |


