X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.osgi%2Fscl%2FExtras%2FHashMap.scl;h=76ab15c6c384d5f15197c506a70b6021dbcc9aa1;hb=1dfc44ff89362fb4500ee9427432541b92d1953f;hp=fae9f3180391626086f234141880459de34a68ef;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.osgi/scl/Extras/HashMap.scl b/bundles/org.simantics.scl.osgi/scl/Extras/HashMap.scl index fae9f3180..76ab15c6c 100644 --- a/bundles/org.simantics.scl.osgi/scl/Extras/HashMap.scl +++ b/bundles/org.simantics.scl.osgi/scl/Extras/HashMap.scl @@ -1,23 +1,31 @@ -import "StandardLibrary" hiding (contains) - -importJava "gnu.trove.map.hash.THashMap" where - data T a b - - @JavaName "" - create :: () -> T a b - put :: T a b -> a -> b -> Maybe b - get :: T a b -> a -> Maybe b - @JavaName get - unsafeGet :: T a b -> a -> b - - contains :: T a b -> a -> Boolean - size :: T a b -> Integer - -importJava "org.simantics.scl.osgi.map.HashMapUtils" where - entries :: T a b -> [(a,b)] - -fromList :: [(a,b)] -> T a b -fromList entries = do - result = create () - for entries (\(k,v) -> do put result k v; ()) - result \ No newline at end of file +module { + deprecated = "Use module MMap instead." +} + +import "MMap" as MMap + +type T = MMap.T + +create :: () -> T a b +create = MMap.create + +put :: T a b -> a -> b -> Maybe b +put = MMap.put + +get :: T a b -> a -> Maybe b +get = MMap.get + +unsafeGet :: T a b -> a -> b +unsafeGet = MMap.unsafeGet + +contains :: T a b -> a -> Boolean +contains = MMap.containsKey + +size :: T a b -> Integer +size = MMap.size + +entries :: T a b -> [(a,b)] +entries = MMap.entries + +fromList :: [(a,b)] -> T a b +fromList = MMap.fromEntryList