216 "Created: / 18-02-2008 / 22:52:24 / janfrog" |
216 "Created: / 18-02-2008 / 22:52:24 / janfrog" |
217 "Modified: / 19-02-2008 / 09:35:11 / janfrog" |
217 "Modified: / 19-02-2008 / 09:35:11 / janfrog" |
218 ! |
218 ! |
219 |
219 |
220 findNodeForInterval:anInterval |
220 findNodeForInterval:anInterval |
221 |
|
222 " |
221 " |
223 An empty interval check based on Claus suggestion |
222 An empty interval check based on Claus' suggestion |
224 (email Fri, 10 Oct 2008 16:10:25 +0200) |
223 (email Fri, 10 Oct 2008 16:10:25 +0200) |
225 " |
224 " |
226 anInterval isEmpty ifTrue:[^nil]. |
225 anInterval isEmpty ifTrue:[^nil]. |
227 |
226 |
228 ^self findNodeIn: self parseTree forInterval: anInterval |
227 ^self findNodeIn: self parseTree forInterval: anInterval |
231 "Modified: / 18-10-2008 / 16:47:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
230 "Modified: / 18-10-2008 / 16:47:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
232 "Modified: / 01-09-2009 / 22:45:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
231 "Modified: / 01-09-2009 / 22:45:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
233 ! |
232 ! |
234 |
233 |
235 findNodeIn:tree forInterval:interval |
234 findNodeIn:tree forInterval:interval |
236 |node wouldReturn| |
235 ^ DoWhatIMeanSupport findNodeIn:tree forInterval:interval |
237 |
236 "/ |node wouldReturn| |
238 node := nil. |
237 "/ |
239 tree = #error ifTrue:[^nil]. |
238 "/ node := nil. |
240 tree nodesDo:[:each | |
239 "/ tree = #error ifTrue:[^nil]. |
241 (each intersectsInterval:interval) ifTrue:[ |
240 "/ tree nodesDo:[:each | |
242 (node isNil or:[node == each parent]) ifTrue:[ |
241 "/ (each intersectsInterval:interval) ifTrue:[ |
243 node := each |
242 "/ (node isNil or:[node == each parent]) ifTrue:[ |
244 ] ifFalse:[ |
243 "/ node := each |
245 (node parent notNil |
244 "/ ] ifFalse:[ |
246 and:[node parent isCascade and:[each parent isCascade]]) ifFalse:[^ nil] |
245 "/ (node parent notNil |
247 ] |
246 "/ and:[node parent isCascade and:[each parent isCascade]]) ifFalse:[^ nil] |
248 ] ifFalse:[ |
247 "/ ] |
249 node notNil ifTrue:[ |
248 "/ ] ifFalse:[ |
250 "/ already found one - beyond that one; leave |
249 "/ node notNil ifTrue:[ |
251 wouldReturn notNil ifTrue:[wouldReturn := node]. |
250 "/ "/ already found one - beyond that one; leave |
252 ] |
251 "/ wouldReturn notNil ifTrue:[wouldReturn := node]. |
253 ]. |
252 "/ ] |
254 ]. |
253 "/ ]. |
255 (wouldReturn notNil and:[wouldReturn ~~ node]) ifTrue:[self halt]. |
254 "/ ]. |
256 ^ node |
255 "/(wouldReturn notNil and:[wouldReturn ~~ node]) ifTrue:[self halt]. |
|
256 "/ ^ node |
257 |
257 |
258 "Created: / 19-02-2008 / 09:40:24 / janfrog" |
258 "Created: / 19-02-2008 / 09:40:24 / janfrog" |
259 "Modified: / 21-02-2008 / 09:35:31 / janfrog" |
259 "Modified: / 21-02-2008 / 09:35:31 / janfrog" |
260 ! |
260 ! |
261 |
261 |