From c820fa3033f2e5bb5496633ff890aaf88aa92745 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 24 Jun 2020 11:16:19 +0200 Subject: [PATCH] Fix routing --- .../binary/BinaryMapRouteReaderAdapter.java | 34 +++++++++---------- .../java/net/osmand/router/GeneralRouter.java | 28 +++++++++------ 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 59afdedb9a..64d6f7cdf7 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -1,9 +1,25 @@ package net.osmand.binary; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; + import com.google.protobuf.CodedInputStream; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.WireFormat; +import gnu.trove.iterator.TLongObjectIterator; +import gnu.trove.list.array.TIntArrayList; +import gnu.trove.list.array.TLongArrayList; +import gnu.trove.map.hash.TIntObjectHashMap; +import gnu.trove.map.hash.TLongObjectHashMap; import net.osmand.PlatformUtil; import net.osmand.ResultMatcher; import net.osmand.binary.BinaryMapIndexReader.SearchRequest; @@ -18,24 +34,6 @@ import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; import net.osmand.util.OpeningHoursParser; -import org.apache.commons.logging.Log; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Comparator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeSet; - -import gnu.trove.iterator.TLongObjectIterator; -import gnu.trove.list.array.TIntArrayList; -import gnu.trove.list.array.TLongArrayList; -import gnu.trove.map.hash.TIntObjectHashMap; -import gnu.trove.map.hash.TLongObjectHashMap; - public class BinaryMapRouteReaderAdapter { protected static final Log LOG = PlatformUtil.getLog(BinaryMapRouteReaderAdapter.class); private static final int SHIFT_COORDINATES = 4; diff --git a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java index da56471f6b..be42f432d6 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java @@ -532,25 +532,33 @@ public class GeneralRouter implements VehicleRouter { } class IntHolder { - private final int[] array; + private final int[] array; private final boolean extra; IntHolder(int[] ts, boolean extra) { array = ts; this.extra = extra; } - @Override public int hashCode() { return Arrays.hashCode(array) + (extra ? 1 : 0) ; } - @Override public boolean equals(Object other) { - if (array == other) { return true; } - if (! (other instanceof IntHolder) ) { - return false; - } + + @Override + public int hashCode() { + return Arrays.hashCode(array) + (extra ? 1 : 0); + } + + @Override + public boolean equals(Object other) { + if (array == other) { + return true; + } + if (!(other instanceof IntHolder)) { + return false; + } if (((IntHolder) other).extra != this.extra) { return false; } - //noinspection unchecked - return Arrays.equals(array, ((IntHolder) other).array); - } + // noinspection unchecked + return Arrays.equals(array, ((IntHolder) other).array); + } } private Float getCache(RouteDataObjectAttribute attr, RouteDataObject road) {