return !isEmpty(result) ? result : null;
}
@SuppressWarnings("unchecked")
private BaseRoute parseRoute(List<String> coordinates, NavigationPosition before, NavigationPosition after) {
BaseRoute route = new NavigatingPoiWarnerFormat().createRoute(Waypoints, null, new ArrayList<NavigationPosition>());
// count backwards as inserting at position 0
CompactCalendar time = after.getTime();
int positionInsertionCount = coordinates.size() / 5;
for (int i = coordinates.size() - 1; i > 0; i -= 5) {
String instructions = trim(coordinates.get(i));
Double seconds = parseSeconds(coordinates.get(i - 1));
// Double meters = parseDouble(coordinates.get(i - 2));
Double longitude = parseDouble(coordinates.get(i - 3));
Double latitude = parseDouble(coordinates.get(i - 4));
if (seconds != null && time != null) {
Calendar calendar = time.getCalendar();
calendar.add(SECOND, -seconds.intValue());
time = fromCalendar(calendar);
}
int positionNumber = positionsModel.getRowCount() + (positionInsertionCount - route.getPositionCount()) - 1;
String description = instructions != null ? instructions : mapViewCallback.createDescription(positionNumber, null);
BaseNavigationPosition position = route.createPosition(longitude, latitude, null, null, seconds != null ? time : null, description);
if (!isDuplicate(before, position) && !isDuplicate(after, position)) {
route.add(0, position);
}
}
return route;
}