git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@768 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2005-09-21 21:56:39 +00:00
parent 1dd7047af5
commit 18d9e1a256
2 changed files with 20 additions and 3 deletions

View File

@ -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);
}

View File

@ -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 {