sclass HashedBWImage is MakesBufferedImage { BWImage image; // don't change this afterwards... long hash; *(BWImage *image) { assertNotNull(image); } 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; } BWImage get() { ret image; } public int getWidth() { ret image.getWidth(); } public int getHeight() { ret image.getHeight(); } public BufferedImage getImage() { ret image.getBufferedImage(); } }