<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi Gerd,</div><div class=""><br class=""></div><div class="">In Steve’s stack trace it shows RoadMap is being used by a LinkedHashMap in TableA. A linked hash map maintains an ordered list of nodes, which is the same in every JDK version. You can set a breakpoint in CompareTo and run the SimpleRouteTest and see that it’s being used. </div><div class=""><br class=""></div><div class="">The TableA addArc method is trying to only add unique arcs. They containsKey method at present will never return true, but it’s clear from the code that there are case where it should return true. My change results in a slight reduction of the NOD section, which seems to make sense. </div><div class=""><br class=""></div><div class="">The sole purpose of the Hash seems to be preventing multiple, duplicate arcs from being created on the same RouteNode. </div><div class=""><br class=""></div><div class="">In MapNode, RoadDef is constructed with the osm id of the way, but when constructed from the NETFileReader, the id is the record number, which will be unique. </div><div class=""><br class=""></div><div class="">If every RoadDef should be unique, then one should not implement equals/hashCode/compareable, and instead use the default implementations from Object. However, one would then need to remove the LinkedHashMap from TableA and replace it with something like Array. </div><div class=""><br class=""></div><div class="">Brian</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">When RoadDefs are created in NETFileReader, a unique id is generated for each RoadDef. <span class="Apple-tab-span" style="white-space:pre">        </span></div><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 6, 2014, at 3:34 AM, Gerd Petermann <<a href="mailto:gpetermann_muenchen@hotmail.com" class="">gpetermann_muenchen@hotmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Hi Brian,<br class=""><br class="">thanks for the patch. If I got it right, the compareTo() methid is obsolete<br class="">as we do no longer sort RoadDef instances anywhere. So,<br class="">it would be easier to remove the Comparable attribute from the class<br class="">public class RoadDef /*implements Comparable<RoadDef>*/ {<br class="">and remove the compareTo() method.<br class=""><br class="">You are right regarding the hashCode() method, but I think<br class="">we should not use the fields id + name to implement it.<br class="">A style may add the same OSM way as a routable line multiple times,<br class="">in that case these two fields are equal.<br class=""><br class="">A typical map has less than 100.000 RoadDef instances, so I see no problem<br class="">to add an int (or long) field like roadId which is filled with a unique value<br class="">and use that in hashCode().<br class="">What do you think?<br class=""><br class="">Gerd<br class=""><br class=""><div class="">From: <a href="mailto:brianegge@gmail.com" class="">brianegge@gmail.com</a><br class="">Date: Wed, 5 Nov 2014 22:28:38 -0500<br class="">To: <a href="mailto:mkgmap-dev@lists.mkgmap.org.uk" class="">mkgmap-dev@lists.mkgmap.org.uk</a><br class="">Subject: [mkgmap-dev] RoadDef patch<br class=""><br class=""><pre class="">I’m not sure what the concurrency issue is related to this class, but it seems to have some problems around equality. First, it’s being used in a HashMap, which means both equals and hashCode need to be implemented. Second, the compareTo was using an unimplemented hashCode, which results in random sorting and inability to find two identical objects. <br class=""> <br class="">I’m not sure I understand all the details of what RoadDef does, but I’ve fixed up the basic methods in the class to be consistent and added a test case around those methods. <br class=""> <br class=""></pre><br class="">Brian<br class="">_______________________________________________ mkgmap-dev mailing list<span class="Apple-converted-space"> </span><a href="mailto:mkgmap-dev@lists.mkgmap.org.uk" class="">mkgmap-dev@lists.mkgmap.org.uk</a><span class="Apple-converted-space"> </span><a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" class="">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a></div></div><span style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">mkgmap-dev mailing list</span><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:mkgmap-dev@lists.mkgmap.org.uk" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">mkgmap-dev@lists.mkgmap.org.uk</a><br style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev" style="font-family: Calibri; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</a></div></blockquote></div><br class=""></body></html>