X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Ftim%2Fprune%2Ffunction%2Fsrtm%2FSrtmTile.java;h=058132c9470b9721f82b058f822d4ab602f99020;hb=HEAD;hp=301bbaf2ccb7849f1378a6f910999c188965a12a;hpb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;p=GpsPrune.git 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 */