Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.156.mcz ==================== Summary ==================== Name: Collections-nice.156 Author: nice Time: 5 October 2009, 10:02:15 am UUID: fb89bd58-d1e5-e840-8e03-b03bd109374f Ancestors: Collections-nice.155 According to http://bugs.squeak.org/view.php?id=7402 Modify various Collection copy to use postCopy paradigm. shallowCopy This should solve http://bugs.squeak.org/view.php?id=7402 http://bugs.squeak.org/view.php?id=7403 This is also a prerequisite for solving http://bugs.squeak.org/view.php?id=6535 =============== Diff against Collections-dtl.154 =============== Item was changed: ----- Method: CharacterSetComplement>>postCopy (in category 'copying') ----- postCopy + super postCopy. absent := absent copy! Item was added: + ----- Method: SharedQueue>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + contentsArray := contentsArray copy. + accessProtect := Semaphore forMutualExclusion. + readSynch := Semaphore new! Item was added: + ----- Method: Bag>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + contents := contents copy! Item was added: + ----- Method: RunArray>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + runs := runs copy. + values := values copy! Item was added: + ----- Method: SparseLargeTable>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + 1 to: self basicSize do: [:i | self basicAt: i put: (self basicAt: i) copy]! Item was added: + ----- Method: WeakRegistry>>postCopy (in category 'copying') ----- + postCopy + accessLock := Semaphore forMutualExclusion. + valueDictionary := valueDictionary copy.! Item was changed: ----- Method: CharacterSet>>postCopy (in category 'copying') ----- postCopy + super postCopy. map := map copy! Item was added: + ----- Method: Text>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + string := string copy. + runs := runs copy! Item was added: + ----- Method: Heap>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + array := array copy! Item was added: + ----- Method: Stack>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + linkedList := linkedList copy! Item was added: + ----- Method: LinkedList>>postCopy (in category 'copying') ----- + postCopy + | aLink | + super postCopy. + firstLink isNil ifFalse: [ + aLink := firstLink := firstLink copy. + [aLink nextLink isNil] whileFalse: [aLink nextLink: (aLink := aLink nextLink copy)]. + lastLink := aLink].! Item was added: + ----- Method: WeakSet>>postCopy (in category 'copying') ----- + postCopy + | oldFlag | + super postCopy. + oldFlag := flag. + flag := Object new. + array replaceAll: oldFlag with: flag.! Item was changed: ----- Method: Set>>postCopy (in category 'copying') ----- postCopy + super postCopy. + array := array copy! - - array := array shallowCopy! Item was changed: ----- Method: WideCharacterSet>>postCopy (in category 'copying') ----- postCopy + super postCopy. map := map collect: [:each | each copy]! Item was added: + ----- Method: SharedQueue2>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + monitor critical: + [monitor := Monitor new. + items := items copy]! Item was added: + ----- Method: Matrix>>postCopy (in category 'copying') ----- + postCopy + super postCopy. + contents := contents copy! Item was added: + ----- Method: OrderedCollection>>postCopy (in category 'copying') ----- + postCopy + array := array copy! Item was removed: - ----- Method: SequenceableCollection>>shallowCopy (in category 'copying') ----- - shallowCopy - - ^self copyFrom: 1 to: self size! Item was removed: - ----- Method: SortedCollection>>copy (in category 'copying') ----- - copy - - | newCollection | - newCollection := self species sortBlock: sortBlock. - newCollection addAll: self. - ^newCollection! Item was removed: - ----- Method: Bag>>copy (in category 'copying') ----- - copy - ^ self shallowCopy setContents: contents copy! Item was removed: - ----- Method: Interval>>copy (in category 'copying') ----- - copy - "Return a copy of me. Override the superclass because my species is - Array and copy, as inherited from SequenceableCollection, uses - copyFrom:to:, which creates a new object of my species." - - ^self shallowCopy! Item was removed: - ----- Method: Interval>>shallowCopy (in category 'copying') ----- - shallowCopy - "Without this method, #copy would return an array instead of a new interval. - The whole problem is burried in the class hierarchy and every fix will worsen - the problem, so once the whole issue is resolved one should come back to this - method fix it." - - ^ self class from: start to: stop by: step! Item was removed: - ----- Method: Text>>copy (in category 'copying') ----- - copy - - ^ self class new setString: string copy setRuns: runs copy - ! Item was removed: - ----- Method: Matrix>>copy (in category 'copying') ----- - copy - ^self class rows: nrows columns: ncols contents: contents copy! |
Free forum by Nabble | Edit this page |