small correction of logic

This commit is contained in:
sonora 2016-08-19 19:33:36 +02:00
parent d3d61d96b7
commit fb0bdbcb6c

View file

@ -102,7 +102,8 @@ public class RouteDataObject {
if (names != null) { if (names != null) {
int[] kt = names.keys(); int[] kt = names.keys();
String refTag = (direction == true) ? "destination:ref:forward" : "destination:ref:backward"; String refTag = (direction == true) ? "destination:ref:forward" : "destination:ref:backward";
String ref = null; String refTagDefault = "destination:ref";
String refDefault = null;
for(int i = 0 ; i < kt.length; i++) { for(int i = 0 ; i < kt.length; i++) {
int k = kt[i]; int k = kt[i];
@ -110,11 +111,13 @@ public class RouteDataObject {
if(refTag.equals(region.routeEncodingRules.get(k).getTag())) { if(refTag.equals(region.routeEncodingRules.get(k).getTag())) {
return names.get(k); return names.get(k);
} }
if(refTagDefault.equals(region.routeEncodingRules.get(k).getTag())) {
refDefault = names.get(k);
} }
} }
ref = names.get(region.destinationRefTypeRule); }
if (ref != null) { if (refDeafult != null) {
return ref; return refDefault;
} }
return names.get(region.refTypeRule); return names.get(region.refTypeRule);
} }
@ -128,6 +131,8 @@ public class RouteDataObject {
if(!Algorithms.isEmpty(lang)) { if(!Algorithms.isEmpty(lang)) {
destinationTag = "destination:" + lang; destinationTag = "destination:" + lang;
} }
String destinationTagDefault = "destination";
String destinationDefault = null;
for(int i = 0 ; i < kt.length; i++) { for(int i = 0 ; i < kt.length; i++) {
int k = kt[i]; int k = kt[i];
@ -135,9 +140,12 @@ public class RouteDataObject {
if(destinationTag.equals(region.routeEncodingRules.get(k).getTag())) { if(destinationTag.equals(region.routeEncodingRules.get(k).getTag())) {
return names.get(k); return names.get(k);
} }
if(destinationTagDefault.equals(region.routeEncodingRules.get(k).getTag())) {
destinationDefault = names.get(k);
} }
} }
return names.get(region.destinationTypeRule); }
return destinationDefault;
} }
return null; return null;
} }