initial checkin
authorClaus Gittinger <cg@exept.de>
Tue, 21 Mar 2000 13:55:54 +0100
changeset 5311 0370108c62ca
parent 5310 b943d0eae029
child 5312 ac5719fafe43
initial checkin
QualifiedName.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QualifiedName.st	Tue Mar 21 13:55:54 2000 +0100
@@ -0,0 +1,120 @@
+Object subclass:#QualifiedName
+	instanceVariableNames:'pathString'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Kernel-Support'
+!
+
+
+!QualifiedName class methodsFor:'instance creation'!
+
+for:aStringOrSymbol
+    ^ self new name:aStringOrSymbol
+
+
+!
+
+makeUnambiguous
+    ^ self
+!
+
+pathString:aPathString
+    ^ self new pathString:aPathString
+! !
+
+!QualifiedName methodsFor:'accessing'!
+
+asString
+    ^ pathString
+
+
+!
+
+comment:aString
+    "empty for now"
+!
+
+name:aStringOrSymbol
+    pathString := aStringOrSymbol asSymbol
+
+!
+
+pathString
+    "return the value of the instance variable 'pathString' (automatically generated)"
+
+    ^ pathString!
+
+pathString:something
+    "set the value of the instance variable 'pathString' (automatically generated)"
+
+    pathString := something.! !
+
+!QualifiedName methodsFor:'conditional execution'!
+
+value
+    "return my binding value, if unbound, return nil"
+
+    ^ self valueOrDo:[]
+!
+
+valueOrDo:aBlock
+    "return my binding value, if unbound, return the result from evaluating aBlock"
+
+    |ns path|
+
+    path := pathString asCollectionOfSubstringsSeparatedBy:$..
+    ((path size > 0) and:[path first = 'Core']) ifTrue:[
+        path := path copyFrom:2
+    ].
+    ns := Smalltalk.
+    path do:[:component |
+        ns := ns at:component asSymbol ifAbsent:[ ^ aBlock value ].
+    ].
+    ^ ns
+! !
+
+!QualifiedName methodsFor:'defining'!
+
+defineClass: name superclass: superclass
+                indexedType: indexed
+                private: private
+                instanceVariableNames: instVars
+                classInstanceVariableNames: classInstVars
+                imports: imports
+                category: category
+                attributes: annotations
+
+    |sc|
+
+    sc := superclass value.
+    sc isNil ifTrue:[
+self halt.
+    ].
+self halt.
+
+!
+
+defineNameSpace: name private: private imports: imports category: category attributes: annotations
+    "klduge for now"
+
+    pathString = 'Smalltalk' ifTrue:[
+        Namespace name:name asSymbol.
+    ] ifFalse:[
+    self halt.
+    ].
+
+! !
+
+!QualifiedName methodsFor:'dummy for now'!
+
+makeUnambiguous
+    ^ self
+
+
+! !
+
+!QualifiedName class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic/QualifiedName.st,v 1.1 2000-03-21 12:55:54 cg Exp $'
+! !