/* Demo Recorder for MAEMO 5 * Copyright (C) 2010 Dru Moore * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * or (at your option) any later version, as published by the Free * Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ namespace IdWorks { public class SimpleHashMap : Object { List _keys; List _values; public List keys { get { return _keys; } } public List values { get { return _values; } } construct { _keys = new List(); _values = new List(); } public new void set(string key, T val) { for (int idx = 0; idx < _keys.length(); ++idx) { if (key == _keys.nth_data(idx)) { // delete value at idx _values.delete_link(_values.nth(idx)); // insert value at idx _values.insert(val, idx); return; } } _keys.append(key); _values.append(val); } public new T get(string key) { for (int idx = 0; idx < _keys.length(); ++idx) { if (key == _keys.nth_data(idx)) { return _values.nth_data(idx); } } return null; } } }