added missing serialization to remove all warnings

pull/1/head
Michael Peter Christen 13 years ago
parent 1795a7325b
commit 15db703808

@ -20,6 +20,7 @@
package net.yacy.kelondro.data.citation; package net.yacy.kelondro.data.citation;
import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import net.yacy.cora.document.ASCII; import net.yacy.cora.document.ASCII;
@ -33,10 +34,12 @@ import net.yacy.kelondro.order.MicroDate;
import net.yacy.kelondro.rwi.Reference; import net.yacy.kelondro.rwi.Reference;
import net.yacy.kelondro.util.ByteArray; import net.yacy.kelondro.util.ByteArray;
public class CitationReference implements Reference /*, Cloneable*/ { public class CitationReference implements Reference, Serializable {
// this object stores citation attributes to URL references // this object stores citation attributes to URL references
private static final long serialVersionUID=1920200210928897131L;
public static final Row citationRow = new Row(new Column[]{ public static final Row citationRow = new Row(new Column[]{
new Column("h", Column.celltype_string, Column.encoder_bytes, Word.commonHashLength, "urlhash"), new Column("h", Column.celltype_string, Column.encoder_bytes, Word.commonHashLength, "urlhash"),
new Column("m", Column.celltype_cardinal, Column.encoder_b256, 2, "lastModified"), new Column("m", Column.celltype_cardinal, Column.encoder_b256, 2, "lastModified"),

@ -20,11 +20,15 @@
package net.yacy.kelondro.data.citation; package net.yacy.kelondro.data.citation;
import java.io.Serializable;
import net.yacy.kelondro.index.Row; import net.yacy.kelondro.index.Row;
import net.yacy.kelondro.index.Row.Entry; import net.yacy.kelondro.index.Row.Entry;
import net.yacy.kelondro.rwi.ReferenceFactory; import net.yacy.kelondro.rwi.ReferenceFactory;
public class CitationReferenceFactory implements ReferenceFactory<CitationReference> { public class CitationReferenceFactory implements ReferenceFactory<CitationReference>, Serializable {
private static final long serialVersionUID=-1098504892965986149L;
@Override @Override
public CitationReference produceSlow(final Entry e) { public CitationReference produceSlow(final Entry e) {

@ -26,21 +26,28 @@
package net.yacy.kelondro.data.image; package net.yacy.kelondro.data.image;
import java.io.Serializable;
import net.yacy.kelondro.index.Row; import net.yacy.kelondro.index.Row;
import net.yacy.kelondro.index.Row.Entry; import net.yacy.kelondro.index.Row.Entry;
import net.yacy.kelondro.rwi.ReferenceFactory; import net.yacy.kelondro.rwi.ReferenceFactory;
public class ImageReferenceFactory implements ReferenceFactory<ImageReference> { public class ImageReferenceFactory implements ReferenceFactory<ImageReference>, Serializable {
private static final long serialVersionUID=-2209473508756878863L;
@Override
public ImageReference produceSlow(Entry e) { public ImageReference produceSlow(Entry e) {
return null; //new ImageReferenceRow(e); return null; //new ImageReferenceRow(e);
} }
@Override
public ImageReference produceFast(ImageReference r) { public ImageReference produceFast(ImageReference r) {
if (r instanceof ImageReferenceVars) return r; if (r instanceof ImageReferenceVars) return r;
return new ImageReferenceVars(r); return new ImageReferenceVars(r);
} }
@Override
public Row getRow() { public Row getRow() {
return ImageReferenceRow.urlEntryRow; return ImageReferenceRow.urlEntryRow;
} }

@ -26,6 +26,7 @@
package net.yacy.kelondro.data.image; package net.yacy.kelondro.data.image;
import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
@ -38,9 +39,12 @@ import net.yacy.kelondro.rwi.Reference;
import net.yacy.kelondro.util.ByteArray; import net.yacy.kelondro.util.ByteArray;
public class ImageReferenceVars extends AbstractReference implements ImageReference, Reference, Cloneable { public class ImageReferenceVars extends AbstractReference implements ImageReference, Reference, Cloneable, Serializable {
/** private static final long serialVersionUID=3669156620967277347L;
/**
* object for termination of concurrent blocking queue processing * object for termination of concurrent blocking queue processing
*/ */
public static final ImageReferenceVars poison = new ImageReferenceVars(); public static final ImageReferenceVars poison = new ImageReferenceVars();

@ -26,21 +26,28 @@
package net.yacy.kelondro.data.navigation; package net.yacy.kelondro.data.navigation;
import java.io.Serializable;
import net.yacy.kelondro.index.Row; import net.yacy.kelondro.index.Row;
import net.yacy.kelondro.index.Row.Entry; import net.yacy.kelondro.index.Row.Entry;
import net.yacy.kelondro.rwi.ReferenceFactory; import net.yacy.kelondro.rwi.ReferenceFactory;
public class NavigationReferenceFactory implements ReferenceFactory<NavigationReference> { public class NavigationReferenceFactory implements ReferenceFactory<NavigationReference>, Serializable {
private static final long serialVersionUID=-3440570952034279619L;
@Override
public NavigationReference produceSlow(final Entry e) { public NavigationReference produceSlow(final Entry e) {
return new NavigationReferenceRow(e); return new NavigationReferenceRow(e);
} }
@Override
public NavigationReference produceFast(final NavigationReference r) { public NavigationReference produceFast(final NavigationReference r) {
if (r instanceof NavigationReferenceVars) return r; if (r instanceof NavigationReferenceVars) return r;
return new NavigationReferenceVars(r); return new NavigationReferenceVars(r);
} }
@Override
public Row getRow() { public Row getRow() {
return NavigationReferenceRow.navEntryRow; return NavigationReferenceRow.navEntryRow;
} }

@ -26,6 +26,7 @@
package net.yacy.kelondro.data.navigation; package net.yacy.kelondro.data.navigation;
import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import net.yacy.cora.document.ASCII; import net.yacy.cora.document.ASCII;
@ -33,7 +34,9 @@ import net.yacy.kelondro.index.Row.Entry;
import net.yacy.kelondro.rwi.AbstractReference; import net.yacy.kelondro.rwi.AbstractReference;
import net.yacy.kelondro.rwi.Reference; import net.yacy.kelondro.rwi.Reference;
public class NavigationReferenceVars extends AbstractReference implements NavigationReference, Reference, Cloneable { public class NavigationReferenceVars extends AbstractReference implements NavigationReference, Reference, Cloneable, Serializable {
private static final long serialVersionUID=2873544331190937594L;
public byte[] termhash, refhash; public byte[] termhash, refhash;
public int hitcount, position; public int hitcount, position;
@ -82,35 +85,43 @@ public class NavigationReferenceVars extends AbstractReference implements Navig
this.flags); this.flags);
} }
@Override
public String toPropertyForm() { public String toPropertyForm() {
return toRowEntry().toPropertyForm(); return toRowEntry().toPropertyForm();
} }
@Override
public Entry toKelondroEntry() { public Entry toKelondroEntry() {
return toRowEntry().toKelondroEntry(); return toRowEntry().toKelondroEntry();
} }
@Override
public String navigationHash() { public String navigationHash() {
return ASCII.String(this.termhash) + ASCII.String(this.refhash); return ASCII.String(this.termhash) + ASCII.String(this.refhash);
} }
@Override
public byte[] urlhash() { public byte[] urlhash() {
return this.refhash; return this.refhash;
} }
@Override
public byte[] termHash() { public byte[] termHash() {
return this.termhash; return this.termhash;
} }
@Override
public int hitcount() { public int hitcount() {
return this.hitcount; return this.hitcount;
} }
@Override
public int position(final int p) { public int position(final int p) {
assert p == 0 : "p = " + p; assert p == 0 : "p = " + p;
return this.position; return this.position;
} }
@Override
public byte flags() { public byte flags() {
return this.flags; return this.flags;
} }
@ -134,6 +145,7 @@ public class NavigationReferenceVars extends AbstractReference implements Navig
return this.navigationHash().equals(other.navigationHash()); return this.navigationHash().equals(other.navigationHash());
} }
@Override
public boolean isOlder(final Reference other) { public boolean isOlder(final Reference other) {
return false; return false;
} }
@ -141,14 +153,17 @@ public class NavigationReferenceVars extends AbstractReference implements Navig
// unsupported operations: // unsupported operations:
@Override
public void join(final Reference oe) { public void join(final Reference oe) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public long lastModified() { public long lastModified() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public Collection<Integer> positions() { public Collection<Integer> positions() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

@ -26,6 +26,7 @@
package net.yacy.kelondro.data.word; package net.yacy.kelondro.data.word;
import java.io.Serializable;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -39,7 +40,9 @@ import net.yacy.kelondro.rwi.ReferenceContainer;
import net.yacy.kelondro.rwi.ReferenceFactory; import net.yacy.kelondro.rwi.ReferenceFactory;
import net.yacy.kelondro.util.ByteBuffer; import net.yacy.kelondro.util.ByteBuffer;
public class WordReferenceFactory implements ReferenceFactory<WordReference> { public class WordReferenceFactory implements ReferenceFactory<WordReference>, Serializable {
private static final long serialVersionUID=-7168706947127349876L;
@Override @Override
public WordReference produceSlow(final Entry e) { public WordReference produceSlow(final Entry e) {

@ -237,7 +237,9 @@ public final class Row implements Serializable {
} }
public class Entry implements Comparable<Entry>, Comparator<Entry>, Cloneable { public class Entry implements Comparable<Entry>, Comparator<Entry>, Cloneable, Serializable {
private static final long serialVersionUID=-2576312347345553495L;
private byte[] rowinstance; private byte[] rowinstance;
private int offset; // the offset where the row starts within rowinstance private int offset; // the offset where the row starts within rowinstance
@ -634,7 +636,10 @@ public final class Row implements Serializable {
} }
public final class EntryIndex extends Entry { public final class EntryIndex extends Entry implements Serializable {
private static final long serialVersionUID=153069052590699231L;
private final int index; private final int index;
public EntryIndex(final byte[] row, final int i) { public EntryIndex(final byte[] row, final int i) {
super(row, false); super(row, false);

@ -24,11 +24,14 @@
package net.yacy.kelondro.order; package net.yacy.kelondro.order;
import java.io.Serializable;
public class Bitfield implements Cloneable {
public class Bitfield implements Cloneable, Serializable {
// the bitfield implements a binary array. Such arrays may be exported in a base64-String // the bitfield implements a binary array. Such arrays may be exported in a base64-String
private static final long serialVersionUID=3605122793792478052L;
private byte[] bb; private byte[] bb;
public Bitfield() { public Bitfield() {
@ -41,18 +44,18 @@ public class Bitfield implements Cloneable {
public Bitfield(final int bytelength) { public Bitfield(final int bytelength) {
this.bb= new byte[bytelength]; this.bb= new byte[bytelength];
for (int i = 0 ; i < bytelength; i++) bb[i] = 0; for (int i = 0 ; i < bytelength; i++) this.bb[i] = 0;
} }
public Bitfield(final int bytelength, final String exported) { public Bitfield(final int bytelength, final String exported) {
// imports a b64-encoded bitfield // imports a b64-encoded bitfield
final byte[] b = Base64Order.enhancedCoder.decode(exported); final byte[] b = Base64Order.enhancedCoder.decode(exported);
if (b.length == bytelength) { if (b.length == bytelength) {
bb = b; this.bb = b;
} else { } else {
bb = new byte[bytelength]; this.bb = new byte[bytelength];
assert (b.length <= bytelength) : "exported = " + exported + " has bytelength = " + b.length + " > " + bytelength; assert (b.length <= bytelength) : "exported = " + exported + " has bytelength = " + b.length + " > " + bytelength;
System.arraycopy(b, 0, bb, 0, Math.min(b.length, bytelength)); System.arraycopy(b, 0, this.bb, 0, Math.min(b.length, bytelength));
} }
} }
@ -66,37 +69,37 @@ public class Bitfield implements Cloneable {
public void set(final int pos, final boolean value) { public void set(final int pos, final boolean value) {
assert (pos >= 0); assert (pos >= 0);
final int slot = pos >> 3; // /8 final int slot = pos >> 3; // /8
if (slot >= bb.length) { if (slot >= this.bb.length) {
// extend capacity // extend capacity
byte[] nb = new byte[slot + 1]; byte[] nb = new byte[slot + 1];
System.arraycopy(bb, 0, nb, 0, bb.length); System.arraycopy(this.bb, 0, nb, 0, this.bb.length);
for (int i = bb.length; i < nb.length; i++) nb[i] = 0; for (int i = this.bb.length; i < nb.length; i++) nb[i] = 0;
bb = nb; this.bb = nb;
} }
if (value) { if (value) {
bb[slot] = (byte) (bb[slot] | (1 << (pos % 8))); this.bb[slot] = (byte) (this.bb[slot] | (1 << (pos % 8)));
} else { } else {
bb[slot] = (byte) (bb[slot] & (0xff ^ (1 << (pos % 8)))); this.bb[slot] = (byte) (this.bb[slot] & (0xff ^ (1 << (pos % 8))));
} }
} }
public boolean get(final int pos) { public boolean get(final int pos) {
assert (pos >= 0); assert (pos >= 0);
final int slot = pos >> 3; // /8 final int slot = pos >> 3; // /8
if (slot >= bb.length) return false; if (slot >= this.bb.length) return false;
return (bb[slot] & (1 << (pos % 8))) > 0; return (this.bb[slot] & (1 << (pos % 8))) > 0;
} }
public int length() { public int length() {
return bb.length << 3; return this.bb.length << 3;
} }
public String exportB64() { public String exportB64() {
return Base64Order.enhancedCoder.encode(bb); return Base64Order.enhancedCoder.encode(this.bb);
} }
public byte[] bytes() { public byte[] bytes() {
return bb; return this.bb;
} }
@Override @Override

@ -54,6 +54,8 @@ import net.yacy.kelondro.order.Base64Order;
*/ */
public class ReferenceContainer<ReferenceType extends Reference> extends RowSet { public class ReferenceContainer<ReferenceType extends Reference> extends RowSet {
private static final long serialVersionUID=-540567425172727979L;
private byte[] termHash; private byte[] termHash;
protected ReferenceFactory<ReferenceType> factory; protected ReferenceFactory<ReferenceType> factory;
public static int maxReferences = 0; // overwrite this to enable automatic index shrinking. 0 means no shrinking public static int maxReferences = 0; // overwrite this to enable automatic index shrinking. 0 means no shrinking
@ -255,16 +257,19 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
this.rowEntryIterator = iterator(); this.rowEntryIterator = iterator();
} }
@Override
public boolean hasNext() { public boolean hasNext() {
return this.rowEntryIterator.hasNext(); return this.rowEntryIterator.hasNext();
} }
@Override
public ReferenceType next() { public ReferenceType next() {
final Row.Entry rentry = this.rowEntryIterator.next(); final Row.Entry rentry = this.rowEntryIterator.next();
if (rentry == null) return null; if (rentry == null) return null;
return ReferenceContainer.this.factory.produceSlow(rentry); return ReferenceContainer.this.factory.produceSlow(rentry);
} }
@Override
public void remove() { public void remove() {
this.rowEntryIterator.remove(); this.rowEntryIterator.remove();
} }
@ -562,10 +567,12 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet
return pivot; return pivot;
} }
@Override
public synchronized String toString() { public synchronized String toString() {
return "C[" + ASCII.String(this.termHash) + "] has " + size() + " entries"; return "C[" + ASCII.String(this.termHash) + "] has " + size() + " entries";
} }
@Override
public int hashCode() { public int hashCode() {
return (int) Base64Order.enhancedCoder.decodeLong(this.termHash, 0, 4); return (int) Base64Order.enhancedCoder.decodeLong(this.termHash, 0, 4);
} }

@ -28,6 +28,7 @@
package net.yacy.peers.graphics; package net.yacy.peers.graphics;
import java.io.File; import java.io.File;
import java.io.Serializable;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -342,8 +343,9 @@ public class WebStructureGraph
hosthashes); hosthashes);
} }
public static class HostReferenceFactory implements ReferenceFactory<HostReference> public static class HostReferenceFactory implements ReferenceFactory<HostReference>, Serializable {
{
private static final long serialVersionUID=7461135579006223155L;
private static final Row hostReferenceRow = new Row( private static final Row hostReferenceRow = new Row(
"String h-6, Cardinal m-4 {b256}, Cardinal c-4 {b256}", "String h-6, Cardinal m-4 {b256}, Cardinal c-4 {b256}",
@ -369,8 +371,9 @@ public class WebStructureGraph
} }
public static class HostReference extends AbstractReference implements Reference public static class HostReference extends AbstractReference implements Reference, Serializable {
{
private static final long serialVersionUID=-9170091435821206765L;
private final Row.Entry entry; private final Row.Entry entry;

Loading…
Cancel
Save