author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 26 Nov 2011 08:36:46 +0000 | |
branch | jv |
changeset 17900 | b9614a1cf804 |
parent 17869 | 9610c6c94e71 |
child 17917 | 50ca39205859 |
permissions | -rw-r--r-- |
1827 | 1 |
" |
2 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5464 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
5331 | 14 |
Object subclass:#NameSpace |
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
15 |
instanceVariableNames:'category' |
17787 | 16 |
classVariableNames:'Imports' |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
17 |
poolDictionaries:'' |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
18 |
category:'Kernel-Classes' |
1933 | 19 |
! |
1827 | 20 |
|
5331 | 21 |
!NameSpace class methodsFor:'documentation'! |
1827 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
||
1816 | 36 |
! |
37 |
||
1827 | 38 |
documentation |
39 |
" |
|
5331 | 40 |
A NameSpace is actually a dummy class, providing a home |
2010 | 41 |
for its private classes. |
42 |
Thus, internally, the same mechanism is used for classes in |
|
5331 | 43 |
a NameSpace and private classes. |
2010 | 44 |
This has two advantages: |
1828 | 45 |
- we only need one mechanism for both namespaces |
46 |
and private classes |
|
47 |
||
48 |
- there are no possible conflicts between a class |
|
49 |
and a namespace named alike. |
|
50 |
||
1816 | 51 |
|
1827 | 52 |
[author:] |
53 |
Claus Gittinger |
|
54 |
||
55 |
[see also:] |
|
56 |
Behavior ClassDescription Class Metaclass |
|
57 |
PrivateMetaclass |
|
58 |
" |
|
59 |
||
60 |
! ! |
|
61 |
||
5331 | 62 |
!NameSpace class methodsFor:'instance creation'! |
1828 | 63 |
|
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
64 |
fullName:aFullNameSpacePathName |
2007
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
65 |
"given a possibly nested name of a namespace, create all required |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
66 |
intermediate spaces (if not already existing) and return the |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
67 |
bottom-level space." |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
68 |
|
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
69 |
"/ break it up, check for all intermediate spaces to exist |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
70 |
"/ create them as required. |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
71 |
|
7426
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
72 |
|list thisNamespace| |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
73 |
|
7426
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
74 |
(aFullNameSpacePathName includes:$:) ifTrue:[ |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
75 |
"/ old style |
8744
73522a385e11
oops - fullName did not handle '::' correctly
Claus Gittinger <cg@exept.de>
parents:
7575
diff
changeset
|
76 |
list := aFullNameSpacePathName asCollectionOfSubstringsSeparatedByAll:'::'. |
7426
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
77 |
] ifFalse:[ |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
78 |
"/ new style |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
79 |
list := aFullNameSpacePathName asCollectionOfSubstringsSeparatedBy:$.. |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
80 |
]. |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
81 |
|
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
82 |
"/ now, look and create 'em |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
83 |
|
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
84 |
thisNamespace := nil. |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
85 |
list do:[:aName | |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
86 |
|key x| |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
87 |
|
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
88 |
key := aName asSymbol. |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
89 |
|
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
90 |
thisNamespace isNil ifTrue:[ |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
91 |
(Smalltalk includesKey:key) ifTrue:[ |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
92 |
thisNamespace := Smalltalk at:key. |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
93 |
(thisNamespace notNil |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
94 |
and:[thisNamespace isBehavior not]) ifTrue:[ |
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
95 |
self error:'name conflict: namespace ' , aName , ' vs. global'. |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
96 |
] |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
97 |
]. |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
98 |
thisNamespace isNil ifTrue:[ |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
99 |
thisNamespace := self name:key |
8747 | 100 |
]. |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
101 |
] ifFalse:[ |
7426
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
102 |
thisNamespace isNameSpace ifTrue:[ |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
103 |
x := thisNamespace at:key. |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
104 |
] ifFalse:[ |
7426
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
105 |
thisNamespace isBehavior ifTrue:[ |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
106 |
x := thisNamespace privateClassesAt:key. |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
107 |
]. |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
108 |
]. |
2055 | 109 |
|
7426
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
110 |
x isNil ifTrue:[ |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
111 |
thisNamespace isNameSpace ifTrue:[ |
8747 | 112 |
thisNamespace == Smalltalk ifTrue:[ |
8748 | 113 |
x := self name:key |
8747 | 114 |
] ifFalse:[ |
115 |
x := thisNamespace name:key. |
|
116 |
] |
|
7426
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
117 |
] ifFalse:[ |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
118 |
x := |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
119 |
self subclass:key |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
120 |
instanceVariableNames:'' |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
121 |
classVariableNames:'' |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
122 |
poolDictionaries:'' |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
123 |
privateIn:thisNamespace. |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
124 |
]. |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
125 |
|
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
126 |
"/ nameSpaces are not in any package (yet) |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
127 |
x setPackage:nil. |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
128 |
]. |
4059d00c81d7
also allow '.' as ns-separator
Claus Gittinger <cg@exept.de>
parents:
7317
diff
changeset
|
129 |
thisNamespace := x. |
8747 | 130 |
]. |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
131 |
]. |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
132 |
|
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
133 |
^ thisNamespace |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
134 |
|
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
135 |
"Created: 8.11.1996 / 13:41:59 / cg" |
2055 | 136 |
"Modified: 4.1.1997 / 16:50:59 / cg" |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
137 |
! |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
138 |
|
2007
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
139 |
name:aStringOrSymbol |
2177
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
140 |
"create a new nameSpace, named aStringOrSymbol. |
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
141 |
Notice, that the nameSpace is created in the current one - |
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
142 |
dont get confused; we recommend, not to nest them too much." |
1908 | 143 |
|
7575
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
144 |
|currentNameSpace newNameSpace existing ok nameSym fullName| |
1828 | 145 |
|
2024
71a088db4583
validate nameSpaces name for being a valid identifier.
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
146 |
ok := aStringOrSymbol first isLetter. |
71a088db4583
validate nameSpaces name for being a valid identifier.
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
147 |
ok ifTrue:[ |
2177
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
148 |
(aStringOrSymbol |
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
149 |
findFirst:[:ch | (ch isLetterOrDigit or:[ch == $_]) not] |
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
150 |
startingAt:2) ~~ 0 |
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
151 |
ifTrue:[ |
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
152 |
ok := false. |
2024
71a088db4583
validate nameSpaces name for being a valid identifier.
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
153 |
] |
71a088db4583
validate nameSpaces name for being a valid identifier.
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
154 |
]. |
71a088db4583
validate nameSpaces name for being a valid identifier.
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
155 |
ok ifFalse:[ |
2025 | 156 |
self error:'invalid namespace name:''' , aStringOrSymbol printString , ''' (must be a valid identifier)'. |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
157 |
]. |
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
158 |
|
5249
77cad45f94f8
fixed sub-namespace creation
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
159 |
nameSym := aStringOrSymbol asSymbol. |
3383 | 160 |
|
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
161 |
self == NameSpace ifTrue:[ |
7575
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
162 |
"/ currentNameSpace := Class nameSpaceQuerySignal query. |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
163 |
currentNameSpace isNil ifTrue:[ |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
164 |
currentNameSpace := Smalltalk |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
165 |
]. |
5249
77cad45f94f8
fixed sub-namespace creation
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
166 |
fullName := nameSym |
77cad45f94f8
fixed sub-namespace creation
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
167 |
] ifFalse:[ |
77cad45f94f8
fixed sub-namespace creation
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
168 |
currentNameSpace := self. |
77cad45f94f8
fixed sub-namespace creation
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
169 |
fullName := (self name , '::' , nameSym) asSymbol |
77cad45f94f8
fixed sub-namespace creation
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
170 |
]. |
77cad45f94f8
fixed sub-namespace creation
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
171 |
|
3383 | 172 |
(existing := currentNameSpace at:nameSym) notNil ifTrue:[ |
2015 | 173 |
^ existing |
174 |
]. |
|
7575
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
175 |
newNameSpace := self |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
176 |
subclass:fullName |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
177 |
instanceVariableNames:'' |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
178 |
classVariableNames:'' |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
179 |
poolDictionaries:'' |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
180 |
category:'uncategorized namespace' |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
181 |
inEnvironment:Smalltalk. |
2144 | 182 |
|
2055 | 183 |
"/ nameSpaces are not in any package |
7575
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
184 |
newNameSpace notNil ifTrue:[newNameSpace setPackage:nil]. |
80341bf0e03e
bug: created sub-nameSpace Foo::Foo,
Claus Gittinger <cg@exept.de>
parents:
7433
diff
changeset
|
185 |
^ newNameSpace |
1901 | 186 |
|
187 |
" |
|
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
188 |
NameSpace name:'foo' |
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
189 |
(NameSpace name:'foo') category:'my name space' |
2007
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
190 |
foo at:#bar put:(Metaclass new new) |
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
191 |
(NameSpace name:'foo') name:'bar' |
1901 | 192 |
" |
2177
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
193 |
" |
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
194 |
NameSpace name:'an-invalid++name' |
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
195 |
NameSpace name:'another:invalidName' |
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
196 |
NameSpace name:'another::invalidName' |
2177
80f6ec11f797
create new namespaces in the current nameSpace (by default)
Claus Gittinger <cg@exept.de>
parents:
2144
diff
changeset
|
197 |
" |
1931
5f60d3e5ba6e
moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
198 |
|
4058
58987b73c0c7
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
3383
diff
changeset
|
199 |
"Modified: / 14.9.1997 / 09:46:59 / cg" |
58987b73c0c7
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
3383
diff
changeset
|
200 |
"Modified: / 18.3.1999 / 18:24:13 / stefan" |
1828 | 201 |
! |
202 |
||
203 |
new |
|
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
204 |
"catch new - namespaces are not to be created by the user" |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
205 |
|
1828 | 206 |
self error:'namespaces are not to be created with new' |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
207 |
|
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
208 |
"Modified: 8.11.1996 / 21:38:00 / cg" |
1828 | 209 |
! ! |
210 |
||
7298 | 211 |
!NameSpace class methodsFor:'Compatibility-VW5.4'! |
6450 | 212 |
|
213 |
defineClass: name |
|
214 |
superclass: superclass |
|
215 |
indexedType: indexed |
|
216 |
private: private |
|
217 |
instanceVariableNames: instVars |
|
218 |
classInstanceVariableNames: classInstVars |
|
219 |
imports: imports |
|
220 |
category: category |
|
221 |
||
222 |
^ self |
|
223 |
defineClass: name |
|
224 |
superclass: superclass |
|
225 |
indexedType: indexed |
|
226 |
private: private |
|
227 |
instanceVariableNames: instVars |
|
228 |
classInstanceVariableNames: classInstVars |
|
229 |
imports: imports |
|
230 |
category: category |
|
231 |
attributes: nil |
|
232 |
! |
|
233 |
||
234 |
defineClass: name |
|
7431 | 235 |
superclass: superclassOrName |
6450 | 236 |
indexedType: indexed |
237 |
private: private |
|
238 |
instanceVariableNames: instVars |
|
239 |
classInstanceVariableNames: classInstVars |
|
240 |
imports: imports |
|
241 |
category: category |
|
242 |
attributes: annotations |
|
243 |
||
244 |
"VW5i compatibility class/namespace creation" |
|
245 |
||
7431 | 246 |
|variable words pointers superclass| |
6450 | 247 |
|
248 |
variable := words := pointers := false. |
|
249 |
indexed ~~ #none ifTrue:[ |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
250 |
indexed == #objects ifTrue:[ |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
251 |
variable := pointers := true. |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
252 |
] ifFalse:[ |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
253 |
self shouldImplement. |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
254 |
] |
6450 | 255 |
]. |
7431 | 256 |
superclassOrName isSymbol ifTrue:[ |
257 |
superclass := Smalltalk at:superclassOrName. |
|
258 |
superclass isNil ifTrue:[ |
|
259 |
self error:'missing superclass: ' , superclassOrName. |
|
260 |
] |
|
261 |
] ifFalse:[ |
|
262 |
superclass := superclassOrName |
|
263 |
]. |
|
6450 | 264 |
^ superclass value class |
265 |
name:name |
|
6824
6fbe85d05646
...in:... -> ...inEnvironment:...
Claus Gittinger <cg@exept.de>
parents:
6450
diff
changeset
|
266 |
inEnvironment:self |
6450 | 267 |
subclassOf:superclass value |
268 |
instanceVariableNames:instVars |
|
269 |
variable:variable |
|
270 |
words:words |
|
271 |
pointers:pointers |
|
272 |
classVariableNames:'' |
|
273 |
poolDictionaries:'' |
|
274 |
category:category |
|
275 |
comment:nil |
|
276 |
changed:true |
|
277 |
classInstanceVariableNames:classInstVars |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
278 |
! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
279 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
280 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
281 |
|newNameSpace| |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
282 |
|
17736 | 283 |
private ifTrue:[self shouldImplement]. "/ what to do ? |
284 |
imports withoutSeparators notEmpty ifTrue:[self shouldImplement]. "/ what to do ? |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
285 |
newNameSpace := NameSpace name:nameSymbol. |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
286 |
newNameSpace setCategory:category. |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
287 |
^ newNameSpace |
6450 | 288 |
! ! |
289 |
||
5331 | 290 |
!NameSpace class methodsFor:'accessing'! |
1827 | 291 |
|
2007
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
292 |
allClasses |
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
293 |
|classes| |
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
294 |
|
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
295 |
classes := IdentitySet new. |
5581 | 296 |
self allClassesDo:[:aClass | classes add:aClass]. |
2007
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
297 |
^ classes |
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
298 |
|
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
299 |
"Modified: 20.12.1996 / 15:34:50 / cg" |
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
300 |
! |
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
301 |
|
4372
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
302 |
allClassesWithAllPrivateClasses |
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
303 |
|classes| |
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
304 |
|
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
305 |
classes := IdentitySet new. |
5581 | 306 |
self allClassesDo:[:aClass | |
4372
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
307 |
classes add:aClass. |
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
308 |
aClass addAllPrivateClassesTo:classes. |
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
309 |
]. |
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
310 |
^ classes |
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
311 |
|
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
312 |
"Modified: 20.12.1996 / 15:34:50 / cg" |
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
313 |
! |
eaba7e085030
added #allClassesWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents:
4068
diff
changeset
|
314 |
|
1827 | 315 |
at:classNameSymbol |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
316 |
"return a class from the namespace defined by the receiver" |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
317 |
|
1828 | 318 |
^ self privateClassesAt:classNameSymbol |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
319 |
|
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
320 |
"Modified: 8.11.1996 / 21:39:41 / cg" |
1827 | 321 |
! |
322 |
||
323 |
at:classNameSymbol ifAbsent:exceptionBlock |
|
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
324 |
"return a class or an alternative |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
325 |
from the namespace defined by the receiver" |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
326 |
|
1827 | 327 |
|cls| |
328 |
||
1828 | 329 |
cls := self privateClassesAt:classNameSymbol. |
1827 | 330 |
cls isNil ifTrue:[ |
331 |
^ exceptionBlock value |
|
332 |
]. |
|
333 |
^ cls |
|
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
334 |
|
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
335 |
"Modified: 8.11.1996 / 21:40:01 / cg" |
1827 | 336 |
! |
337 |
||
10587 | 338 |
at:aKey ifPresent:aBlock |
339 |
"try to retrieve the value stored at aKey. |
|
340 |
If there is nothing stored under this key, do nothing. |
|
341 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
|
342 |
||
343 |
(self includesKey:aKey) ifTrue:[ |
|
344 |
^ aBlock value:(self at:aKey) |
|
345 |
]. |
|
346 |
^ nil |
|
347 |
||
348 |
"Modified: / 31-05-2007 / 17:50:46 / cg" |
|
349 |
! |
|
350 |
||
1827 | 351 |
at:classNameSymbol put:aClass |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
352 |
"add a class to the namespace defined by the receiver" |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
353 |
|
1828 | 354 |
^ self privateClassesAt:classNameSymbol put:aClass |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
355 |
|
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
356 |
"Modified: 8.11.1996 / 21:40:12 / cg" |
2908 | 357 |
! |
358 |
||
359 |
classNamed:aString |
|
360 |
"return the class with name aString, or nil if absent. |
|
361 |
To get to the metaClass, append ' class' to the string." |
|
362 |
||
363 |
^ Smalltalk classNamed:(self name , '::' , aString) |
|
364 |
||
365 |
"Created: 9.9.1997 / 03:33:56 / cg" |
|
4397
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
366 |
! |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
367 |
|
9267 | 368 |
classNames |
369 |
^ self allClasses collect:[:each | each nameWithoutPrefix] |
|
370 |
! |
|
371 |
||
17786 | 372 |
import: aNameSpace |
373 |
||
374 |
(aNameSpace isNameSpace or: [aNameSpace isProgrammingLanguage]) |
|
375 |
ifFalse:[self error: 'Not a namespace or prog. language']. |
|
376 |
||
377 |
(self imports includes: aNameSpace) ifFalse: |
|
17787 | 378 |
[self setImports: (self imports copyWith: aNameSpace)] |
17786 | 379 |
|
380 |
"Created: / 21-07-2010 / 15:16:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
381 |
"Modified: / 21-07-2010 / 17:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
382 |
! |
|
383 |
||
17766
0acf634e6550
initial implementation of selector namespaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17748
diff
changeset
|
384 |
imports |
17900 | 385 |
Imports isNil ifTrue:[^#()]. |
17787 | 386 |
^Imports at: self ifAbsent:[#()]. |
17766
0acf634e6550
initial implementation of selector namespaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17748
diff
changeset
|
387 |
|
0acf634e6550
initial implementation of selector namespaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17748
diff
changeset
|
388 |
"Created: / 19-05-2010 / 16:06:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
17786 | 389 |
"Modified: / 21-07-2010 / 17:17:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
17900 | 390 |
"Modified: / 18-11-2011 / 14:48:56 / cg" |
17766
0acf634e6550
initial implementation of selector namespaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17748
diff
changeset
|
391 |
! |
0acf634e6550
initial implementation of selector namespaces
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17748
diff
changeset
|
392 |
|
4397
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
393 |
includesKey:aClassNameStringOrSymbol |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
394 |
"{ Pragma: +optSpace }" |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
395 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
396 |
"return true if such a key is present" |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
397 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
398 |
|nmSym| |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
399 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
400 |
nmSym := (self name , '::' , aClassNameStringOrSymbol) asSymbolIfInterned. |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
401 |
nmSym isNil ifTrue:[^ false]. |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
402 |
^ Smalltalk includesKey:nmSym. |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
403 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
404 |
|
9546 | 405 |
! |
406 |
||
10372 | 407 |
loadedClassNamed:aString |
408 |
"return the class with name aString, or nil if absent. |
|
409 |
To get to the metaClass, append ' class' to the string. |
|
410 |
Do not autoload the owning class of a private class." |
|
411 |
||
412 |
^ Smalltalk loadedClassNamed:(self name , '::' , aString) |
|
413 |
||
414 |
"Created: 9.9.1997 / 03:33:56 / cg" |
|
415 |
! |
|
416 |
||
9546 | 417 |
package |
418 |
self isNameSpace ifTrue:[ |
|
419 |
^ nil "all nameSpaces are outside of any package" |
|
420 |
]. |
|
421 |
^ super package "the nameSpace class itself has a package" |
|
422 |
||
423 |
"Created: / 16-08-2006 / 18:48:29 / User" |
|
1827 | 424 |
! ! |
425 |
||
5331 | 426 |
!NameSpace class methodsFor:'enumerating'! |
1816 | 427 |
|
428 |
allBehaviorsDo:aBlock |
|
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
429 |
"enumerate all classes in this namespace" |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
430 |
|
2492 | 431 |
Smalltalk allBehaviorsDo:[:aClass | |
4068
ba1b46d15e70
skip metaclasses when enumerating behaviors of a namespace
Claus Gittinger <cg@exept.de>
parents:
4058
diff
changeset
|
432 |
(aClass isBehavior and:[aClass isMeta not]) ifTrue:[ |
2583 | 433 |
aClass nameSpace == self ifTrue:[ |
434 |
aBlock value:aClass |
|
435 |
]. |
|
2492 | 436 |
] |
437 |
]. |
|
2583 | 438 |
|
4068
ba1b46d15e70
skip metaclasses when enumerating behaviors of a namespace
Claus Gittinger <cg@exept.de>
parents:
4058
diff
changeset
|
439 |
"Modified: / 18.3.1999 / 17:21:06 / cg" |
4397
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
440 |
! |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
441 |
|
5581 | 442 |
allClassesDo:aBlock |
443 |
"enumerate all classes in this namespace" |
|
444 |
||
445 |
Smalltalk allClassesDo:[:aClass | |
|
446 |
(aClass isBehavior and:[aClass isMeta not]) ifTrue:[ |
|
447 |
aClass nameSpace == self ifTrue:[ |
|
448 |
aBlock value:aClass |
|
449 |
]. |
|
450 |
] |
|
451 |
]. |
|
452 |
||
453 |
"Modified: / 18.3.1999 / 17:21:06 / cg" |
|
454 |
! |
|
455 |
||
17748
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
456 |
allClassesForWhich:filter |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
457 |
"return a collection with all classes in the system, |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
458 |
for which filter evaluates to true." |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
459 |
|
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
460 |
|collectedClasses| |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
461 |
|
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
462 |
collectedClasses := OrderedCollection new. |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
463 |
self allClassesForWhich:filter do:[:cls | |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
464 |
collectedClasses add:cls |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
465 |
]. |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
466 |
^ collectedClasses |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
467 |
|
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
468 |
" |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
469 |
Smalltalk |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
470 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
471 |
" |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
472 |
|
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
473 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
474 |
! |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
475 |
|
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
476 |
allClassesForWhich:filter do:aBlock |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
477 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true." |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
478 |
|
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
479 |
self allClassesDo:[:cls | |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
480 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
481 |
]. |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
482 |
|
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
483 |
" |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
484 |
Smalltalk |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
485 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
486 |
do:[:aClass | Transcript showCR:aClass name] |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
487 |
" |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
488 |
! |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
489 |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
490 |
allMethodsDo:aBlock |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
491 |
"enumerate all methods in this namespace's classes" |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
492 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
493 |
self allClassesDo:[:eachClass | |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
494 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
495 |
aBlock value:mthd |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
496 |
] |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
497 |
]. |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
498 |
! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
499 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
500 |
allMethodsWithSelectorDo:aBlock |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
501 |
"enumerate all methods in the Smalltalk namespace's classes" |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
502 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
503 |
self allClassesDo:[:eachClass | |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
504 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
505 |
aBlock value:mthd value:sel |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
506 |
] |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
507 |
]. |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
508 |
! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
509 |
|
17815 | 510 |
keyAtValue:anObject |
511 |
"return the symbol under which anObject is stored - or nil" |
|
512 |
||
513 |
self keysDo:[:aKey | |
|
514 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
|
515 |
]. |
|
516 |
^ nil |
|
517 |
||
518 |
"Smalltalk keyAtValue:Object" |
|
519 |
||
520 |
"Created: / 19-12-2010 / 14:35:49 / cg" |
|
521 |
! |
|
522 |
||
9289 | 523 |
keys |
524 |
"enumerate all class names in this namespace" |
|
525 |
||
526 |
|setOfKeys| |
|
527 |
||
528 |
setOfKeys := OrderedCollection new. |
|
529 |
self keysDo:[:eachKey |setOfKeys add:eachKey]. |
|
530 |
^ setOfKeys |
|
531 |
||
532 |
" |
|
533 |
Benchmarks keys |
|
534 |
" |
|
535 |
! |
|
536 |
||
4397
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
537 |
keysDo:aBlock |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
538 |
"enumerate all class names in this namespace" |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
539 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
540 |
|prefix prefixLen| |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
541 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
542 |
prefix := self name , '::'. |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
543 |
prefixLen := prefix size. |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
544 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
545 |
Smalltalk keysAndValuesDo:[:aName :aClass | |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
546 |
|key| |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
547 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
548 |
(aName startsWith:prefix) ifTrue:[ |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
549 |
key := (aName copyFrom:prefixLen+1) asSymbol. |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
550 |
aBlock value:key |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
551 |
] |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
552 |
]. |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
553 |
|
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
554 |
" |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
555 |
Benchmarks keysDo:[:k | Transcript showCR:k] |
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
556 |
" |
1816 | 557 |
! ! |
558 |
||
5331 | 559 |
!NameSpace class methodsFor:'fileOut'! |
1828 | 560 |
|
2058 | 561 |
fileOutDefinitionOn:aStream |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
562 |
"redefined to generate another definition message" |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
563 |
|
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
564 |
self == NameSpace ifTrue:[ |
2058 | 565 |
super fileOutDefinitionOn:aStream |
1934 | 566 |
] ifFalse:[ |
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
567 |
aStream nextPutAll:('NameSpace name:' , self name storeString) |
1934 | 568 |
] |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
569 |
|
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
570 |
"Modified: 8.11.1996 / 21:39:03 / cg" |
2058 | 571 |
"Created: 4.1.1997 / 20:36:32 / cg" |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
572 |
! ! |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
573 |
|
5464 | 574 |
!NameSpace class methodsFor:'fileOut-xml'! |
575 |
||
576 |
fileOutXMLDefinitionOn:aStream |
|
577 |
"redefined to generate another definition message" |
|
578 |
||
579 |
self == NameSpace ifTrue:[ |
|
580 |
super fileOutXMLDefinitionOn:aStream |
|
581 |
] ifFalse:[ |
|
582 |
aStream nextPutLine:'<name-space>'. |
|
583 |
aStream nextPutLine:' <name>' , self name , '</name>'. |
|
584 |
aStream nextPutLine:' <environment>Smalltalk</environment>'. |
|
585 |
aStream nextPutLine:' <private>false</private>'. |
|
586 |
aStream nextPutLine:' <imports>Smalltalk.*</imports>'. |
|
587 |
aStream nextPutLine:' <category>none</category>'. |
|
588 |
aStream nextPutLine:'</name-space>'. |
|
589 |
] |
|
590 |
! ! |
|
591 |
||
4397
bfcf41484c1f
added keysDo: and includesKey: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
4372
diff
changeset
|
592 |
|
5331 | 593 |
!NameSpace class methodsFor:'printing & storing'! |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
594 |
|
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
595 |
displayString |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
596 |
"return a printed represenation - here, a reminder is appended, |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
597 |
that this is not a regular class" |
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
598 |
|
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
599 |
self == NameSpace ifTrue:[ |
2007
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
600 |
^ super displayString |
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
601 |
]. |
5328
319b8e3ee60e
renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents:
5327
diff
changeset
|
602 |
^ self name , ' (* NameSpace *)' |
1943
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
603 |
|
0ec17e4627ae
better displayString & commentary
Claus Gittinger <cg@exept.de>
parents:
1934
diff
changeset
|
604 |
"Created: 8.11.1996 / 21:37:24 / cg" |
2007
57434c08d720
namespace itself is not a namespace
Claus Gittinger <cg@exept.de>
parents:
1943
diff
changeset
|
605 |
"Modified: 20.12.1996 / 15:11:31 / cg" |
1828 | 606 |
! ! |
607 |
||
17786 | 608 |
!NameSpace class methodsFor:'private'! |
609 |
||
610 |
setImports: anArrayOrNil |
|
611 |
||
612 |
"Sets namespace imports. Private entry, |
|
613 |
Use 'self import: theNamespace' instead" |
|
614 |
||
17900 | 615 |
Imports isNil ifTrue:[Imports := IdentityDictionary new]. |
616 |
Imports at: self put: (anArrayOrNil ? #()). |
|
17786 | 617 |
|
618 |
"Created: / 21-07-2010 / 15:29:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17900 | 619 |
"Modified: / 18-11-2011 / 14:49:10 / cg" |
17786 | 620 |
! ! |
621 |
||
5331 | 622 |
!NameSpace class methodsFor:'queries'! |
1816 | 623 |
|
9267 | 624 |
allNameSpaces |
2030 | 625 |
"return a list of all namespaces" |
626 |
||
9267 | 627 |
^ self allNameSpacesIn:Smalltalk |
6401 | 628 |
! |
629 |
||
9267 | 630 |
allNameSpacesIn:anEnvironment |
6401 | 631 |
"return a list of all namespaces" |
632 |
||
2030 | 633 |
|set| |
634 |
||
6401 | 635 |
set := IdentitySet with:anEnvironment. |
636 |
anEnvironment allClassesDo:[:aClass | |
|
10176 | 637 |
(aClass isRealNameSpace |
638 |
and:[aClass ~~ anEnvironment]) ifTrue:[ |
|
2030 | 639 |
set add:aClass |
640 |
] |
|
641 |
]. |
|
642 |
^ set |
|
10176 | 643 |
|
644 |
"Modified: / 10-11-2006 / 17:12:02 / cg" |
|
2055 | 645 |
! |
646 |
||
9267 | 647 |
allNamespaces |
648 |
"return a list of all namespaces" |
|
649 |
||
650 |
<resource: #obsolete> |
|
651 |
||
652 |
^ self allNameSpaces |
|
653 |
! |
|
654 |
||
655 |
allNamespacesIn:anEnvironment |
|
656 |
"return a list of all namespaces" |
|
657 |
||
658 |
<resource: #obsolete> |
|
659 |
||
660 |
^ self allNameSpacesIn:anEnvironment |
|
661 |
! |
|
662 |
||
9814 | 663 |
canHaveExtensions |
664 |
"return true, if this class allows extensions from other packages. |
|
665 |
Private classes, namespaces and projectDefinitions dont allow this" |
|
666 |
||
667 |
^ self == NameSpace |
|
668 |
||
669 |
" |
|
670 |
Smalltalk allClasses select:[:each | each canHaveExtensions not] |
|
671 |
" |
|
672 |
||
673 |
"Created: / 30-08-2006 / 15:28:39 / cg" |
|
674 |
! |
|
675 |
||
9267 | 676 |
hasNameSpaces |
677 |
"return true - if I support sub-namespaces" |
|
678 |
||
679 |
^ false |
|
680 |
! |
|
681 |
||
7317 | 682 |
hasNamespaces |
683 |
"return true - if I support sub-namespaces" |
|
684 |
||
9267 | 685 |
<resource: #obsolete> |
686 |
||
687 |
^ self hasNameSpaces |
|
7317 | 688 |
! |
689 |
||
5327
5e5602d156fa
#isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents:
5305
diff
changeset
|
690 |
isNameSpace |
9217 | 691 |
"return true, if the receiver is a nameSpace. |
10170 | 692 |
Unconditionally true here for subclasses - my subclasses are namespaces" |
2055 | 693 |
|
9372 | 694 |
^ self ~~ NameSpace . |
10170 | 695 |
|
696 |
"Modified: / 10-11-2006 / 17:01:56 / cg" |
|
697 |
! |
|
698 |
||
699 |
isRealNameSpace |
|
700 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class). |
|
701 |
Unconditionally true here for subclasses - my subclasses are namespaces" |
|
702 |
||
703 |
^ self ~~ NameSpace . |
|
704 |
||
705 |
"Created: / 10-11-2006 / 17:01:52 / cg" |
|
4457 | 706 |
! |
707 |
||
5464 | 708 |
isTopLevelNameSpace |
709 |
^ (self name includes:$:) not |
|
710 |
! |
|
711 |
||
4457 | 712 |
isTopLevelNamespace |
5365 | 713 |
"obsolete - use isTopLevelNameSpace" |
4457 | 714 |
|
9267 | 715 |
<resource: #obsolete> |
7433 | 716 |
|
5365 | 717 |
^ (self name includes:$:) not |
1816 | 718 |
! ! |
719 |
||
5331 | 720 |
!NameSpace class methodsFor:'documentation'! |
1816 | 721 |
|
17736 | 722 |
version_CVS |
17900 | 723 |
^ 'Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.72 2011/11/18 16:06:06 cg Exp ' |
17748
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
724 |
! |
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
725 |
|
085c769e2ec9
Added NameSpace class>>allClassesForWhich: and NameSpace class>>allClassesForWhich:do:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17736
diff
changeset
|
726 |
version_SVN |
17900 | 727 |
^ '$ Id: NameSpace.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
17846 | 728 |
! ! |
17900 | 729 |