@Override public int hashCode() { return type + (7 * (facing + (31 * coords.hashCode()))); } }
@Override public int hashCode() { return facing + 7 * coords.hashCode(); }
@Override public int hashCode() { int result; long temp; result = coords.hashCode(); temp = Double.doubleToLongBits(fitness); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; }
public static void main(String[] args) { System.out.println("The maximum board height: " + Coords.MAX_BOARD_HEIGHT); //$NON-NLS-1$ System.out.println("The maximum board width: " + Coords.MAX_BOARD_WIDTH); //$NON-NLS-1$ for(int x = 1; x < 10; ++ x) { Coords coords = new Coords(x, 2); System.out.println(String.format(OUTFORMAT, coords, coords.hashCode())); } for(int y = 10; y < 19; ++ y) { Coords coords = new Coords(1, y); System.out.println(String.format(OUTFORMAT, coords, coords.hashCode())); } Coords neg_coords = new Coords(-11, -22); System.out.println(String.format(OUTFORMAT, neg_coords, neg_coords.hashCode())); neg_coords = new Coords(42, -68); System.out.println(String.format(OUTFORMAT, neg_coords, neg_coords.hashCode())); neg_coords = new Coords(-668, 42); System.out.println(String.format(OUTFORMAT, neg_coords, neg_coords.hashCode())); }
@Override public int hashCode() { return (getCoords().hashCode() * 6) + getFacing(); }
id = coords.hashCode();
/** * Returns a list of orthographic images to be tiled above the hex. As noted * above, all matches must be 1.0, and if such a match is achieved, all terrain * elements from the tileset hex are removed from the hex. Thus you want to pass * a copy of the original to this function. */ private List<Image> orthoFor(IHex hex, Component comp) { ArrayList<Image> matches = new ArrayList<Image>(); // find orthographic image matches for (HexEntry entry : orthos) { if (orthoMatch(hex, entry.getHex()) >= 1.0) { Image img = entry.getImage(comp, hex.getCoords().hashCode()); if (img != null) { matches.add(img); } else { matches.add(ImageUtil.createAcceleratedImage(HEX_W, HEX_H)); } // remove involved terrain from consideration for (int terr : entry.getHex().getTerrainTypes()) { if (entry.getHex().containsTerrain(terr)) { hex.removeTerrain(terr); } } } } return matches; }
/** * Returns a list of images to be superimposed on the hex. As noted above, all * matches must be 1.0, and if such a match is achieved, all terrain elements * from the tileset hex are removed from the hex. Thus you want to pass a copy * of the original to this function. */ private List<Image> supersFor(IHex hex, Component comp) { ArrayList<Image> matches = new ArrayList<Image>(); // find superimposed image matches for (HexEntry entry : supers) { if (superMatch(hex, entry.getHex()) >= 1.0) { Image img = entry.getImage(comp, hex.getCoords().hashCode()); if (img != null) { matches.add(img); } else { matches.add(ImageUtil.createAcceleratedImage(HEX_W, HEX_H)); } // remove involved terrain from consideration for (int terr : entry.getHex().getTerrainTypes()) { if (entry.getHex().containsTerrain(terr)) { hex.removeTerrain(terr); } } } } return matches; }
Image img = bestMatch.getImage(comp, hex.getCoords().hashCode()); if (img == null) { img = ImageUtil.createAcceleratedImage(HEX_W, HEX_H);