'From Cuis 2.4 of 17 June 2010 [latest update: #509] on 3 July 2010 at 4:49:31 pm'!

!ChangeRecord methodsFor: 'access' stamp: 'jmv 7/3/2010 13:15'!
methodClass
	| methodClassName methodClass |
	type == #method ifFalse: [ ^ nil ].
	methodClassName _ class substrings
		ifEmpty: [ ^ nil ]
		ifNotEmpty:
			[ : parts | parts first asSymbol ].
	(Smalltalk includesKey: methodClassName) ifFalse: [ ^ nil ].
	methodClass _ Smalltalk at: methodClassName.
	^ meta
		ifTrue: [ methodClass class ]
		ifFalse: [ methodClass ]! !


!Collection methodsFor: 'testing' stamp: 'jmv 7/3/2010 16:43'!
ifEmpty: aBlock
	"Evaluate the block if I'm empty
	'' ifEmpty: [ :c | c, 'coda' ] 					'coda'
	'' ifEmpty: [ 'replacement' ]					 'replacement'
	'stuff' ifEmpty: [ :c | c, 'coda' ] 				'stuff'
	'stuff' ifEmpty: [ 'replacement' ]				'stuff'
	|c|c _ OrderedCollection new. c ifEmpty: [c add: 'stuff']. c			 an OrderedCollection('stuff')
	|c|c _ OrderedCollection new. c ifEmpty: [ :cc | cc add: 'stuff']. c	 an OrderedCollection('stuff')
	|c|c _ OrderedCollection with: 'a'. c ifEmpty: [c add: 'stuff']. c		 an OrderedCollection('a')
	|c|c _ OrderedCollection with: 'a'. c ifEmpty: [ :cc | cc add: 'stuff']. c  an OrderedCollection('a')
	"

	 self isEmpty ifTrue: [ ^aBlock valueWithPossibleArgument: self ]! !

!Collection methodsFor: 'testing' stamp: 'jmv 7/3/2010 16:46'!
ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock
	"Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise
	'' ifEmpty: [ :c | c, 'coda' ] ifNotEmpty: [ :c | c, 'coda2' ] 								 'coda'
	'' ifEmpty: [ 'replacement' ] ifNotEmpty: [ 'replacement2' ]								 'replacement'
	'stuff' ifEmpty: [ :c | c, 'coda' ] ifNotEmpty: [ :c | c, 'coda2' ]							 'stuffcoda2'
	'stuff' ifEmpty: [ 'replacement' ] ifNotEmpty: [ 'replacement2' ]						 'replacement2'
	|c|c _ OrderedCollection new. c ifEmpty: [c add: 'stuff'] ifNotEmpty: [c add: 'stuff2']. c						  an OrderedCollection('stuff')
	|c|c _ OrderedCollection new. c ifEmpty: [ :cc | cc add: 'stuff'] ifNotEmpty: [ :cc | cc add: 'stuff2']. c	 		 an OrderedCollection('stuff')
	|c|c _ OrderedCollection with: 'a'. c ifEmpty: [c add: 'stuff'] ifNotEmpty: [c add: 'stuff2']. c		 			 an OrderedCollection('a' 'stuff2')
	|c|c _ OrderedCollection with: 'a'. c ifEmpty: [ :cc | cc add: 'stuff'] ifNotEmpty: [ :cc | cc add: 'stuff2']. c  		 an OrderedCollection('a' 'stuff2')
	"
	^ self isEmpty
		ifTrue: [ emptyBlock valueWithPossibleArgument: self ]
		ifFalse: [ notEmptyBlock valueWithPossibleArgument: self ]! !

!Collection methodsFor: 'testing' stamp: 'jmv 7/3/2010 16:42'!
ifNotEmpty: aBlock
	"Evaluate the block unless I'm empty
	'' ifNotEmpty: [ :c | c, 'coda' ] 						 ''
	'' ifNotEmpty: [ 'replacement' ]					 	 ''
	'stuff' ifNotEmpty: [ :c | c, 'coda' ] 					 'stuffcoda'
	'stuff' ifNotEmpty: [ 'replacement' ]				 	 'replacement'
	|c|c _ OrderedCollection new. c ifNotEmpty: [c add: 'stuff']. c			  an OrderedCollection()
	|c|c _ OrderedCollection new. c ifNotEmpty: [ :cc | cc add: 'stuff']. c	  an OrderedCollection()
	|c|c _ OrderedCollection with: 'a'. c ifNotEmpty: [c add: 'stuff']. c		  an OrderedCollection('a' 'stuff')
	|c|c _ OrderedCollection with: 'a'. c ifNotEmpty: [ :cc | cc add: 'stuff']. c   an OrderedCollection('a' 'stuff')
	"

	self isEmpty ifFalse: [^aBlock valueWithPossibleArgument: self]! !

!Collection methodsFor: 'testing' stamp: 'jmv 7/3/2010 16:48'!
ifNotEmpty: notEmptyBlock ifEmpty: emptyBlock
	"Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise
	''  ifNotEmpty: [ :c | c, 'coda2' ]ifEmpty: [ :c | c, 'coda' ] 									 'coda'
	'' ifNotEmpty: [ 'replacement2' ]ifEmpty: [ 'replacement' 	]								 'replacement'
	'stuff'  ifNotEmpty: [ :c | c, 'coda2' ]ifEmpty: [ :c | c, 'coda' ]								 'stuffcoda2'
	'stuff' ifNotEmpty: [ 'replacement2' ] ifEmpty: [ 'replacement' ]							 'replacement2'
	|c|c _ OrderedCollection new. c  ifNotEmpty: [c add: 'stuff2']ifEmpty: [c add: 'stuff']. c			 		 an OrderedCollection('stuff')
	|c|c _ OrderedCollection new. c ifNotEmpty: [ :cc | cc add: 'stuff2'] ifEmpty: [ :cc | cc add: 'stuff']. c	 	 an OrderedCollection('stuff')
	|c|c _ OrderedCollection with: 'a'. c  ifNotEmpty: [c add: 'stuff2']ifEmpty: [c add: 'stuff']. c		 		 an OrderedCollection('a' 'stuff2')
	|c|c _ OrderedCollection with: 'a'. c ifNotEmpty: [ :cc | cc add: 'stuff2'] ifEmpty: [ :cc | cc add: 'stuff']. c 	an OrderedCollection('a' 'stuff2')
	"

	^self ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock! !

Collection removeSelector: #ifEmpty:ifNotEmptyDo:!
