01: package snow.utils.storage;
02:
03: import java.util.*;
04:
05: /** Use this instead of a vector to create vector representations for storage.
06: This allow to decouple the compiler warnings for unchecked casts
07: */
08: //@SuppressWarnings("unchecked")
09: public class StorageVector extends ArrayList<Object> {
10:
11: public StorageVector() {
12: super ();
13: }
14:
15: /** Call to help GC !!
16: * when no mo more needed. BECAREFUL, some recreation routines use the passed
17: * references => DO NOT terminate in these cases.
18: */
19: public void terminate() {
20: while (size() > 0) {
21: if (get(0) instanceof StorageVector) {
22: ((StorageVector) get(0)).terminate();
23: }
24:
25: if (remove(0) == null) {
26: System.out.println("Cannot remove");
27: }
28: }
29: }
30:
31: }
|