// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. //============================================================================= // Small hashtable-class used by the observation report classes // to keep track of the indices of the GUI Controls kept in a menu. // When adding or removing questions or answers to/from a menu, // code of the menu will have to be changed in less places (the hashtable // has to be reconsidered, but all references to GUI Controls will stay valid). // // Just a simple hashtable with no remove functionality. // ------------------------------------------------------------ // Created by Maarten Wesselius // © 2006, GeoDelft //============================================================================= class QAHashTable extends Object; var array keys; var array values; function int getValue(string key) { local int i; for(i = 0; i < keys.length; i++) { if(keys[i] == key) return values[i]; } return -1; } function setValue(string key, int val) { local int i; for(i = 0; i < keys.length; i++) { if(keys[i] == key) { values[i] = val; return; } } } function string getKey(int val) { local int i; for(i = 0; i < values.length; i++) { if(values[i] == val) return keys[i]; } return ""; } function add(string key, int val) { keys.insert(0,1); keys[0] = key; values.insert(0,1); values[0] = val; } function string toString() { local string ans; local int i; ans = "QAHashTable:"; for(i = 0; i < keys.length; i++) { ans = ans @ "["$i$"] = " $ keys[i] @ "-" @ values[i]; } return ans; }