Merge branch 'master' into engine-mode

This commit is contained in:
afischerdev 2023-05-21 11:14:00 +02:00 committed by GitHub
commit fcab1a31fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 389 additions and 507 deletions

View file

@ -24,7 +24,7 @@ public class OsmNogoPolygon extends OsmNodeNamed {
}
}
public final List<Point> points = new ArrayList<Point>();
public final List<Point> points = new ArrayList<>();
public final boolean isClosed;

View file

@ -53,14 +53,14 @@ public final class OsmTrack {
public Map<String, String> params;
public List<OsmNodeNamed> pois = new ArrayList<OsmNodeNamed>();
public List<OsmNodeNamed> pois = new ArrayList<>();
public static class OsmPathElementHolder {
public OsmPathElement node;
public OsmPathElementHolder nextHolder;
}
public List<OsmPathElement> nodes = new ArrayList<OsmPathElement>();
public List<OsmPathElement> nodes = new ArrayList<>();
private CompactLongMap<OsmPathElementHolder> nodesMap;
@ -82,7 +82,7 @@ public final class OsmTrack {
public void registerDetourForId(long id, OsmPathElement detour) {
if (detourMap == null) {
detourMap = new CompactLongMap<OsmPathElementHolder>();
detourMap = new CompactLongMap<>();
}
OsmPathElementHolder nh = new OsmPathElementHolder();
nh.node = detour;
@ -98,12 +98,12 @@ public final class OsmTrack {
}
public void copyDetours(OsmTrack source) {
detourMap = source.detourMap == null ? null : new FrozenLongMap<OsmPathElementHolder>(source.detourMap);
detourMap = source.detourMap == null ? null : new FrozenLongMap<>(source.detourMap);
}
public void addDetours(OsmTrack source) {
if (detourMap != null) {
CompactLongMap<OsmPathElementHolder> tmpDetourMap = new CompactLongMap<OsmPathElementHolder>();
CompactLongMap<OsmPathElementHolder> tmpDetourMap = new CompactLongMap<>();
List oldlist = ((FrozenLongMap) detourMap).getValueList();
long[] oldidlist = ((FrozenLongMap) detourMap).getKeyArray();
@ -124,7 +124,7 @@ public final class OsmTrack {
}
}
}
detourMap = new FrozenLongMap<OsmPathElementHolder>(tmpDetourMap);
detourMap = new FrozenLongMap<>(tmpDetourMap);
}
}
@ -132,7 +132,7 @@ public final class OsmTrack {
public void appendDetours(OsmTrack source) {
if (detourMap == null) {
detourMap = source.detourMap == null ? null : new CompactLongMap<OsmPathElementHolder>();
detourMap = source.detourMap == null ? null : new CompactLongMap<>();
}
if (source.detourMap != null) {
int pos = nodes.size() - source.nodes.size() + 1;
@ -160,7 +160,7 @@ public final class OsmTrack {
}
public void buildMap() {
nodesMap = new CompactLongMap<OsmPathElementHolder>();
nodesMap = new CompactLongMap<>();
for (OsmPathElement node : nodes) {
long id = node.getIdFromPos();
OsmPathElementHolder nh = new OsmPathElementHolder();
@ -175,11 +175,11 @@ public final class OsmTrack {
nodesMap.fastPut(id, nh);
}
}
nodesMap = new FrozenLongMap<OsmPathElementHolder>(nodesMap);
nodesMap = new FrozenLongMap<>(nodesMap);
}
private List<String> aggregateMessages() {
ArrayList<String> res = new ArrayList<String>();
ArrayList<String> res = new ArrayList<>();
MessageData current = null;
for (OsmPathElement n : nodes) {
if (n.message != null && n.message.wayKeyValues != null) {
@ -201,7 +201,7 @@ public final class OsmTrack {
}
private List<String> aggregateSpeedProfile() {
ArrayList<String> res = new ArrayList<String>();
ArrayList<String> res = new ArrayList<>();
int vmax = -1;
int vmaxe = -1;
int vmin = -1;
@ -1332,7 +1332,7 @@ public final class OsmTrack {
i = 0;
node = nodes.get(nodeNr);
List<VoiceHint> inputs = new ArrayList<VoiceHint>();
List<VoiceHint> inputs = new ArrayList<>();
while (node != null) {
if (node.origin != null) {
VoiceHint input = new VoiceHint();

View file

@ -274,7 +274,7 @@ public final class RoutingContext {
public void cleanNogoList(List<OsmNode> waypoints) {
nogopoints_all = nogopoints;
if (nogopoints == null) return;
List<OsmNodeNamed> nogos = new ArrayList<OsmNodeNamed>();
List<OsmNodeNamed> nogos = new ArrayList<>();
for (OsmNodeNamed nogo : nogopoints) {
boolean goodGuy = true;
for (OsmNode wp : waypoints) {
@ -386,7 +386,7 @@ public final class RoutingContext {
public void setWaypoint(OsmNodeNamed wp, OsmNodeNamed pendingEndpoint, boolean endpoint) {
keepnogopoints = nogopoints;
nogopoints = new ArrayList<OsmNodeNamed>();
nogopoints = new ArrayList<>();
nogopoints.add(wp);
if (keepnogopoints != null) nogopoints.addAll(keepnogopoints);
isEndpoint = endpoint;

View file

@ -31,7 +31,7 @@ public class RoutingEngine extends Thread {
public final static int BROUTER_ENGINEMODE_GETELEV = 2;
private NodesCache nodesCache;
private SortedHeap<OsmPath> openSet = new SortedHeap<OsmPath>();
private SortedHeap<OsmPath> openSet = new SortedHeap<>();
private boolean finished = false;
protected List<OsmNodeNamed> waypoints = null;
@ -179,7 +179,7 @@ public class RoutingEngine extends Thread {
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
OsmTrack[] lastTracks = new OsmTrack[nsections];
OsmTrack track = null;
ArrayList<String> messageList = new ArrayList<String>();
ArrayList<String> messageList = new ArrayList<>();
for (int i = 0; ; i++) {
track = findTrack(refTracks, lastTracks);
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
@ -433,7 +433,7 @@ public class RoutingEngine extends Thread {
try {
MatchedWaypoint seedPoint = new MatchedWaypoint();
seedPoint.waypoint = waypoints.get(0);
List<MatchedWaypoint> listOne = new ArrayList<MatchedWaypoint>();
List<MatchedWaypoint> listOne = new ArrayList<>();
listOne.add(seedPoint);
matchWaypointsToNodes(listOne);
@ -508,7 +508,7 @@ public class RoutingEngine extends Thread {
}
if (matchedWaypoints == null) { // could exist from the previous alternative level
matchedWaypoints = new ArrayList<MatchedWaypoint>();
matchedWaypoints = new ArrayList<>();
for (int i = 0; i < nUnmatched; i++) {
MatchedWaypoint mwp = new MatchedWaypoint();
mwp.waypoint = waypoints.get(i);
@ -1064,7 +1064,7 @@ public class RoutingEngine extends Thread {
private OsmTrack findTrack(String operationName, MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack costCuttingTrack, OsmTrack refTrack, boolean fastPartialRecalc) {
try {
List<OsmNode> wpts2 = new ArrayList<OsmNode>();
List<OsmNode> wpts2 = new ArrayList<>();
if (startWp != null) wpts2.add(startWp.waypoint);
if (endWp != null) wpts2.add(endWp.waypoint);
routingContext.cleanNogoList(wpts2);
@ -1157,7 +1157,7 @@ public class RoutingEngine extends Thread {
addToOpenset(startPath1);
addToOpenset(startPath2);
}
ArrayList<OsmPath> openBorderList = new ArrayList<OsmPath>(4096);
ArrayList<OsmPath> openBorderList = new ArrayList<>(4096);
boolean memoryPanicMode = false;
boolean needNonPanicProcessing = false;

View file

@ -17,7 +17,7 @@ public class SuspectInfo {
public int triggers;
public static void addSuspect(Map<Long, SuspectInfo> map, long id, int prio, int trigger) {
Long iD = Long.valueOf(id);
Long iD = id;
SuspectInfo info = map.get(iD);
if (info == null) {
info = new SuspectInfo();

View file

@ -56,7 +56,7 @@ public class VoiceHint {
return;
}
if (badWays == null) {
badWays = new ArrayList<MessageData>();
badWays = new ArrayList<>();
}
badWays.add(badWay);
}

View file

@ -12,7 +12,7 @@ import java.util.List;
public class VoiceHintList {
private String transportMode;
int turnInstructionMode;
List<VoiceHint> list = new ArrayList<VoiceHint>();
List<VoiceHint> list = new ArrayList<>();
public void setTransportMode(boolean isCar, boolean isBike) {
transportMode = isCar ? "car" : (isBike ? "bike" : "foot");

View file

@ -55,7 +55,7 @@ public final class VoiceHintProcessor {
* @return voice hints, in forward order
*/
public List<VoiceHint> process(List<VoiceHint> inputs) {
List<VoiceHint> results = new ArrayList<VoiceHint>();
List<VoiceHint> results = new ArrayList<>();
double distance = 0.;
float roundAboutTurnAngle = 0.f; // sums up angles in roundabout
@ -202,7 +202,7 @@ public final class VoiceHintProcessor {
// go through the hint list again in reverse order (=travel direction)
// and filter out non-significant hints and hints too close to its predecessor
List<VoiceHint> results2 = new ArrayList<VoiceHint>();
List<VoiceHint> results2 = new ArrayList<>();
int i = results.size();
while (i > 0) {
VoiceHint hint = results.get(--i);
@ -241,7 +241,7 @@ public final class VoiceHintProcessor {
}
public List<VoiceHint> postProcess(List<VoiceHint> inputs, double catchingRange, double minRange) {
List<VoiceHint> results = new ArrayList<VoiceHint>();
List<VoiceHint> results = new ArrayList<>();
double distance = 0;
VoiceHint inputLast = null;
ArrayList<VoiceHint> tmpList = new ArrayList<>();