# HG changeset patch # User Claus Gittinger # Date 1535448424 -7200 # Node ID eb5349cc39730fccdf4b7a4d6777510e9935ec11 # Parent 64f287d0321313a0086ede0e838a254cadeb01f2 #REFACTORING by cg class: Notification class changed: #accepts: #handles: diff -r 64f287d03213 -r eb5349cc3973 Notification.st --- a/Notification.st Tue Aug 28 11:25:34 2018 +0200 +++ b/Notification.st Tue Aug 28 11:27:04 2018 +0200 @@ -134,24 +134,24 @@ !Notification class methodsFor:'queries'! -accepts:aSignal +accepts:aSignalOrExceptionClass "return true, if the receiver accepts the argument, aSignal. (i.e. the receiver is aSignal or a parent of it). False otherwise." |s| - self == aSignal ifTrue:[^ true]. - aSignal isQuerySignal ifFalse:[^ false]. + self == aSignalOrExceptionClass ifTrue:[^ true]. + aSignalOrExceptionClass isQuerySignal ifFalse:[^ false]. - s := aSignal parent. - [s notNil] whileTrue:[ + s := aSignalOrExceptionClass. + [(s := s parent) notNil] whileTrue:[ self == s ifTrue:[^ true]. - s := s parent ]. ^ false - "Modified: / 22.3.1999 / 12:45:32 / stefan" - "Created: / 23.7.1999 / 15:18:00 / stefan" + "Modified: / 22-03-1999 / 12:45:32 / stefan" + "Created: / 23-07-1999 / 15:18:00 / stefan" + "Modified (format): / 28-08-2018 / 11:15:50 / Claus Gittinger" ! defaultAnswer @@ -193,17 +193,21 @@ "return true, if the receiver handles the argument, anException. (i.e. the receiver is anExceptions signal or a parent of it)" - |signal| - - signal := anException creator. + ^ self accepts:(anException creator). - self == signal ifTrue:[^ true]. "quick check" - anException isNotification ifFalse:[^ false]. "speed up non-queries by not traversing the parent chain" +"/ |signal| +"/ +"/ signal := anException creator. +"/ +"/ self == signal ifTrue:[^ true]. "quick check" +"/ anException isNotification ifFalse:[^ false]. "speed up non-queries by not traversing the parent chain" +"/ +"/ [(signal := signal parent) notNil] whileTrue:[ +"/ self == signal ifTrue:[^ true]. +"/ ]. +"/ ^ false - [(signal := signal parent) notNil] whileTrue:[ - self == signal ifTrue:[^ true]. - ]. - ^ false + "Modified: / 28-08-2018 / 11:26:39 / Claus Gittinger" ! isQuerySignal