@Test public void equalsTest() { Tile tile1 = new Tile(1, 2, (byte) 3, TILE_SIZE); Tile tile2 = new Tile(1, 2, (byte) 3, TILE_SIZE); Tile tile3 = new Tile(1, 1, (byte) 3, TILE_SIZE); Tile tile4 = new Tile(2, 2, (byte) 3, TILE_SIZE); Tile tile5 = new Tile(1, 2, (byte) 4, TILE_SIZE); TestUtils.equalsTest(tile1, tile2); TestUtils.notEqualsTest(tile1, tile3); TestUtils.notEqualsTest(tile1, tile4); TestUtils.notEqualsTest(tile1, tile5); TestUtils.notEqualsTest(tile1, new Object()); TestUtils.notEqualsTest(tile1, null); }
@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; } else if (this.tileSize != other.tileSize) { 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; } else if (this.tileSize != other.tileSize) { 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; } else if (this.tileSize != other.tileSize) { return false; } return true; } Tile(int tileX, int tileY, byte zoomLevel, int tileSize); }
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; } else if (this.tileSize != other.tileSize) { return false; } return true; } Tile(int tileX, int tileY, byte zoomLevel, int tileSize); static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight); static Rectangle getBoundaryAbsolute(Tile upperLeft, Tile lowerRight); static boolean tileAreasOverlap(Tile upperLeft, Tile lowerRight, Tile upperLeftOther, Tile lowerRightOther); static int getMaxTileNumber(byte zoomLevel); @Override boolean equals(Object obj); BoundingBox getBoundingBox(); Set<Tile> getNeighbours(); Rectangle getBoundaryAbsolute(); Rectangle getBoundaryRelative(); Point getOrigin(); Tile getLeft(); Tile getRight(); Tile getAbove(); Tile getBelow(); Tile getAboveLeft(); Tile getAboveRight(); Tile getBelowLeft(); Tile getBelowRight(); Tile getParent(); int getShiftX(Tile otherTile); int getShiftY(Tile otherTile); @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; } else if (this.tileSize != other.tileSize) { return false; } return true; } Tile(int tileX, int tileY, byte zoomLevel, int tileSize); static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight); static Rectangle getBoundaryAbsolute(Tile upperLeft, Tile lowerRight); static boolean tileAreasOverlap(Tile upperLeft, Tile lowerRight, Tile upperLeftOther, Tile lowerRightOther); static int getMaxTileNumber(byte zoomLevel); @Override boolean equals(Object obj); BoundingBox getBoundingBox(); Set<Tile> getNeighbours(); Rectangle getBoundaryAbsolute(); Rectangle getBoundaryRelative(); Point getOrigin(); Tile getLeft(); Tile getRight(); Tile getAbove(); Tile getBelow(); Tile getAboveLeft(); Tile getAboveRight(); Tile getBelowLeft(); Tile getBelowRight(); Tile getParent(); int getShiftX(Tile otherTile); int getShiftY(Tile otherTile); @Override int hashCode(); @Override String toString(); final long mapSize; final int tileSize; final int tileX; final int tileY; final byte zoomLevel; }