author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 31 May 2018 10:52:50 +0100 | |
branch | jv |
changeset 4330 | 998eb03f0736 |
parent 3011 | 1997ff6e7e55 |
permissions | -rw-r--r-- |
1445 | 1 |
" |
2 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
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 |
" |
|
12 |
||
1231 | 13 |
"{ Package: 'stx:libbasic3' }" |
14 |
||
15 |
"{ NameSpace: Packages }" |
|
16 |
||
17 |
Object subclass:#PackagesInstalled |
|
18 |
instanceVariableNames:'collection workingPackage' |
|
19 |
classVariableNames:'' |
|
20 |
poolDictionaries:'' |
|
21 |
category:'Package-helpers' |
|
22 |
! |
|
23 |
||
1445 | 24 |
!PackagesInstalled class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! ! |
|
1231 | 39 |
|
40 |
!PackagesInstalled class methodsFor:'instance creation'! |
|
41 |
||
42 |
new |
|
43 |
^ self basicNew initialize. |
|
44 |
! |
|
45 |
||
46 |
workingPackage:aPackage |
|
47 |
^ self new workingPackage:aPackage |
|
48 |
! ! |
|
49 |
||
50 |
!PackagesInstalled methodsFor:'* As yet uncategorized *'! |
|
51 |
||
52 |
allPackages |
|
53 |
^ collection copy at:#workinPackage put:workingPackage; yourself. |
|
54 |
! |
|
55 |
||
56 |
select:aBlock |
|
57 |
^ self allPackages values select:aBlock |
|
58 |
! ! |
|
59 |
||
60 |
!PackagesInstalled methodsFor:'accessing'! |
|
61 |
||
62 |
workingPackage |
|
63 |
"return the value of the instance variable 'currentPackage' (automatically generated)" |
|
64 |
||
65 |
^ workingPackage |
|
66 |
! |
|
67 |
||
68 |
workingPackage:something |
|
69 |
"set the value of the instance variable 'currentPackage' (automatically generated)" |
|
70 |
||
71 |
workingPackage := something. |
|
72 |
! ! |
|
73 |
||
74 |
!PackagesInstalled methodsFor:'adding & removing'! |
|
75 |
||
76 |
atKey:aSymbol |
|
77 |
||
78 |
^ collection at:aSymbol |
|
79 |
! |
|
80 |
||
81 |
pop |
|
82 |
collection removeKey:collection last key |
|
83 |
! |
|
84 |
||
85 |
pop:aNumber |
|
86 |
||
87 |
aNumber timesRepeat:[ self pop]. |
|
88 |
! |
|
89 |
||
90 |
popAt:aKey |
|
91 |
collection removeKey:aKey. |
|
92 |
! |
|
93 |
||
94 |
popAt:aKey ifAbsent:aBlock |
|
95 |
collection removeKey:aKey ifAbsent:aBlock. |
|
96 |
! |
|
97 |
||
98 |
pull |
|
99 |
^ self pop |
|
100 |
! |
|
101 |
||
102 |
pull:aNumber |
|
103 |
| col | |
|
104 |
col := collection last:aNumber. |
|
105 |
self pop:aNumber. |
|
106 |
^ col |
|
107 |
! |
|
108 |
||
109 |
pullAt:aKey |
|
110 |
^ collection removeKey:aKey. |
|
111 |
! |
|
112 |
||
113 |
pullAt:aKey ifAbsent:aBlock |
|
114 |
^ collection removeKey:aKey ifAbsent:aBlock. |
|
115 |
! |
|
116 |
||
117 |
push:aPackage |
|
118 |
||
119 |
^ collection at:aPackage name put:aPackage |
|
120 |
! |
|
121 |
||
122 |
removeKey:aSymbol |
|
123 |
||
124 |
^ collection removeKey:aSymbol |
|
125 |
! |
|
126 |
||
127 |
top |
|
128 |
^ collection last value |
|
129 |
! ! |
|
130 |
||
131 |
!PackagesInstalled methodsFor:'enumerating'! |
|
132 |
||
133 |
do:aBlock |
|
134 |
"goes through all the objects in the collection" |
|
135 |
aBlock value:workingPackage. |
|
136 |
collection reverseDo:[:anAssociation | aBlock value:anAssociation value] |
|
137 |
! ! |
|
138 |
||
139 |
!PackagesInstalled methodsFor:'initialization'! |
|
140 |
||
141 |
initialize |
|
142 |
collection := OrderedDictionary new. |
|
143 |
! ! |
|
144 |
||
145 |
!PackagesInstalled methodsFor:'queries'! |
|
146 |
||
147 |
includes:aPackage |
|
148 |
^ (aPackage == workingPackage or:[(collection includesValue:aPackage)]). |
|
149 |
! |
|
150 |
||
151 |
includesKey:aKey |
|
152 |
^ (collection includesKey:aKey) |
|
153 |
! |
|
154 |
||
155 |
isEmpty |
|
156 |
^ collection isEmpty |
|
157 |
! ! |
|
158 |
||
159 |
!PackagesInstalled class methodsFor:'documentation'! |
|
160 |
||
161 |
version |
|
3011
1997ff6e7e55
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1445
diff
changeset
|
162 |
^ '$Header: /var/local/cvs/stx/libbasic3/packages/PackagesInstalled.st,v 1.2 2006-01-10 09:32:15 cg Exp $' |
1231 | 163 |
! ! |