|
|
|
@ -9,7 +9,7 @@
|
|
|
|
|
// $LastChangedBy$
|
|
|
|
|
//
|
|
|
|
|
// LICENSE
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
@ -52,8 +52,8 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
* object for termination of concurrent blocking queue processing
|
|
|
|
|
*/
|
|
|
|
|
public static final ImageReferenceRow poison = new ImageReferenceRow((Row.Entry) null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final Row urlEntryRow = new Row(new Column[]{
|
|
|
|
|
new Column("h", Column.celltype_string, Column.encoder_bytes, Word.commonHashLength, "urlhash"),
|
|
|
|
|
new Column("f", Column.celltype_cardinal, Column.encoder_b256, 4, "created"),
|
|
|
|
@ -65,7 +65,7 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
new Column("i", Column.celltype_cardinal, Column.encoder_b256, 2, "height"), // pixels
|
|
|
|
|
new Column("i", Column.celltype_cardinal, Column.encoder_b256, 2, "iso"), // iso number
|
|
|
|
|
new Column("i", Column.celltype_cardinal, Column.encoder_b256, 2, "verschlusszeit"), // the x in 1/x
|
|
|
|
|
new Column("i", Column.celltype_cardinal, Column.encoder_b256, 2, "blende"),
|
|
|
|
|
new Column("i", Column.celltype_cardinal, Column.encoder_b256, 2, "blende"),
|
|
|
|
|
new Column("i", Column.celltype_cardinal, Column.encoder_b256, 4, "distance"),
|
|
|
|
|
new Column("o", Column.celltype_cardinal, Column.encoder_b256, 4, "author-id"), // author, creator, operator, camera-number
|
|
|
|
|
new Column("o", Column.celltype_cardinal, Column.encoder_b256, 4, "group-id"), // may be also a crawl start identifier
|
|
|
|
@ -82,7 +82,7 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
Base64Order.enhancedCoder
|
|
|
|
|
);
|
|
|
|
|
// available chars: b,e,j,q
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// static properties
|
|
|
|
|
private static final int col_urlhash = 0; // h 12 the url hash b64-encoded
|
|
|
|
|
private static final int col_lastModified = 1; // a 2 last-modified time of the document where word appears
|
|
|
|
@ -101,15 +101,15 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
private static final int col_posofphrase = 17; // o 1 number of the phrase where word appears
|
|
|
|
|
private static final int col_reserve1 = 18; // i 1 reserve1
|
|
|
|
|
private static final int col_reserve2 = 19; // k 1 reserve2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ideas for the classification bytes
|
|
|
|
|
// 0 : content-type (person-portrait, persons-group, landscape, buildings, technical, artistical)
|
|
|
|
|
// 1 : content-situation (a categorization of the type, like: person/standing, building/factory, artistical/cubistic)
|
|
|
|
|
// 2 : content-category (a classification that is taken from the text environment by text analysis)
|
|
|
|
|
// 3 :
|
|
|
|
|
// 3 :
|
|
|
|
|
|
|
|
|
|
private final Row.Entry entry;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ImageReferenceRow(final byte[] urlHash,
|
|
|
|
|
final int urlLength, // byte-length of complete URL
|
|
|
|
|
final int urlComps, // number of path components
|
|
|
|
@ -147,7 +147,7 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
this.entry.setCol(col_reserve1, 0);
|
|
|
|
|
this.entry.setCol(col_reserve2, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ImageReferenceRow(final byte[] urlHash,
|
|
|
|
|
final int urlLength, // byte-length of complete URL
|
|
|
|
|
final int urlComps, // number of path components
|
|
|
|
@ -174,44 +174,47 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
this.entry.setCol(col_reserve1, 0);
|
|
|
|
|
this.entry.setCol(col_reserve2, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ImageReferenceRow(final String urlHash, final String code) {
|
|
|
|
|
// the code is the external form of the row minus the leading urlHash entry
|
|
|
|
|
this.entry = urlEntryRow.newEntry(UTF8.getBytes((urlHash + code)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ImageReferenceRow(final String external) {
|
|
|
|
|
this.entry = urlEntryRow.newEntry(external, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ImageReferenceRow(final byte[] row) {
|
|
|
|
|
this.entry = urlEntryRow.newEntry(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ImageReferenceRow(final byte[] row, final int offset, final boolean clone) {
|
|
|
|
|
this.entry = urlEntryRow.newEntry(row, offset, clone);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ImageReferenceRow(final Row.Entry rentry) {
|
|
|
|
|
// FIXME: see if cloning is necessary
|
|
|
|
|
this.entry = rentry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ImageReferenceRow clone() {
|
|
|
|
|
final byte[] b = new byte[urlEntryRow.objectsize];
|
|
|
|
|
System.arraycopy(entry.bytes(), 0, b, 0, urlEntryRow.objectsize);
|
|
|
|
|
System.arraycopy(this.entry.bytes(), 0, b, 0, urlEntryRow.objectsize);
|
|
|
|
|
return new ImageReferenceRow(b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String toPropertyForm() {
|
|
|
|
|
return entry.toPropertyForm('=', true, true, false, false);
|
|
|
|
|
return this.entry.toPropertyForm('=', true, true, false, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Entry toKelondroEntry() {
|
|
|
|
|
return this.entry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public byte[] urlhash() {
|
|
|
|
|
return this.entry.getColBytes(col_urlhash, true);
|
|
|
|
|
}
|
|
|
|
@ -220,10 +223,11 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
return (int) this.entry.getColLong(col_lastModified); // this is the time in MicoDateDays format
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public long lastModified() {
|
|
|
|
|
return MicroDate.reverseMicroDateDays((int) this.entry.getColLong(col_lastModified));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public long freshUntil() {
|
|
|
|
|
return MicroDate.reverseMicroDateDays((int) this.entry.getColLong(col_freshUntil));
|
|
|
|
|
}
|
|
|
|
@ -232,6 +236,7 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
return (int) this.entry.getColLong(col_hitcount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Collection<Integer> positions() {
|
|
|
|
|
return new ArrayList<Integer>(0);
|
|
|
|
|
}
|
|
|
|
@ -253,38 +258,45 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
|
|
|
|
|
public char getType() {
|
|
|
|
|
return (char) this.entry.getColByte(col_doctype);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int urllength() {
|
|
|
|
|
return (int) this.entry.getColLong(col_urlLength);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int urlcomps() {
|
|
|
|
|
return (int) this.entry.getColLong(col_urlComps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Bitfield flags() {
|
|
|
|
|
return new Bitfield(this.entry.getColBytes(col_flags, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
|
|
|
|
return toPropertyForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isOlder(final Reference other) {
|
|
|
|
|
if (other == null) return false;
|
|
|
|
|
if (this.lastModified() < other.lastModified()) return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int hashCache = Integer.MIN_VALUE; // if this is used in a compare method many times, a cache is useful
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int hashCode() {
|
|
|
|
|
return ByteArray.hashCode(this.urlhash());
|
|
|
|
|
if (this.hashCache == Integer.MIN_VALUE) {
|
|
|
|
|
this.hashCache = ByteArray.hashCode(this.urlhash());
|
|
|
|
|
}
|
|
|
|
|
return this.hashCache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void join(Reference oe) {
|
|
|
|
|
throw new UnsupportedOperationException("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|