author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 18 Apr 2012 21:21:56 +0100 | |
branch | jv |
changeset 3051 | e056039b3a1b |
parent 3042 | 48e76977cdc3 |
child 3069 | 89d2cfee177f |
permissions | -rw-r--r-- |
2408 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, |
|
3 |
Czech Technical University in Prague |
|
4 |
Copyright (c) 2009-2010 eXept Software AG |
|
5 |
||
6 |
Permission is hereby granted, free of charge, to any person |
|
7 |
obtaining a copy of this software and associated documentation |
|
8 |
files (the 'Software'), to deal in the Software without |
|
9 |
restriction, including without limitation the rights to use, |
|
10 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11 |
copies of the Software, and to permit persons to whom the |
|
12 |
Software is furnished to do so, subject to the following |
|
13 |
conditions: |
|
14 |
||
15 |
The above copyright notice and this permission notice shall be |
|
16 |
included in all copies or substantial portions of the Software. |
|
17 |
||
18 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
19 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
20 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
21 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
22 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
23 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
24 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
25 |
OTHER DEALINGS IN THE SOFTWARE. |
|
26 |
" |
|
27 |
"{ Package: 'stx:libbasic3' }" |
|
28 |
||
29 |
ChangeSetDiffComponent subclass:#ChangeSetDiffSet |
|
30 |
instanceVariableNames:'name versionALabel versionBLabel versionBaseLabel diffs' |
|
31 |
classVariableNames:'' |
|
32 |
poolDictionaries:'' |
|
33 |
category:'System-Changes-Diff' |
|
34 |
! |
|
35 |
||
36 |
!ChangeSetDiffSet class methodsFor:'documentation'! |
|
37 |
||
38 |
copyright |
|
39 |
" |
|
40 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, |
|
41 |
Czech Technical University in Prague |
|
42 |
Copyright (c) 2009-2010 eXept Software AG |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
64 |
||
65 |
" |
|
66 |
! ! |
|
67 |
||
68 |
!ChangeSetDiffSet class methodsFor:'instance creation'! |
|
69 |
||
70 |
new |
|
71 |
^ self basicNew initialize. |
|
72 |
! ! |
|
73 |
||
74 |
!ChangeSetDiffSet methodsFor:'accessing'! |
|
75 |
||
76 |
diffs |
|
77 |
^ diffs |
|
78 |
! |
|
79 |
||
80 |
flattened |
|
81 |
||
82 |
| flattened s | |
|
83 |
flattened := self copy. |
|
84 |
s := (OrderedCollection new: diffs size) writeStream. |
|
85 |
self flattenOn: s. |
|
86 |
flattened setDiffs: s contents. |
|
87 |
^flattened |
|
88 |
||
89 |
"Created: / 05-12-2009 / 11:09:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
90 |
! |
|
91 |
||
92 |
merged |
|
93 |
||
94 |
^diffs allSatisfy:[:e|e merged] |
|
95 |
||
96 |
"Created: / 24-11-2009 / 10:04:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
97 |
! |
|
98 |
||
99 |
name |
|
2427 | 100 |
|
101 |
^ '%1 (%2)' bindWith: (name ? '<unnamed>') with: diffs size |
|
2408 | 102 |
|
103 |
"Modified: / 26-11-2009 / 16:26:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2427 | 104 |
"Modified: / 07-07-2011 / 14:15:12 / jv" |
2408 | 105 |
! |
106 |
||
107 |
name:aString |
|
108 |
name := aString. |
|
109 |
! |
|
110 |
||
111 |
resolution |
|
2627 | 112 |
| changeset | |
2408 | 113 |
|
114 |
changeset := ChangeSet new. |
|
2627 | 115 |
self do:[:diff| |
116 |
diff versionMerged notNil ifTrue:[ |
|
117 |
changeset add: diff versionMerged |
|
118 |
] |
|
119 |
]. |
|
2408 | 120 |
^changeset |
121 |
||
122 |
"Created: / 26-11-2009 / 08:44:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2627 | 123 |
"Modified: / 29-11-2011 / 11:25:02 / cg" |
2408 | 124 |
! |
125 |
||
126 |
versionALabel |
|
2628 | 127 |
^ versionALabel ifNil:[parent ifNotNil:[parent versionALabel]] |
2408 | 128 |
|
129 |
"Modified: / 21-11-2009 / 07:50:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2628 | 130 |
"Modified: / 29-11-2011 / 11:26:15 / cg" |
2408 | 131 |
! |
132 |
||
133 |
versionALabel:aString |
|
134 |
versionALabel := aString. |
|
135 |
! |
|
136 |
||
137 |
versionBLabel |
|
2628 | 138 |
^ versionBLabel ifNil:[parent ifNotNil:[parent versionBLabel]] |
2408 | 139 |
|
140 |
"Modified: / 21-11-2009 / 07:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2628 | 141 |
"Modified: / 29-11-2011 / 11:26:19 / cg" |
2408 | 142 |
! |
143 |
||
144 |
versionBLabel:aString |
|
145 |
versionBLabel := aString. |
|
146 |
! |
|
147 |
||
148 |
versionBaseLabel |
|
2628 | 149 |
^ versionBaseLabel ifNil:[parent ifNotNil:[parent versionBaseLabel]] |
2408 | 150 |
|
151 |
"Created: / 23-11-2009 / 22:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
152 |
"Modified: / 24-11-2009 / 09:21:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2628 | 153 |
"Modified (format): / 29-11-2011 / 11:26:37 / cg" |
2408 | 154 |
! |
155 |
||
156 |
versionBaseLabel:aString |
|
157 |
versionBaseLabel := aString. |
|
158 |
! ! |
|
159 |
||
160 |
!ChangeSetDiffSet methodsFor:'adding & removing'! |
|
161 |
||
162 |
add: anObject |
|
163 |
||
164 |
anObject parent: self. |
|
165 |
^diffs add: anObject |
|
166 |
||
167 |
"Created: / 09-11-2009 / 12:36:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
168 |
"Modified: / 10-11-2009 / 11:26:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
169 |
! |
|
170 |
||
171 |
addAll: aCollection |
|
172 |
||
173 |
aCollection do:[:e|self add:e] |
|
174 |
||
175 |
"Created: / 10-11-2009 / 11:27:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
176 |
! ! |
|
177 |
||
178 |
!ChangeSetDiffSet methodsFor:'enumerating'! |
|
179 |
||
180 |
collect: aBlock |
|
181 |
||
182 |
^diffs collect: aBlock |
|
183 |
||
184 |
"Created: / 10-11-2009 / 11:26:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
185 |
! |
|
186 |
||
187 |
do: aBlock |
|
188 |
||
189 |
^diffs do: [:each|each do:aBlock] |
|
190 |
||
191 |
"Created: / 10-11-2009 / 11:26:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
192 |
"Modified: / 25-11-2009 / 10:30:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
193 |
! ! |
|
194 |
||
195 |
!ChangeSetDiffSet methodsFor:'initialization'! |
|
196 |
||
197 |
initialize |
|
198 |
"Invoked when a new instance is created." |
|
199 |
||
200 |
"/ please change as required (and remove this comment) |
|
201 |
"/ name := nil. |
|
202 |
"/ versionALabel := nil. |
|
203 |
"/ versionBLabel := nil. |
|
204 |
diffs := OrderedCollection new:4. |
|
205 |
||
206 |
"/ super initialize. -- commented since inherited method does nothing |
|
207 |
||
208 |
"Modified: / 10-11-2009 / 11:25:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
209 |
! |
|
210 |
||
211 |
setDiffs: aCollection |
|
212 |
||
213 |
diffs := aCollection |
|
214 |
||
215 |
"Created: / 05-12-2009 / 11:09:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
216 |
! ! |
|
217 |
||
218 |
!ChangeSetDiffSet methodsFor:'private'! |
|
219 |
||
220 |
flattenOn: stream |
|
221 |
||
222 |
diffs do:[:diff|diff flattenOn: stream] |
|
223 |
||
224 |
"Created: / 05-12-2009 / 11:07:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
225 |
! ! |
|
226 |
||
227 |
!ChangeSetDiffSet methodsFor:'testing'! |
|
228 |
||
229 |
isDiffSet |
|
230 |
^ true |
|
231 |
! |
|
232 |
||
233 |
isEmpty |
|
234 |
||
235 |
^diffs isEmpty or:[diffs allSatisfy: [:diff|diff isEmpty]] |
|
236 |
||
237 |
"Created: / 25-11-2009 / 20:37:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
238 |
"Modified: / 09-12-2009 / 17:43:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3030 | 239 |
! |
240 |
||
3051 | 241 |
isForVersionMethod |
242 |
"Returns true, if this is an entry for version method" |
|
243 |
||
244 |
^diffs allSatisfy:[:each|each isForVersionMethod] |
|
245 |
||
246 |
"Created: / 18-04-2012 / 19:05:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
247 |
! |
|
248 |
||
3030 | 249 |
isMerged |
250 |
"raise an error: must be redefined in concrete subclass(es)" |
|
251 |
||
252 |
^ self diffs allSatisfy:[:e|e isMerged]. |
|
253 |
||
254 |
"Created: / 19-03-2012 / 15:15:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2408 | 255 |
! ! |
256 |
||
257 |
!ChangeSetDiffSet class methodsFor:'documentation'! |
|
258 |
||
2628 | 259 |
version |
3051 | 260 |
^ '$Id: ChangeSetDiffSet.st 1920 2012-04-18 20:21:56Z vranyj1 $' |
2628 | 261 |
! |
262 |
||
2408 | 263 |
version_CVS |
3011
1997ff6e7e55
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2628
diff
changeset
|
264 |
^ '§Header: /cvs/stx/stx/libbasic3/ChangeSetDiffSet.st,v 1.4 2011/11/29 10:26:48 cg Exp §' |
3012 | 265 |
! |
266 |
||
267 |
version_SVN |
|
3051 | 268 |
^ '$Id: ChangeSetDiffSet.st 1920 2012-04-18 20:21:56Z vranyj1 $' |
3012 | 269 |
! ! |