mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 21:33:59 +00:00
[android] Fix FeatureId check in MapObject
This commit fix the way `FeatureId` is checked in `MapObject.equals()`. Instead of checking if `mFeatureId` and `other.getFeatureId()` are not `FeatureId.EMPTY`, it now uses a new `isRealId()` method in `FeatureId` to determine if the IDs are valid for comparison. The `isRealId()` method checks if the `mMwmName` is not empty, `mMwmVersion` is greater than 0, and `mFeatureIndex` is greater than 0. This provides a more robust check for valid feature IDs. Signed-off-by: Mihail Mitrofanov <mitrofanov@bitrix.ru>
This commit is contained in:
committed by
Konstantin Pastbin
parent
964065a7b6
commit
2a2eb9dfc9
@@ -93,6 +93,12 @@ public class FeatureId implements Parcelable
|
|||||||
return mFeatureIndex;
|
return mFeatureIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRealId() {
|
||||||
|
return !TextUtils.isEmpty(mMwmName) &&
|
||||||
|
mMwmVersion >= 0 &&
|
||||||
|
mFeatureIndex > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o)
|
public boolean equals(Object o)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ public class MapObject implements PlacePageData
|
|||||||
if (getClass() != other.getClass())
|
if (getClass() != other.getClass())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mFeatureId != FeatureId.EMPTY && other.getFeatureId() != FeatureId.EMPTY)
|
if (mFeatureId.isRealId() && other.getFeatureId().isRealId())
|
||||||
return mFeatureId.equals(other.getFeatureId());
|
return mFeatureId.equals(other.getFeatureId());
|
||||||
|
|
||||||
return Double.doubleToLongBits(mLon) == Double.doubleToLongBits(other.mLon) &&
|
return Double.doubleToLongBits(mLon) == Double.doubleToLongBits(other.mLon) &&
|
||||||
|
|||||||
Reference in New Issue
Block a user