Warning: session_start(): open(/var/lib/php/sessions/sess_dh3ipibd9696c09cdnimo7icg2, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass HashedImage2B is IBinaryImage, MakesImage2B {
Image2B image; // don't change this afterwards...
long hash;
bool hashComputed;
*(BufferedImage image) { this(bwImage(image)); }
*(Image2B *image) { assertNotNull(image); }
long hash() {
while (!hashComputed) {
synchronized {
if (!hashComputed) {
hash = hashImage2B(image);
set hashComputed;
}
}
}
ret hash;
}
equals HashedImage2B o {
if (hash() != o.hash()) false;
if (!bwImagesIdentical(image, o.image)) {
reportHashCollision(this, o);
false;
}
true;
}
public int hashCode() { ret (int) hash(); }
public Image2B get aka getImage2B() { ret image; }
public int getWidth() { ret image.getWidth(); }
public int getHeight() { ret image.getHeight(); }
public BufferedImage getBufferedImage() { ret image.getBufferedImage(); }
// check that Image2B wasn't modified
void verify {
if (hash != 0)
assertEquals(hash, hashImage2B(image));
}
S classNameForPrinting() { ret cnfp(this, selfType.class, "HashedImage2B"; }
toString { ret formatFunctionCall(classNameForPrinting(),
w() + "*" + h() + "px", "hash " + longToHex(hash())); }
// implement IBinaryImage
public bool getBoolPixel(int x, int y) { ret image.getBoolPixel(x, y); }
}