Fix issue with compare

This commit is contained in:
Victor Shcherb 2017-09-02 22:24:49 +02:00
parent 00c0a62329
commit 0b3a64d988
2 changed files with 22 additions and 4 deletions

View file

@ -74,8 +74,8 @@ public class BinaryInspector {
in.inspector(new String[] {
// "-vpoi",
// "-vmap", "-vmapobjects", // "-vmapcoordinates",
"-vrouting",
"-vmap", "-vmapobjects", // "-vmapcoordinates",
// "-vrouting",
// "-vtransport",
// "-vaddress", "-vcities","-vstreetgroups",
// "-vstreets", "-vbuildings", "-vintersections",

View file

@ -200,7 +200,6 @@ public class BinaryMapDataObject {
if(this.objectType == thatObj.objectType
&& this.id == thatObj.id
&& this.area == thatObj.area
&& Arrays.equals(this.polygonInnerCoordinates, thatObj.polygonInnerCoordinates)
&& Arrays.equals(this.coordinates, thatObj.coordinates) ) {
if(mapIndex == null) {
throw new IllegalStateException("Illegal binary object: " + id);
@ -208,7 +207,26 @@ public class BinaryMapDataObject {
if(thatObj.mapIndex == null) {
throw new IllegalStateException("Illegal binary object: " + thatObj.id);
}
boolean equals = true;
if(equals) {
if(polygonInnerCoordinates == null || thatObj.polygonInnerCoordinates == null) {
equals = polygonInnerCoordinates == thatObj.polygonInnerCoordinates;
} else if(polygonInnerCoordinates.length != thatObj.polygonInnerCoordinates.length){
equals = false;
} else {
for(int i = 0; i < polygonInnerCoordinates.length && equals; i++) {
if(polygonInnerCoordinates[i] == null || thatObj.polygonInnerCoordinates[i] == null) {
equals = polygonInnerCoordinates[i] == thatObj.polygonInnerCoordinates[i];
} else if(polygonInnerCoordinates[i].length != thatObj.polygonInnerCoordinates[i].length){
equals = false;
} else {
equals = Arrays.equals(polygonInnerCoordinates[i], thatObj.polygonInnerCoordinates[i]);
}
}
}
}
if(equals) {
if(types == null || thatObj.types == null) {
equals = types == thatObj.types;
@ -218,7 +236,7 @@ public class BinaryMapDataObject {
for(int i = 0; i < types.length && equals; i++) {
TagValuePair o = mapIndex.decodeType(types[i]);
TagValuePair s = thatObj.mapIndex.decodeType(thatObj.types[i]);
equals = o.equals(s);
equals = o.equals(s) && equals;
}
}
}