orbiter 20 years ago
parent 1dd7047af5
commit 18d9e1a256

@ -333,6 +333,11 @@ public class kelondroRecords {
this.XcacheStartup = System.currentTimeMillis();
}
public File file() {
if (filename == null) return null;
return new File(filename);
}
private int cacheChunkSize(boolean cacheControl) {
return this.headchunksize + element_in_cache + ((cacheControl) ? cache_control_entry : 0);
}

@ -49,6 +49,7 @@ import java.util.TreeMap;
import de.anomic.kelondro.kelondroRecords;
import de.anomic.kelondro.kelondroTree;
import de.anomic.kelondro.kelondroException;
public class plasmaWordIndexEntity {
@ -237,18 +238,29 @@ public class plasmaWordIndexEntity {
public class dbenum implements Enumeration {
Iterator i;
public dbenum(boolean up) {
i = theIndex.nodeIterator(up, false);
try {
i = theIndex.nodeIterator(up, false);
} catch (kelondroException e) {
e.printStackTrace();
theIndex.file().delete();
i = null;
}
}
public boolean hasMoreElements() {
return i.hasNext();
return (i != null) && (i.hasNext());
}
public Object nextElement() {
if (i == null) return null;
try {
byte[][] n = ((kelondroRecords.Node) i.next()).getValues();
return new plasmaWordIndexEntry(new String(n[0]), new String(n[1]));
} catch (IOException e) {
i = null;
throw new RuntimeException("dbenum: " + e.getMessage());
}
} catch (kelondroException e) {
i = null;
throw new RuntimeException("dbenum: " + e.getMessage());
}
}
}
public class tmpenum implements Enumeration {

Loading…
Cancel
Save