Author: orbiter
Date: 2008-03-10 00:48:24 +0100 (Mon, 10 Mar 2008)
New Revision: 4542
Modified:
trunk/.classpath
trunk/source/de/anomic/http/httpd.java
trunk/source/de/anomic/icap/icapd.java
trunk/source/de/anomic/index/indexRWIRowEntry.java
trunk/source/de/anomic/kelondro/kelondroAbstractRecords.java
trunk/source/de/anomic/kelondro/kelondroBitfield.java
trunk/source/de/anomic/kelondro/kelondroMScoreCluster.java
trunk/source/de/anomic/kelondro/kelondroProfile.java
trunk/source/de/anomic/net/ftpc.java
trunk/source/de/anomic/plasma/plasmaHTCache.java
trunk/source/de/anomic/server/serverHandler.java
trunk/source/de/anomic/tools/disorderSet.java
trunk/source/de/anomic/urlRedirector/urlRedirectord.java
trunk/source/de/anomic/yacy/yacySeed.java
Log:
some code enhancements and bugfixes
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2008-03-09 17:25:09 UTC (rev 4541)
+++ trunk/.classpath 2008-03-09 23:48:24 UTC (rev 4542)
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry
excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/"
kind="src" path="htroot"/>
- <classpathentry excluding="user/|user/" kind="src" path="htroot/yacy"/>
+ <classpathentry
excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/"
kind="src" path="htroot"/>
+ <classpathentry excluding="user/|user/|ui/" kind="src"
path="htroot/yacy"/>
<classpathentry kind="src" path="htroot/env"/>
<classpathentry kind="src" path="source"/>
<classpathentry kind="src" path="htroot/yacy/user"/>
+ <classpathentry kind="src" path="htroot/yacy/ui"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/tar.jar"/>
<classpathentry kind="lib" path="libx/axis-ant.jar"/>
Modified: trunk/source/de/anomic/http/httpd.java
===================================================================
--- trunk/source/de/anomic/http/httpd.java 2008-03-09 17:25:09 UTC (rev
4541)
+++ trunk/source/de/anomic/http/httpd.java 2008-03-09 23:48:24 UTC (rev
4542)
@@ -1036,7 +1036,7 @@
return true;
}
- public Object clone() {
+ public httpd clone() {
return new httpd(switchboard);
}
Modified: trunk/source/de/anomic/icap/icapd.java
===================================================================
--- trunk/source/de/anomic/icap/icapd.java 2008-03-09 17:25:09 UTC (rev
4541)
+++ trunk/source/de/anomic/icap/icapd.java 2008-03-09 23:48:24 UTC (rev
4542)
@@ -105,7 +105,7 @@
}
- public Object clone(){
+ public icapd clone(){
return new icapd();
}
Modified: trunk/source/de/anomic/index/indexRWIRowEntry.java
===================================================================
--- trunk/source/de/anomic/index/indexRWIRowEntry.java 2008-03-09 17:25:09 UTC
(rev 4541)
+++ trunk/source/de/anomic/index/indexRWIRowEntry.java 2008-03-09 23:48:24 UTC
(rev 4542)
@@ -163,7 +163,7 @@
return (int) (time / 86400000);
}
- public Object clone() {
+ public indexRWIRowEntry clone() {
byte[] b = new byte[urlEntryRow.objectsize];
System.arraycopy(entry.bytes(), 0, b, 0, urlEntryRow.objectsize);
return new indexRWIRowEntry(b);
Modified: trunk/source/de/anomic/kelondro/kelondroAbstractRecords.java
===================================================================
--- trunk/source/de/anomic/kelondro/kelondroAbstractRecords.java
2008-03-09 17:25:09 UTC (rev 4541)
+++ trunk/source/de/anomic/kelondro/kelondroAbstractRecords.java
2008-03-09 23:48:24 UTC (rev 4542)
@@ -720,7 +720,7 @@
// check handle
seekp = seekpos(h);
if (seekp > entryFile.length()) {
- // repair last hande store position
+ // repair last handle store position
this.theLogger.severe("KELONDRO WARNING " +
this.filename + ": seek position " + seekp + "/" + h.index + " out of file size
" + entryFile.length() + "/" + ((entryFile.length() - POS_NODES) / recordsize)
+ " after " + markedDeleted.size() + " iterations; patched wrong node");
entryFile.writeInt(repair_position,
kelondroHandle.NUL);
return markedDeleted;
@@ -871,6 +871,7 @@
return new contentRowIterator(maxInitTime);
}
+ /*
public final class contentRowIterator implements Iterator<EntryIndex> {
// iterator that iterates all kelondroRow.Entry-objects in the file
// all records that are marked as deleted are omitted
@@ -885,6 +886,15 @@
return nodeIterator.hasNext();
}
+ public EntryIndex next0() {
+ try {
+ kelondroNode n = (kelondroNode) nodeIterator.next();
+ return row().newEntryIndex(n.getValueRow(), n.handle().index);
+ } catch (IOException e) {
+ throw new kelondroException(filename, e.getMessage());
+ }
+ }
+
public EntryIndex next() {
try {
kelondroNode n = (kelondroNode) nodeIterator.next();
@@ -899,6 +909,54 @@
}
}
+ */
+
+ public final class contentRowIterator implements Iterator<EntryIndex> {
+ // iterator that iterates all kelondroRow.Entry-objects in the file
+ // all records that are marked as deleted are omitted
+
+ private Iterator<kelondroNode> nodeIterator;
+ private EntryIndex nextEntry;
+
+ public contentRowIterator(long maxInitTime) {
+ nodeIterator = contentNodes(maxInitTime);
+ if (nodeIterator.hasNext()) nextEntry = next0(); else nextEntry =
null;
+ }
+
+ public boolean hasNext() {
+ return nextEntry != null;
+ }
+
+ public EntryIndex next0() {
+ if (!nodeIterator.hasNext()) {
+ return null;
+ }
+ try {
+ kelondroNode n = (kelondroNode) nodeIterator.next();
+ return row().newEntryIndex(n.getValueRow(), n.handle().index);
+ } catch (IOException e) {
+ throw new kelondroException(filename, e.getMessage());
+ }
+ }
+
+ public EntryIndex next() {
+ EntryIndex ni = nextEntry;
+ byte[] b;
+ nextEntry = null;
+ while (nodeIterator.hasNext()) {
+ nextEntry = next0();
+ if (nextEntry == null) break;
+ b = nextEntry.bytes();
+ if ((b[0] != -128) || (b[1] != 0)) break;
+ }
+ return ni;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ }
protected final Iterator<kelondroNode> contentNodes(long maxInitTime)
throws kelondroException {
// returns an iterator of Node-objects that are not marked as 'deleted'
Modified: trunk/source/de/anomic/kelondro/kelondroBitfield.java
===================================================================
--- trunk/source/de/anomic/kelondro/kelondroBitfield.java 2008-03-09
17:25:09 UTC (rev 4541)
+++ trunk/source/de/anomic/kelondro/kelondroBitfield.java 2008-03-09
23:48:24 UTC (rev 4542)
@@ -55,7 +55,7 @@
}
}
- public Object clone() {
+ public kelondroBitfield clone() {
kelondroBitfield theClone = new kelondroBitfield(new
byte[this.bb.length]);
System.arraycopy(this.bb, 0, theClone.bb, 0, this.bb.length);
return theClone;
Modified: trunk/source/de/anomic/kelondro/kelondroMScoreCluster.java
===================================================================
--- trunk/source/de/anomic/kelondro/kelondroMScoreCluster.java 2008-03-09
17:25:09 UTC (rev 4541)
+++ trunk/source/de/anomic/kelondro/kelondroMScoreCluster.java 2008-03-09
23:48:24 UTC (rev 4542)
@@ -272,13 +272,13 @@
return (int) ((keyrefDB.firstKey().longValue() & 0xFFFFFFFF00000000L)
>> 32);
}
- public synchronized Object getMaxObject() {
+ public synchronized E getMaxObject() {
if (refkeyDB.size() == 0) return null;
//return getScores(1, false)[0];
return keyrefDB.get(keyrefDB.lastKey());
}
- public synchronized Object getMinObject() {
+ public synchronized E getMinObject() {
if (refkeyDB.size() == 0) return null;
//return getScores(1, true)[0];
return keyrefDB.get(keyrefDB.firstKey());
Modified: trunk/source/de/anomic/kelondro/kelondroProfile.java
===================================================================
--- trunk/source/de/anomic/kelondro/kelondroProfile.java 2008-03-09
17:25:09 UTC (rev 4541)
+++ trunk/source/de/anomic/kelondro/kelondroProfile.java 2008-03-09
23:48:24 UTC (rev 4542)
@@ -81,7 +81,7 @@
accDelete += System.currentTimeMillis() - handle;
}
- public Object clone() {
+ public kelondroProfile clone() {
kelondroProfile clone = new kelondroProfile();
clone.accRead = this.accRead;
clone.accWrite = this.accWrite;
Modified: trunk/source/de/anomic/net/ftpc.java
===================================================================
--- trunk/source/de/anomic/net/ftpc.java 2008-03-09 17:25:09 UTC (rev
4541)
+++ trunk/source/de/anomic/net/ftpc.java 2008-03-09 23:48:24 UTC (rev
4542)
@@ -1705,7 +1705,7 @@
// write remote file to local file
byte[] block = new byte[blockSize];
int numRead;
- long length = 0;
+ int length = 0;
while ((numRead = ClientStream.read(block)) != -1) {
outFile.write(block, 0, numRead);
@@ -1726,7 +1726,7 @@
// write statistics
long stop = System.currentTimeMillis();
out.print("---- downloaded " +
- ((length < 2048) ? length + " bytes" : ((int) length / 1024) + "
kbytes") +
+ ((length < 2048) ? length + " bytes" : (length / 1024) + " kbytes") +
" in " +
(((stop - start) < 2000) ? (stop - start) + " milliseconds" : (((int)
((stop - start) / 100)) / 10) + " seconds"));
if (start == stop) err.println(logPrefix + ""); else
Modified: trunk/source/de/anomic/plasma/plasmaHTCache.java
===================================================================
--- trunk/source/de/anomic/plasma/plasmaHTCache.java 2008-03-09 17:25:09 UTC
(rev 4541)
+++ trunk/source/de/anomic/plasma/plasmaHTCache.java 2008-03-09 23:48:24 UTC
(rev 4542)
@@ -1020,7 +1020,7 @@
*/
private IResourceInfo resInfo;
- protected Object clone() throws CloneNotSupportedException {
+ protected Entry clone() throws CloneNotSupportedException {
return new Entry(
this.initDate,
this.depth,
Modified: trunk/source/de/anomic/server/serverHandler.java
===================================================================
--- trunk/source/de/anomic/server/serverHandler.java 2008-03-09 17:25:09 UTC
(rev 4541)
+++ trunk/source/de/anomic/server/serverHandler.java 2008-03-09 23:48:24 UTC
(rev 4542)
@@ -109,7 +109,7 @@
// each time a server makes a new connection it clones the hanlder
prototype
// the clone method does not need to clone every detail of a handler
connection,
// but only the necessary one for a newly initialized instance
- public Object clone();
+ public serverHandler clone();
/**
* Instead of using clone this function can be used to reset an existing
Modified: trunk/source/de/anomic/tools/disorderSet.java
===================================================================
--- trunk/source/de/anomic/tools/disorderSet.java 2008-03-09 17:25:09 UTC
(rev 4541)
+++ trunk/source/de/anomic/tools/disorderSet.java 2008-03-09 23:48:24 UTC
(rev 4542)
@@ -58,7 +58,7 @@
return (this.size() > 0);
}
- public Object any() {
+ public String any() {
// return just any element
if ((dh == null) || (dh.size() == 0)) {
if (this.size() == 0) return null;
Modified: trunk/source/de/anomic/urlRedirector/urlRedirectord.java
===================================================================
--- trunk/source/de/anomic/urlRedirector/urlRedirectord.java 2008-03-09
17:25:09 UTC (rev 4541)
+++ trunk/source/de/anomic/urlRedirector/urlRedirectord.java 2008-03-09
23:48:24 UTC (rev 4542)
@@ -90,7 +90,7 @@
return null;
}
- public Object clone() {
+ public urlRedirectord clone() {
return null;
}
Modified: trunk/source/de/anomic/yacy/yacySeed.java
===================================================================
--- trunk/source/de/anomic/yacy/yacySeed.java 2008-03-09 17:25:09 UTC (rev
4541)
+++ trunk/source/de/anomic/yacy/yacySeed.java 2008-03-09 23:48:24 UTC (rev
4542)
@@ -860,9 +860,9 @@
}
@SuppressWarnings("unchecked")
- public final Object clone() {
+ public final yacySeed clone() {
synchronized (this.dna) {
- return new yacySeed(this.hash, (HashMap<String, String>) (new
HashMap<String, String>(this.dna)).clone());
+ return new yacySeed(this.hash, (HashMap<String, String>) (new
HashMap<String, String>(this.dna).clone()));
}
}
_______________________________________________
YaCy-svn mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yacy-svn