CharacterArray.st
changeset 14652 3da893944c41
parent 14641 507dd4be1798
child 14660 78d3fa5b75e8
--- a/CharacterArray.st	Tue Jan 15 16:00:19 2013 +0100
+++ b/CharacterArray.st	Tue Jan 15 16:01:55 2013 +0100
@@ -1967,7 +1967,17 @@
     "/ immediately after any change, execute (maybe in a debugger):
     "/      Set allSubInstancesDo:[:s | s rehash]
     "/ ^ self hash_dragonBook
-    ^ self hash_sdbm.
+
+    |h|
+
+    "/
+    "/ this is the sdbm algorithm
+    "/
+    h := 0.
+    self do:[:char |
+        h := (65599 times:h) plus:char codePoint.
+    ].
+    ^ h 
 
     "
      'a' hash
@@ -1985,12 +1995,12 @@
 
         syms := Symbol allInstances.
         Transcript show:'syms: '; showCR:syms size.
-        Transcript show:'sdbm hashes: '; showCR:(syms collect:[:s| s hash_sdbm]) asSet size.
+        Transcript show:'sdbm hashes: '; showCR:(syms collect:[:s| s hash]) asSet size.
         Transcript show:'dragonBook hashes: '; showCR:(syms collect:[:s| s hash_dragonBook]) asSet size.
 
         ms := Time millisecondsToRun:[
             10 timesRepeat:[
-                syms do:[:each| each hash_sdbm].
+                syms do:[:each| each hash].
             ].
         ].
         Transcript show:'sdbm hash: '; showCR:ms.
@@ -2005,7 +2015,7 @@
         syms := syms collect:[:each| each asUnicode16String].
         ms := Time millisecondsToRun:[
             10 timesRepeat:[
-                syms do:[:each| each hash_sdbm].
+                syms do:[:each| each hash].
             ].
         ].
         Transcript show:'unicode sdbm hash: '; showCR:ms.
@@ -2063,29 +2073,6 @@
     "Created: / 26-12-2011 / 13:46:06 / cg"
 !
 
-hash_sdbm
-    "return an integer useful as a hash-key"
-
-    |h|
-
-    "/
-    "/ this is the sdbm algorithm
-    "/
-    h := 0.
-    self do:[:char |
-        h := (65599 times:h) plus:char codePoint.
-    ].
-    ^ h 
-
-    "
-     'a' hash_sdbm
-     'aa' hash_sdbm
-     'ab' hash_sdbm
-    "
-
-    "Created: / 26-12-2011 / 13:48:13 / cg"
-!
-
 levenshteinTo:aString
     "return the levenshtein distance to the argument, aString;
      this value corresponds to the number of replacements that have to be
@@ -6172,11 +6159,11 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.489 2013-01-09 20:40:35 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.490 2013-01-15 15:01:55 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.489 2013-01-09 20:40:35 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.490 2013-01-15 15:01:55 stefan Exp $'
 ! !