fixed: #refersToLiteral:
authorClaus Gittinger <cg@exept.de>
Thu, 26 Jul 2012 16:04:41 +0200
changeset 14254 d4aab2fd49db
parent 14253 28ef0472cf2f
child 14255 a5b9d39ad244
fixed: #refersToLiteral:
Annotation.st
--- a/Annotation.st	Thu Jul 26 16:04:08 2012 +0200
+++ b/Annotation.st	Thu Jul 26 16:04:41 2012 +0200
@@ -393,6 +393,15 @@
 	^ aBlock valueWithArguments: self arguments
 ! !
 
+!Annotation methodsFor:'queries'!
+
+refersToLiteral: anObject
+    (anObject == self key) ifTrue:[ ^ true ].
+    ^ false
+
+    "Created: / 26-07-2012 / 15:58:34 / cg"
+! !
+
 !Annotation methodsFor:'testing'!
 
 hasLiteral: aLiteral
@@ -506,16 +515,17 @@
 !Annotation::Resource methodsFor:'printing & storing'!
 
 storeOn:aStream
-
     aStream nextPutAll: '(Annotation resource: '.
     type storeOn: aStream.
-    value notNil ifTrue:
-        [aStream nextPutAll: ' value: '.
-        value storeOn: aStream].    
+    value notNil ifTrue: [
+        aStream nextPutAll: ' value: '.
+        value storeOn: aStream
+    ].    
     aStream nextPut:$)
 
     "Modified: / 16-07-2010 / 11:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 29-11-2011 / 11:19:06 / cg"
+    "Modified (format): / 26-07-2012 / 15:59:14 / cg"
 ! !
 
 !Annotation::Resource methodsFor:'processing'!
@@ -534,6 +544,26 @@
     "Modified: / 16-07-2010 / 11:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!Annotation::Resource methodsFor:'queries'!
+
+refersToLiteral: anObject
+    (anObject == type) ifTrue:[ ^ true ].
+    (anObject == value) ifTrue:[ ^ true ].
+    value isArray ifTrue:[ ^ value refersToLiteral: anObject].
+    ^ false
+
+    "Created: / 26-07-2012 / 15:57:58 / cg"
+!
+
+refersToLiteralMatching: aMatchString
+    (type isSymbol and:[aMatchString match:type])ifTrue:[ ^ true ].
+    (value isSymbol and:[aMatchString match:value])ifTrue:[ ^ true ].
+    value isArray ifTrue:[ ^ value refersToLiteralMatching: aMatchString].
+    ^ false
+
+    "Created: / 26-07-2012 / 16:01:26 / cg"
+! !
+
 !Annotation::Resource methodsFor:'testing'!
 
 isResource
@@ -603,6 +633,28 @@
     "Modified: / 20-05-2010 / 11:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!Annotation::Unknown methodsFor:'queries'!
+
+refersToLiteral: anObject
+    (anObject == method) ifTrue:[ ^ true ].
+    (anObject == key) ifTrue:[ ^ true ].
+    (anObject == arguments) ifTrue:[ ^ true ].
+    arguments isArray ifTrue:[ ^ arguments refersToLiteral: anObject].
+    ^ false
+
+    "Created: / 26-07-2012 / 15:57:43 / cg"
+!
+
+refersToLiteralMatching: aMatchString
+    (method isSymbol and:[aMatchString match:method])ifTrue:[ ^ true ].
+    (key isSymbol and:[aMatchString match:key])ifTrue:[ ^ true ].
+    (arguments isSymbol and:[aMatchString match:arguments])ifTrue:[ ^ true ].
+    arguments isArray ifTrue:[ ^ arguments refersToLiteralMatching: aMatchString].
+    ^ false
+
+    "Created: / 26-07-2012 / 16:00:58 / cg"
+! !
+
 !Annotation::Unknown methodsFor:'testing'!
 
 isUnknown
@@ -612,11 +664,11 @@
 !Annotation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.8 2012-07-18 17:33:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.9 2012-07-26 14:04:41 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.8 2012-07-18 17:33:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Annotation.st,v 1.9 2012-07-26 14:04:41 cg Exp $'
 !
 
 version_SVN