Smalltalk Programming/Overview
Appearance
removeEventsTriggeredFor: anObject inState: aState "Remove all the events triggered by the receiver which would have been sent to anObject in the given state." | events | events := transitions at: aState ifAbsent: [ ^self ]. events copy keysAndValuesDo: [:evtSym :msgSendSet | | newSet | newSet := msgSendSet reject: [:each | each receiver == anObject and: [ (anObject == self and: [ each selector == #newState: ]) not ] ]. msgSendSet size = newSet size ifFalse: [newSet isEmpty ifTrue: [ events removeKey: evtSym] ifFalse: [ events at: evtSym put: newSet]]].
Claim: Lots of indentions is a sign that code needs to be refactored. CPS