comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 1062:58b4a07db856

Cach improvement: remove the cached elements of each visited state that is visited while stepping back to a previous state. gnv-artifacts/trunk@1147 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 02 Jun 2010 09:52:39 +0000
parents 13bea93a070a
children f953c9a559d8
comparison
equal deleted inserted replaced
1061:13bea93a070a 1062:58b4a07db856
189 XMLUtils.newDocument()); 189 XMLUtils.newDocument());
190 } 190 }
191 } 191 }
192 192
193 // step backward 193 // step backward
194 else if((next = getPreviousState(current, targetState)) != null) { 194 else if((next = getPreviousState(current, targetState, context))
195 != null)
196 {
195 197
196 if (current != null) { 198 if (current != null) {
197 current.endOfLife(context.globalContext()); 199 current.endOfLife(context.globalContext());
198 } 200 }
199 201
290 292
291 293
292 /** 294 /**
293 * Step back to the previous state specified by <code>name</code>. 295 * Step back to the previous state specified by <code>name</code>.
294 */ 296 */
295 protected State getPreviousState(State current, String name) { 297 protected State getPreviousState(
298 State current, String name, CallContext context)
299 {
296 if (current == null) { 300 if (current == null) {
297 return null; 301 return null;
298 } 302 }
299 303
300 if (current.getID().equals(name)) { 304 if (current.getID().equals(name)) {
301 return current; 305 return current;
302 } 306 }
303 else { 307 else {
304 return getPreviousState(current.getParent(), name); 308 current.endOfLife(context);
309 return getPreviousState(current.getParent(), name, context);
305 } 310 }
306 } 311 }
307 312
308 313
309 private boolean isStateCurrentlyReachable(String stateid){ 314 private boolean isStateCurrentlyReachable(String stateid){

http://dive4elements.wald.intevation.org