@ -9,7 +9,7 @@
// $LastChangedBy$
// $LastChangedBy$
//
//
// LICENSE
// LICENSE
//
//
// This program is free software; you can redistribute it and/or modify
// 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
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// 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
* object for termination of concurrent blocking queue processing
* /
* /
public static final ImageReferenceRow poison = new ImageReferenceRow ( ( Row . Entry ) null ) ;
public static final ImageReferenceRow poison = new ImageReferenceRow ( ( Row . Entry ) null ) ;
public static final Row urlEntryRow = new Row ( new Column [ ] {
public static final Row urlEntryRow = 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 ( "f" , Column . celltype_cardinal , Column . encoder_b256 , 4 , "created" ) ,
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 , "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 , "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 , "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 ( "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 , "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
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
Base64Order . enhancedCoder
) ;
) ;
// available chars: b,e,j,q
// available chars: b,e,j,q
// static properties
// static properties
private static final int col_urlhash = 0 ; // h 12 the url hash b64-encoded
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
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_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_reserve1 = 18 ; // i 1 reserve1
private static final int col_reserve2 = 19 ; // k 1 reserve2
private static final int col_reserve2 = 19 ; // k 1 reserve2
// ideas for the classification bytes
// ideas for the classification bytes
// 0 : content-type (person-portrait, persons-group, landscape, buildings, technical, artistical)
// 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)
// 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)
// 2 : content-category (a classification that is taken from the text environment by text analysis)
// 3 :
// 3 :
private final Row . Entry entry ;
private final Row . Entry entry ;
public ImageReferenceRow ( final byte [ ] urlHash ,
public ImageReferenceRow ( final byte [ ] urlHash ,
final int urlLength , // byte-length of complete URL
final int urlLength , // byte-length of complete URL
final int urlComps , // number of path components
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_reserve1 , 0 ) ;
this . entry . setCol ( col_reserve2 , 0 ) ;
this . entry . setCol ( col_reserve2 , 0 ) ;
}
}
public ImageReferenceRow ( final byte [ ] urlHash ,
public ImageReferenceRow ( final byte [ ] urlHash ,
final int urlLength , // byte-length of complete URL
final int urlLength , // byte-length of complete URL
final int urlComps , // number of path components
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_reserve1 , 0 ) ;
this . entry . setCol ( col_reserve2 , 0 ) ;
this . entry . setCol ( col_reserve2 , 0 ) ;
}
}
public ImageReferenceRow ( final String urlHash , final String code ) {
public ImageReferenceRow ( final String urlHash , final String code ) {
// the code is the external form of the row minus the leading urlHash entry
// the code is the external form of the row minus the leading urlHash entry
this . entry = urlEntryRow . newEntry ( UTF8 . getBytes ( ( urlHash + code ) ) ) ;
this . entry = urlEntryRow . newEntry ( UTF8 . getBytes ( ( urlHash + code ) ) ) ;
}
}
public ImageReferenceRow ( final String external ) {
public ImageReferenceRow ( final String external ) {
this . entry = urlEntryRow . newEntry ( external , true ) ;
this . entry = urlEntryRow . newEntry ( external , true ) ;
}
}
public ImageReferenceRow ( final byte [ ] row ) {
public ImageReferenceRow ( final byte [ ] row ) {
this . entry = urlEntryRow . newEntry ( row ) ;
this . entry = urlEntryRow . newEntry ( row ) ;
}
}
public ImageReferenceRow ( final byte [ ] row , final int offset , final boolean clone ) {
public ImageReferenceRow ( final byte [ ] row , final int offset , final boolean clone ) {
this . entry = urlEntryRow . newEntry ( row , offset , clone ) ;
this . entry = urlEntryRow . newEntry ( row , offset , clone ) ;
}
}
public ImageReferenceRow ( final Row . Entry rentry ) {
public ImageReferenceRow ( final Row . Entry rentry ) {
// FIXME: see if cloning is necessary
// FIXME: see if cloning is necessary
this . entry = rentry ;
this . entry = rentry ;
}
}
@Override
@Override
public ImageReferenceRow clone ( ) {
public ImageReferenceRow clone ( ) {
final byte [ ] b = new byte [ urlEntryRow . objectsize ] ;
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 ) ;
return new ImageReferenceRow ( b ) ;
}
}
@Override
public String toPropertyForm ( ) {
public String toPropertyForm ( ) {
return entry. toPropertyForm ( '=' , true , true , false , false ) ;
return this . entry. toPropertyForm ( '=' , true , true , false , false ) ;
}
}
@Override
public Entry toKelondroEntry ( ) {
public Entry toKelondroEntry ( ) {
return this . entry ;
return this . entry ;
}
}
@Override
public byte [ ] urlhash ( ) {
public byte [ ] urlhash ( ) {
return this . entry . getColBytes ( col_urlhash , true ) ;
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
return ( int ) this . entry . getColLong ( col_lastModified ) ; // this is the time in MicoDateDays format
}
}
@Override
public long lastModified ( ) {
public long lastModified ( ) {
return MicroDate . reverseMicroDateDays ( ( int ) this . entry . getColLong ( col_lastModified ) ) ;
return MicroDate . reverseMicroDateDays ( ( int ) this . entry . getColLong ( col_lastModified ) ) ;
}
}
public long freshUntil ( ) {
public long freshUntil ( ) {
return MicroDate . reverseMicroDateDays ( ( int ) this . entry . getColLong ( col_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 ) ;
return ( int ) this . entry . getColLong ( col_hitcount ) ;
}
}
@Override
public Collection < Integer > positions ( ) {
public Collection < Integer > positions ( ) {
return new ArrayList < Integer > ( 0 ) ;
return new ArrayList < Integer > ( 0 ) ;
}
}
@ -253,38 +258,45 @@ public final class ImageReferenceRow extends AbstractReference implements /*Imag
public char getType ( ) {
public char getType ( ) {
return ( char ) this . entry . getColByte ( col_doctype ) ;
return ( char ) this . entry . getColByte ( col_doctype ) ;
}
}
public int urllength ( ) {
public int urllength ( ) {
return ( int ) this . entry . getColLong ( col_urlLength ) ;
return ( int ) this . entry . getColLong ( col_urlLength ) ;
}
}
public int urlcomps ( ) {
public int urlcomps ( ) {
return ( int ) this . entry . getColLong ( col_urlComps ) ;
return ( int ) this . entry . getColLong ( col_urlComps ) ;
}
}
public Bitfield flags ( ) {
public Bitfield flags ( ) {
return new Bitfield ( this . entry . getColBytes ( col_flags , true ) ) ;
return new Bitfield ( this . entry . getColBytes ( col_flags , true ) ) ;
}
}
@Override
@Override
public String toString ( ) {
public String toString ( ) {
return toPropertyForm ( ) ;
return toPropertyForm ( ) ;
}
}
@Override
public boolean isOlder ( final Reference other ) {
public boolean isOlder ( final Reference other ) {
if ( other = = null ) return false ;
if ( other = = null ) return false ;
if ( this . lastModified ( ) < other . lastModified ( ) ) return true ;
if ( this . lastModified ( ) < other . lastModified ( ) ) return true ;
return false ;
return false ;
}
}
private int hashCache = Integer . MIN_VALUE ; // if this is used in a compare method many times, a cache is useful
@Override
@Override
public int hashCode ( ) {
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 ) {
public void join ( Reference oe ) {
throw new UnsupportedOperationException ( "" ) ;
throw new UnsupportedOperationException ( "" ) ;
}
}
}
}