X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Ffunction%2Fsrtm%2FSrtmTile.java;fp=src%2Ftim%2Fprune%2Ffunction%2Fsrtm%2FSrtmTile.java;h=058132c9470b9721f82b058f822d4ab602f99020;hp=301bbaf2ccb7849f1378a6f910999c188965a12a;hb=38a0c12649e9104d0d40ce93a932b9086011f8c8;hpb=8b20e3e027058cdf6ff52993ee5576193d08667a diff --git a/src/tim/prune/function/srtm/SrtmTile.java b/src/tim/prune/function/srtm/SrtmTile.java index 301bbaf..058132c 100644 --- a/src/tim/prune/function/srtm/SrtmTile.java +++ b/src/tim/prune/function/srtm/SrtmTile.java @@ -36,14 +36,25 @@ public class SrtmTile _longitude = inLongitude; } + @Override + public int hashCode() + { + return _latitude * 1000 + _longitude; + } + /** * Check for equality * @param inOther other tile object * @return true if both represent same tile */ - public boolean equals(SrtmTile inOther) + @Override + public boolean equals(Object inOther) { - return (_latitude == inOther._latitude) && (_longitude == inOther._longitude); + if (inOther == null || inOther.getClass() != getClass()) { + return false; + } + SrtmTile otherTile = (SrtmTile) inOther; + return (_latitude == otherTile._latitude) && (_longitude == otherTile._longitude); } /** @return latitude as int */