@Test public void equalsTest() { Tile tile1 = new Tile(TILE_X, TILE_Y, ZOOM_LEVEL); Tile tile2 = new Tile(TILE_X, TILE_Y, ZOOM_LEVEL); Tile tile3 = new Tile(TILE_X, TILE_X, ZOOM_LEVEL); TestUtils.equalsTest(tile1, tile2); Assert.assertNotEquals(tile1, tile3); Assert.assertNotEquals(tile3, tile1); Assert.assertNotEquals(tile1, new Object()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tile)) { return false; } Tile other = (Tile) obj; if (this.tileX != other.tileX) { return false; } else if (this.tileY != other.tileY) { return false; } else if (this.zoomLevel != other.zoomLevel) { return false; } return true; }
Tile implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tile)) { return false; } Tile other = (Tile) obj; if (this.tileX != other.tileX) { return false; } else if (this.tileY != other.tileY) { return false; } else if (this.zoomLevel != other.zoomLevel) { return false; } return true; } }
Tile implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tile)) { return false; } Tile other = (Tile) obj; if (this.tileX != other.tileX) { return false; } else if (this.tileY != other.tileY) { return false; } else if (this.zoomLevel != other.zoomLevel) { return false; } return true; } Tile(long tileX, long tileY, byte zoomLevel); }
Tile implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tile)) { return false; } Tile other = (Tile) obj; if (this.tileX != other.tileX) { return false; } else if (this.tileY != other.tileY) { return false; } else if (this.zoomLevel != other.zoomLevel) { return false; } return true; } Tile(long tileX, long tileY, byte zoomLevel); @Override boolean equals(Object obj); long getPixelX(); long getPixelY(); @Override int hashCode(); @Override String toString(); }
Tile implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tile)) { return false; } Tile other = (Tile) obj; if (this.tileX != other.tileX) { return false; } else if (this.tileY != other.tileY) { return false; } else if (this.zoomLevel != other.zoomLevel) { return false; } return true; } Tile(long tileX, long tileY, byte zoomLevel); @Override boolean equals(Object obj); long getPixelX(); long getPixelY(); @Override int hashCode(); @Override String toString(); static final int TILE_SIZE; final long tileX; final long tileY; final byte zoomLevel; }