sclass HashedBWImage { BWImage image; long hash; long hash() { if (hash == 0) { hash = hashBWImage(image); if (hash == 0) reportHashCollision(this); } ret hash; } equals HashedBWImage o { if (hash() != o.hash()) false; if (!bwImagesIdentical(image, o.image)) { reportHashCollision(this, o); false; } true; } public int hashCode() { ret (int) hash; } void hashCollision() {} }