From b68d5c88b9724fcf59fdda015451793deb368f7d Mon Sep 17 00:00:00 2001 From: Friedrich Weber Date: Wed, 23 Jun 2010 23:30:09 +0200 Subject: [PATCH] Added some useful stuff (getKeys, getClass) to HashBag. --- sdk/structs/HashBag.ooc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk/structs/HashBag.ooc b/sdk/structs/HashBag.ooc index 86b72d55..8c4d85dc 100644 --- a/sdk/structs/HashBag.ooc +++ b/sdk/structs/HashBag.ooc @@ -1,4 +1,4 @@ -import structs/HashMap +import structs/[ArrayList, HashMap] HashBag: class { @@ -13,7 +13,11 @@ HashBag: class { } get: func (key: String, T: Class) -> T { - return getEntry(key, T) value as T + return getEntry(key, T) value as T // TODO: segfault if `key` is not in this + } + + getClass: func (key: String) -> Class { + return myMap get(key) as Cell T } getEntry: func (key: String, V: Class) -> HashEntry { @@ -47,5 +51,9 @@ HashBag: class { contains: func(key: String) -> Bool { myMap get(key) ? true : false } + + getKeys: func -> ArrayList { + myMap getKeys() + } }