#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Tue, 28 Aug 2018 11:27:04 +0200
changeset 23304 eb5349cc3973
parent 23303 64f287d03213
child 23305 daf30c8d685b
#REFACTORING by cg class: Notification class changed: #accepts: #handles:
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