sclass HashedBWImage { BWImage image; long hash; long hash() { if (hash == 0) hash = hashBWImage(image); } equals HashedBWImage o { ret hash() == o.hash() && bwImagesIdentical(image, o.image); } public int hashCode() { ret (int) hash; } }