SequenceableCollection.st
branchjv
changeset 17747 f978415ba3d3
parent 17735 6a5bc05f696a
child 17751 b2273fa8d59f
--- a/SequenceableCollection.st	Sat Jan 16 11:26:37 2010 +0000
+++ b/SequenceableCollection.st	Mon Feb 01 10:03:06 2010 +0000
@@ -358,6 +358,13 @@
     ^ self == SequenceableCollection
 ! !
 
+!SequenceableCollection class methodsFor:'spray'!
+
+sprayTypeName
+	#swAdded.
+	^SOAP::XePName prefix: 'soap' local: 'Array'
+! !
+
 !SequenceableCollection methodsFor:'Compatibility-Squeak'!
 
 allButFirst
@@ -638,6 +645,7 @@
     ^ self replaceFrom:start to:stop with:anArray startingAt:repStart
 ! !
 
+
 !SequenceableCollection methodsFor:'accessing'!
 
 after:anObject
@@ -1926,6 +1934,20 @@
     ^ true
 !
 
+isSoapEncSameAs: comparand
+	"Answer whether the receiver and the <Object> argument, comparand,
+	are considered equivalent in terms of the soap-enc rules."
+
+	| size |
+	#swAdded.
+	self == comparand ifTrue: [^true].
+	self species == comparand species ifFalse: [^false].
+	size := self size.
+	size = comparand size ifFalse: [^false].
+	1 to: size do: [:i | ((self at: i) isSoapEncSameAs: (comparand at: i)) ifFalse: [^false]].
+	^true
+!
+
 sameContentsAs:aCollection whenComparedWith:compareBlock
     "return true if the receiver and aCollection represent collections
      with the same contents, using compareSelector to compare elements.
@@ -5852,6 +5874,7 @@
     "Created: 14.2.1997 / 16:13:03 / cg"
 ! !
 
+
 !SequenceableCollection methodsFor:'searching'!
 
 detect:aBlock startingAt:startIndex
@@ -7602,6 +7625,20 @@
     "Modified: 21.8.1997 / 18:32:11 / cg"
 !
 
+sortByApplying:aBlock
+    "Sort my contents inplace based on the value of what aBlock returns for each element.
+     Similar to, but even more flexible than sortBySelector."
+
+    ^ self sort:[:a :b | (aBlock value:a) < (aBlock value:b)]
+
+    "
+     replace all uses of sort as in:
+        ... sort:[:a :b | a foo < b foo]
+     by:
+        ... sortByApplying:[:each | each foo]
+    "
+!
+
 sortBySelector:aSelector
     "Sort my contents inplace based on the value of what aSelector returns when sent to my
      elements. Sorting by a selector is so common, that its worth a separate utility"
@@ -7705,6 +7742,7 @@
     "Modified: 21.8.1997 / 18:30:49 / cg"
 ! !
 
+
 !SequenceableCollection methodsFor:'testing'!
 
 includesKey:anIndex
@@ -7732,14 +7770,15 @@
 !SequenceableCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Id: SequenceableCollection.st 10480 2009-12-02 21:30:55Z vranyj1 $'
+    ^ '$Id: SequenceableCollection.st 10496 2010-02-01 10:03:06Z vranyj1 $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.289 2009/10/28 15:40:54 cg Exp §'
+    ^ '§Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.290 2010/01/20 09:55:32 cg Exp §'
 ! !
 
 SequenceableCollection initialize!
 
 
 
+