<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        +1<div class="mb_sig"></div><blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 07.06.2020 14:41:31 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p><div style="font-family:Arial,Helvetica,sans-serif">Levente Uzonyi uploaded a new version of Collections to project The Inbox:<br>http://source.squeak.org/inbox/Collections-ul.897.mcz<br><br>==================== Summary ====================<br><br>Name: Collections-ul.897<br>Author: ul<br>Time: 31 May 2020, 12:23:26.517191 am<br>UUID: 16d2c780-9e9c-4012-8149-fee4227d45bc<br>Ancestors: Collections-ul.896<br><br>WeakIdentityDictionary:<br>- made it work as other weak hashed collections:<br>   - no modification during element lookup<br>       - simpler code - same runtime complexity<br><br>Other:<br>- removed ByteArray >> #atAllPut: because it was same the as in its superclass<br><br>=============== Diff against Collections-nice.895 ===============<br><br>Item was removed:<br>- ----- Method: ByteArray>>atAllPut: (in category 'accessing') -----<br>- atAllPut: value<br>-    "Fill the receiver with the given value"<br>- <br>-       <primitive: 145=""><br>-  super atAllPut: value!<br><br>Item was changed:<br>  ----- Method: String>>< (in="" category="" 'comparing')=""><br>  < astring=""><br>         "Answer whether the receiver sorts before aString.<br>       The collation order is simple ascii (with case differences)."<br>  <br>+       ^(self compareWith: aString) <><br>-        ^ (self compare: self with: aString collated: AsciiOrder) = 1!<br><br>Item was changed:<br>  ----- Method: String>><= (in="" category="" 'comparing')=""></=><br>  <= astring=""></=><br>   "Answer whether the receiver sorts before or equal to aString.<br>   The collation order is simple ascii (with case differences)."<br>    <br>+     ^(self compareWith: aString) <=></=><br>-     ^ (self compare: self with: aString collated: AsciiOrder) <=></=><br><br>Item was changed:<br>  ----- Method: String>>= (in category 'comparing') -----<br>  = aString <br>     "Answer whether the receiver sorts equally as aString.<br>   The collation order is simple ascii (with case differences)."<br>    <br>      self == aString ifTrue: [ ^true ].<br>    aString isString ifFalse: [ ^false ].<br>         self size = aString size ifFalse: [ ^false ].<br>+        ^ (self compareWith: aString) = 0!<br>-   ^ (self compare: self with: aString collated: AsciiOrder) = 2!<br><br>Item was changed:<br>  ----- Method: String>>> (in category 'comparing') -----<br>  > aString <br>      "Answer whether the receiver sorts after aString.<br>        The collation order is simple ascii (with case differences)."<br>  <br>+       ^(self compareWith: aString) > 0!<br>-         ^ (self compare: self with: aString collated: AsciiOrder) = 3!<br><br>Item was changed:<br>  ----- Method: String>>>= (in category 'comparing') -----<br>  >= aString <br>    "Answer whether the receiver sorts after or equal to aString.<br>    The collation order is simple ascii (with case differences)."<br>  <br>+       ^(self compareWith: aString) >= 0!<br>-        ^ (self compare: self with: aString collated: AsciiOrder) >= 2!<br><br>Item was changed:<br>  ----- Method: String>>compare:caseSensitive: (in category 'comparing') -----<br>  compare: aString caseSensitive: aBool<br>        "Answer a comparison code telling how the receiver sorts relative to aString:<br>            1 - before<br>            2 - equal<br>             3 - after.<br>    "<br>        | map |<br>       map := aBool ifTrue:[CaseSensitiveOrder] ifFalse:[CaseInsensitiveOrder].<br>+     ^(self compareWith: aString collated: map) + 2!<br>-      ^self compare: self with: aString collated: map!<br><br>Item was added:<br>+ ----- Method: String>>compareWith: (in category 'comparing') -----<br>+ compareWith: aString<br>+ <br>+  "<primitive: 158="">"<br>+      ^(self compare: self with: aString collated: AsciiOrder) - 2!<br><br>Item was added:<br>+ ----- Method: String>>compareWith:collated: (in category 'comparing') -----<br>+ compareWith: aString collated: collation<br>+ <br>+        "<primitive: 158="">"<br>+      ^(self compare: self with: aString collated: collation) - 2!<br><br>Item was removed:<br>- ----- Method: WeakIdentityDictionary>>cleanupIndex: (in category 'private') -----<br>- cleanupIndex: anInteger<br>-      array at: anInteger put: vacuum.<br>-     tally := tally - 1.<br>-  self fixCollisionsFrom: anInteger.!<br><br>Item was changed:<br>  ----- Method: WeakIdentityDictionary>>fixCollisionsFrom: (in category 'private') -----<br>  fixCollisionsFrom: start<br>          "The element at start has been removed and replaced by vacuum.<br>   This method moves forward from there, relocating any entries<br>          that had been placed below due to collisions with this one."<br>  <br>         | element index |<br>     index := start.<br>       [ (element := array at: (index := index \\ array size + 1)) == vacuum ] whileFalse: [<br>                 element<br>                       ifNil:<br>                                [ "The binding at this slot was reclaimed - finish the cleanup"<br>                             array at: index put: vacuum.<br>                                  tally := tally - 1 ]<br>                          ifNotNil:<br>                             [| newIndex |<br>+                                (newIndex := self scanFor: element key) = index ifFalse: [<br>-                           (newIndex := self scanWithoutGarbagingFor: element key) = index ifFalse: [<br>                                    array <br>                                                at: newIndex put: element;<br>                                            at: index put: vacuum ] ] ]!<br><br>Item was changed:<br>  ----- Method: WeakIdentityDictionary>>removeKey:ifAbsent: (in category 'removing') -----<br>  removeKey: key ifAbsent: aBlock <br>       "Remove key (and its associated value) from the receiver. If key is not in <br>      the receiver, answer the result of evaluating aBlock. Otherwise, answer <br>      the value externally named by key."<br>  <br>          | index association |<br>         index := self scanFor: key.<br>   (association := (array at: index)) == vacuum ifTrue: [ ^aBlock value ].<br>+      array at: index put: vacuum.<br>+         tally := tally - 1.<br>+  self fixCollisionsFrom: index.<br>-       self cleanupIndex: index.<br>     ^association value!<br><br>Item was changed:<br>  ----- Method: WeakIdentityDictionary>>scanFor: (in category 'private') -----<br>  scanFor: anObject<br>   "Scan the array for the first slot containing either<br>     - a vacuum object indicating an empty slot<br>    - or a binding whose key matches anObject.<br>+   Answer the index of that slot or raise an error if no slot is found which should never happen."<br>-         Answer the index of that slot or raise an error if no slot is found.<br>-         When garbage collected slots are encountered, perform a clean-up."<br>  <br>+  | index start size |<br>+         index := start := anObject scaledIdentityHash \\ (size := array size) + 1.<br>+   [ <br>+           (array at: index) ifNotNil: [ :element |<br>+                     (element == vacuum or: [ element key == anObject ])<br>+                          ifTrue: [ ^index ] ].<br>+                (index := index \\ size + 1) = start ] whileFalse.<br>-   | index start rescan |  <br>-     [<br>-            rescan := false.<br>-             index := start := anObject scaledIdentityHash \\ array size + 1.<br>-             [ <br>-                   (array at: index) <br>-                           ifNil:<br>-                                       ["Object at this slot has been garbage collected.<br>-                                       A rescan is necessary because fixing collisions<br>-                                      might have moved the target before current index."<br>-                                      self cleanupIndex: index.<br>-                                    rescan := true]<br>-                              ifNotNil:<br>-                                    [:element | (element == vacuum or: [ element key == anObject ])<br>-                                              ifTrue: [ ^index ].<br>-                                  (index := index \\ array size + 1) = start ] ] whileFalse.<br>-           rescan ] whileTrue.<br>   self errorNoFreeSpace!<br><br>Item was changed:<br>  ----- Method: WeakIdentityDictionary>>scanForEmptySlotFor: (in category 'private') -----<br>  scanForEmptySlotFor: anObject<br>+       "Scan the array for the first empty slot marked by vacuum object or nil.<br>+        Answer the index of that slot or raise an error if no slot is found, which should never happen."<br>-        "Scan the array for the first empty slot marked by vacuum object.<br>-       Answer the index of that slot or raise an error if no slot is found.<br>-         Ignore the slots that have been garbage collected (those containing nil)."<br>  <br>   | index start | <br>      index := start := anObject scaledIdentityHash \\ array size + 1.<br>      [ <br>+           | element |<br>+          ((element := array at: index) == vacuum or: [ element == nil ]) ifTrue: [ ^index ].<br>-          (array at: index) <br>-                   ifNotNil:<br>-                            [:element | element == vacuum ifTrue: [ ^index ] ].<br>           (index := index \\ array size + 1) = start ] whileFalse.<br>      self errorNoFreeSpace!<br><br>Item was removed:<br>- ----- Method: WeakIdentityDictionary>>scanWithoutGarbagingFor: (in category 'private') -----<br>- scanWithoutGarbagingFor: anObject<br>-       "Scan the array for the first slot containing either<br>-    - a vacuum object indicating an empty slot<br>-   - or a binding whose key matches anObject.<br>-   Answer the index of that slot or raise an error if no slot is found.<br>-         Ignore the slots that have been garbage collected (those containing nil)"<br>- <br>-   | index start | <br>-     index := start := anObject scaledIdentityHash \\ array size + 1.<br>-     [ <br>-           (array at: index) <br>-                   ifNotNil:<br>-                            [:element | (element == vacuum or: [ element key == anObject ])<br>-                                      ifTrue: [ ^index ] ].<br>-                (index := index \\ array size + 1) = start ] whileFalse.<br>-     self errorNoFreeSpace!<br><br><br></primitive:></primitive:></primitive:></div></blockquote>
                                        </div></body>