Simplify tags
This commit is contained in:
parent
918495b2ad
commit
5b9e711e2a
2 changed files with 10 additions and 9 deletions
|
@ -42,6 +42,7 @@ public class BinaryMapRouteReaderAdapter {
|
|||
String condition = "";
|
||||
OpeningHoursParser.OpeningHours hours = null;
|
||||
String value;
|
||||
int routeType;
|
||||
}
|
||||
|
||||
public static class RouteTypeRule {
|
||||
|
@ -117,17 +118,17 @@ public class BinaryMapRouteReaderAdapter {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public String conditionalValue(long time) {
|
||||
public int conditionalValue(long time) {
|
||||
if (conditional()) {
|
||||
Calendar i = Calendar.getInstance();
|
||||
i.setTimeInMillis(time);
|
||||
for (RouteTypeCondition c : conditions) {
|
||||
if (c.hours != null && c.hours.isOpenedForTime(i)) {
|
||||
return c.value;
|
||||
return c.routeType;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float maxSpeed(){
|
||||
|
@ -293,7 +294,7 @@ public class BinaryMapRouteReaderAdapter {
|
|||
String tag = rtr.getNonConditionalTag();
|
||||
for(RouteTypeCondition c : rtr.conditions ) {
|
||||
if(tag != null && c.value != null) {
|
||||
findOrCreateRouteType(tag, c.value);
|
||||
c.routeType = findOrCreateRouteType(tag, c.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -492,14 +492,14 @@ public class RouteDataObject {
|
|||
for (int i = 0; i < sz; i++) {
|
||||
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
|
||||
if (r != null && r.conditional()) {
|
||||
String vl = r.conditionalValue(conditionalTime);
|
||||
if(vl != null) {
|
||||
String nonCondTag = r.getNonConditionalTag();
|
||||
int tp = region.findOrCreateRouteType(nonCondTag, vl);
|
||||
int vl = r.conditionalValue(conditionalTime);
|
||||
if(vl != 0) {
|
||||
RouteTypeRule rtr = region.quickGetEncodingRule(vl);
|
||||
String nonCondTag = rtr.getTag();
|
||||
for(int ks = 0; ks < types.length; ks++) {
|
||||
RouteTypeRule toReplace = region.quickGetEncodingRule(types[ks]);
|
||||
if(toReplace != null && toReplace.getTag().equals(nonCondTag)) {
|
||||
types[ks] = tp;
|
||||
types[ks] = vl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue