Enable PMD rule UseDiamondOperator and fix violations
This commit is contained in:
parent
2e1722150c
commit
7a6d3bd9d9
45 changed files with 105 additions and 105 deletions
|
@ -287,7 +287,7 @@ public final class MicroCache2 extends MicroCache {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int encodeMicroCache(byte[] buffer) {
|
public int encodeMicroCache(byte[] buffer) {
|
||||||
HashMap<Long, Integer> idMap = new HashMap<Long, Integer>();
|
HashMap<Long, Integer> idMap = new HashMap<>();
|
||||||
for (int n = 0; n < size; n++) { // loop over nodes
|
for (int n = 0; n < size; n++) { // loop over nodes
|
||||||
idMap.put(Long.valueOf(expandId(faid[n])), Integer.valueOf(n));
|
idMap.put(Long.valueOf(expandId(faid[n])), Integer.valueOf(n));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public final class StatCoderContext extends BitCoderContext {
|
||||||
public void assignBits(String name) {
|
public void assignBits(String name) {
|
||||||
long bitpos = getWritingBitPosition();
|
long bitpos = getWritingBitPosition();
|
||||||
if (statsPerName == null) {
|
if (statsPerName == null) {
|
||||||
statsPerName = new TreeMap<String, long[]>();
|
statsPerName = new TreeMap<>();
|
||||||
}
|
}
|
||||||
long[] stats = statsPerName.get(name);
|
long[] stats = statsPerName.get(name);
|
||||||
if (stats == null) {
|
if (stats == null) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ public final class TagValueCoder {
|
||||||
TagValueSet dummy = new TagValueSet(nextTagValueSetId++);
|
TagValueSet dummy = new TagValueSet(nextTagValueSetId++);
|
||||||
identityMap.put(dummy, dummy);
|
identityMap.put(dummy, dummy);
|
||||||
}
|
}
|
||||||
PriorityQueue<TagValueSet> queue = new PriorityQueue<TagValueSet>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
|
PriorityQueue<TagValueSet> queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
|
||||||
queue.addAll(identityMap.values());
|
queue.addAll(identityMap.values());
|
||||||
while (queue.size() > 1) {
|
while (queue.size() > 1) {
|
||||||
TagValueSet node = new TagValueSet(nextTagValueSetId++);
|
TagValueSet node = new TagValueSet(nextTagValueSetId++);
|
||||||
|
@ -79,7 +79,7 @@ public final class TagValueCoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagValueCoder() {
|
public TagValueCoder() {
|
||||||
identityMap = new HashMap<TagValueSet, TagValueSet>();
|
identityMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object decodeTree(BitCoderContext bc, DataBuffers buffers, TagValueValidator validator) {
|
private Object decodeTree(BitCoderContext bc, DataBuffers buffers, TagValueValidator validator) {
|
||||||
|
|
|
@ -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;
|
public final boolean isClosed;
|
||||||
|
|
||||||
|
|
|
@ -53,14 +53,14 @@ public final class OsmTrack {
|
||||||
|
|
||||||
public Map<String, String> params;
|
public Map<String, String> params;
|
||||||
|
|
||||||
public List<OsmNodeNamed> pois = new ArrayList<OsmNodeNamed>();
|
public List<OsmNodeNamed> pois = new ArrayList<>();
|
||||||
|
|
||||||
public static class OsmPathElementHolder {
|
public static class OsmPathElementHolder {
|
||||||
public OsmPathElement node;
|
public OsmPathElement node;
|
||||||
public OsmPathElementHolder nextHolder;
|
public OsmPathElementHolder nextHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OsmPathElement> nodes = new ArrayList<OsmPathElement>();
|
public List<OsmPathElement> nodes = new ArrayList<>();
|
||||||
|
|
||||||
private CompactLongMap<OsmPathElementHolder> nodesMap;
|
private CompactLongMap<OsmPathElementHolder> nodesMap;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public final class OsmTrack {
|
||||||
|
|
||||||
public void registerDetourForId(long id, OsmPathElement detour) {
|
public void registerDetourForId(long id, OsmPathElement detour) {
|
||||||
if (detourMap == null) {
|
if (detourMap == null) {
|
||||||
detourMap = new CompactLongMap<OsmPathElementHolder>();
|
detourMap = new CompactLongMap<>();
|
||||||
}
|
}
|
||||||
OsmPathElementHolder nh = new OsmPathElementHolder();
|
OsmPathElementHolder nh = new OsmPathElementHolder();
|
||||||
nh.node = detour;
|
nh.node = detour;
|
||||||
|
@ -98,12 +98,12 @@ public final class OsmTrack {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyDetours(OsmTrack source) {
|
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) {
|
public void addDetours(OsmTrack source) {
|
||||||
if (detourMap != null) {
|
if (detourMap != null) {
|
||||||
CompactLongMap<OsmPathElementHolder> tmpDetourMap = new CompactLongMap<OsmPathElementHolder>();
|
CompactLongMap<OsmPathElementHolder> tmpDetourMap = new CompactLongMap<>();
|
||||||
|
|
||||||
List oldlist = ((FrozenLongMap) detourMap).getValueList();
|
List oldlist = ((FrozenLongMap) detourMap).getValueList();
|
||||||
long[] oldidlist = ((FrozenLongMap) detourMap).getKeyArray();
|
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) {
|
public void appendDetours(OsmTrack source) {
|
||||||
if (detourMap == null) {
|
if (detourMap == null) {
|
||||||
detourMap = source.detourMap == null ? null : new CompactLongMap<OsmPathElementHolder>();
|
detourMap = source.detourMap == null ? null : new CompactLongMap<>();
|
||||||
}
|
}
|
||||||
if (source.detourMap != null) {
|
if (source.detourMap != null) {
|
||||||
int pos = nodes.size() - source.nodes.size() + 1;
|
int pos = nodes.size() - source.nodes.size() + 1;
|
||||||
|
@ -160,7 +160,7 @@ public final class OsmTrack {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildMap() {
|
public void buildMap() {
|
||||||
nodesMap = new CompactLongMap<OsmPathElementHolder>();
|
nodesMap = new CompactLongMap<>();
|
||||||
for (OsmPathElement node : nodes) {
|
for (OsmPathElement node : nodes) {
|
||||||
long id = node.getIdFromPos();
|
long id = node.getIdFromPos();
|
||||||
OsmPathElementHolder nh = new OsmPathElementHolder();
|
OsmPathElementHolder nh = new OsmPathElementHolder();
|
||||||
|
@ -175,11 +175,11 @@ public final class OsmTrack {
|
||||||
nodesMap.fastPut(id, nh);
|
nodesMap.fastPut(id, nh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodesMap = new FrozenLongMap<OsmPathElementHolder>(nodesMap);
|
nodesMap = new FrozenLongMap<>(nodesMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> aggregateMessages() {
|
private List<String> aggregateMessages() {
|
||||||
ArrayList<String> res = new ArrayList<String>();
|
ArrayList<String> res = new ArrayList<>();
|
||||||
MessageData current = null;
|
MessageData current = null;
|
||||||
for (OsmPathElement n : nodes) {
|
for (OsmPathElement n : nodes) {
|
||||||
if (n.message != null && n.message.wayKeyValues != null) {
|
if (n.message != null && n.message.wayKeyValues != null) {
|
||||||
|
@ -201,7 +201,7 @@ public final class OsmTrack {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> aggregateSpeedProfile() {
|
private List<String> aggregateSpeedProfile() {
|
||||||
ArrayList<String> res = new ArrayList<String>();
|
ArrayList<String> res = new ArrayList<>();
|
||||||
int vmax = -1;
|
int vmax = -1;
|
||||||
int vmaxe = -1;
|
int vmaxe = -1;
|
||||||
int vmin = -1;
|
int vmin = -1;
|
||||||
|
@ -1289,7 +1289,7 @@ public final class OsmTrack {
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
node = nodes.get(nodeNr);
|
node = nodes.get(nodeNr);
|
||||||
List<VoiceHint> inputs = new ArrayList<VoiceHint>();
|
List<VoiceHint> inputs = new ArrayList<>();
|
||||||
while (node != null) {
|
while (node != null) {
|
||||||
if (node.origin != null) {
|
if (node.origin != null) {
|
||||||
VoiceHint input = new VoiceHint();
|
VoiceHint input = new VoiceHint();
|
||||||
|
|
|
@ -274,7 +274,7 @@ public final class RoutingContext {
|
||||||
public void cleanNogoList(List<OsmNode> waypoints) {
|
public void cleanNogoList(List<OsmNode> waypoints) {
|
||||||
nogopoints_all = nogopoints;
|
nogopoints_all = nogopoints;
|
||||||
if (nogopoints == null) return;
|
if (nogopoints == null) return;
|
||||||
List<OsmNodeNamed> nogos = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> nogos = new ArrayList<>();
|
||||||
for (OsmNodeNamed nogo : nogopoints) {
|
for (OsmNodeNamed nogo : nogopoints) {
|
||||||
boolean goodGuy = true;
|
boolean goodGuy = true;
|
||||||
for (OsmNode wp : waypoints) {
|
for (OsmNode wp : waypoints) {
|
||||||
|
@ -386,7 +386,7 @@ public final class RoutingContext {
|
||||||
|
|
||||||
public void setWaypoint(OsmNodeNamed wp, OsmNodeNamed pendingEndpoint, boolean endpoint) {
|
public void setWaypoint(OsmNodeNamed wp, OsmNodeNamed pendingEndpoint, boolean endpoint) {
|
||||||
keepnogopoints = nogopoints;
|
keepnogopoints = nogopoints;
|
||||||
nogopoints = new ArrayList<OsmNodeNamed>();
|
nogopoints = new ArrayList<>();
|
||||||
nogopoints.add(wp);
|
nogopoints.add(wp);
|
||||||
if (keepnogopoints != null) nogopoints.addAll(keepnogopoints);
|
if (keepnogopoints != null) nogopoints.addAll(keepnogopoints);
|
||||||
isEndpoint = endpoint;
|
isEndpoint = endpoint;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import btools.util.StackSampler;
|
||||||
|
|
||||||
public class RoutingEngine extends Thread {
|
public class RoutingEngine extends Thread {
|
||||||
private NodesCache nodesCache;
|
private NodesCache nodesCache;
|
||||||
private SortedHeap<OsmPath> openSet = new SortedHeap<OsmPath>();
|
private SortedHeap<OsmPath> openSet = new SortedHeap<>();
|
||||||
private boolean finished = false;
|
private boolean finished = false;
|
||||||
|
|
||||||
protected List<OsmNodeNamed> waypoints = null;
|
protected List<OsmNodeNamed> waypoints = null;
|
||||||
|
@ -146,7 +146,7 @@ public class RoutingEngine extends Thread {
|
||||||
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
|
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
|
||||||
OsmTrack[] lastTracks = new OsmTrack[nsections];
|
OsmTrack[] lastTracks = new OsmTrack[nsections];
|
||||||
OsmTrack track = null;
|
OsmTrack track = null;
|
||||||
ArrayList<String> messageList = new ArrayList<String>();
|
ArrayList<String> messageList = new ArrayList<>();
|
||||||
for (int i = 0; ; i++) {
|
for (int i = 0; ; i++) {
|
||||||
track = findTrack(refTracks, lastTracks);
|
track = findTrack(refTracks, lastTracks);
|
||||||
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
|
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
|
||||||
|
@ -362,7 +362,7 @@ public class RoutingEngine extends Thread {
|
||||||
try {
|
try {
|
||||||
MatchedWaypoint seedPoint = new MatchedWaypoint();
|
MatchedWaypoint seedPoint = new MatchedWaypoint();
|
||||||
seedPoint.waypoint = waypoints.get(0);
|
seedPoint.waypoint = waypoints.get(0);
|
||||||
List<MatchedWaypoint> listOne = new ArrayList<MatchedWaypoint>();
|
List<MatchedWaypoint> listOne = new ArrayList<>();
|
||||||
listOne.add(seedPoint);
|
listOne.add(seedPoint);
|
||||||
matchWaypointsToNodes(listOne);
|
matchWaypointsToNodes(listOne);
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ public class RoutingEngine extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchedWaypoints == null) { // could exist from the previous alternative level
|
if (matchedWaypoints == null) { // could exist from the previous alternative level
|
||||||
matchedWaypoints = new ArrayList<MatchedWaypoint>();
|
matchedWaypoints = new ArrayList<>();
|
||||||
for (int i = 0; i < nUnmatched; i++) {
|
for (int i = 0; i < nUnmatched; i++) {
|
||||||
MatchedWaypoint mwp = new MatchedWaypoint();
|
MatchedWaypoint mwp = new MatchedWaypoint();
|
||||||
mwp.waypoint = waypoints.get(i);
|
mwp.waypoint = waypoints.get(i);
|
||||||
|
@ -993,7 +993,7 @@ public class RoutingEngine extends Thread {
|
||||||
|
|
||||||
private OsmTrack findTrack(String operationName, MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack costCuttingTrack, OsmTrack refTrack, boolean fastPartialRecalc) {
|
private OsmTrack findTrack(String operationName, MatchedWaypoint startWp, MatchedWaypoint endWp, OsmTrack costCuttingTrack, OsmTrack refTrack, boolean fastPartialRecalc) {
|
||||||
try {
|
try {
|
||||||
List<OsmNode> wpts2 = new ArrayList<OsmNode>();
|
List<OsmNode> wpts2 = new ArrayList<>();
|
||||||
if (startWp != null) wpts2.add(startWp.waypoint);
|
if (startWp != null) wpts2.add(startWp.waypoint);
|
||||||
if (endWp != null) wpts2.add(endWp.waypoint);
|
if (endWp != null) wpts2.add(endWp.waypoint);
|
||||||
routingContext.cleanNogoList(wpts2);
|
routingContext.cleanNogoList(wpts2);
|
||||||
|
@ -1086,7 +1086,7 @@ public class RoutingEngine extends Thread {
|
||||||
addToOpenset(startPath1);
|
addToOpenset(startPath1);
|
||||||
addToOpenset(startPath2);
|
addToOpenset(startPath2);
|
||||||
}
|
}
|
||||||
ArrayList<OsmPath> openBorderList = new ArrayList<OsmPath>(4096);
|
ArrayList<OsmPath> openBorderList = new ArrayList<>(4096);
|
||||||
boolean memoryPanicMode = false;
|
boolean memoryPanicMode = false;
|
||||||
boolean needNonPanicProcessing = false;
|
boolean needNonPanicProcessing = false;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class VoiceHint {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (badWays == null) {
|
if (badWays == null) {
|
||||||
badWays = new ArrayList<MessageData>();
|
badWays = new ArrayList<>();
|
||||||
}
|
}
|
||||||
badWays.add(badWay);
|
badWays.add(badWay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||||
public class VoiceHintList {
|
public class VoiceHintList {
|
||||||
private String transportMode;
|
private String transportMode;
|
||||||
int turnInstructionMode;
|
int turnInstructionMode;
|
||||||
List<VoiceHint> list = new ArrayList<VoiceHint>();
|
List<VoiceHint> list = new ArrayList<>();
|
||||||
|
|
||||||
public void setTransportMode(boolean isCar, boolean isBike) {
|
public void setTransportMode(boolean isCar, boolean isBike) {
|
||||||
transportMode = isCar ? "car" : (isBike ? "bike" : "foot");
|
transportMode = isCar ? "car" : (isBike ? "bike" : "foot");
|
||||||
|
|
|
@ -55,7 +55,7 @@ public final class VoiceHintProcessor {
|
||||||
* @return voice hints, in forward order
|
* @return voice hints, in forward order
|
||||||
*/
|
*/
|
||||||
public List<VoiceHint> process(List<VoiceHint> inputs) {
|
public List<VoiceHint> process(List<VoiceHint> inputs) {
|
||||||
List<VoiceHint> results = new ArrayList<VoiceHint>();
|
List<VoiceHint> results = new ArrayList<>();
|
||||||
double distance = 0.;
|
double distance = 0.;
|
||||||
float roundAboutTurnAngle = 0.f; // sums up angles in roundabout
|
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)
|
// go through the hint list again in reverse order (=travel direction)
|
||||||
// and filter out non-significant hints and hints too close to its predecessor
|
// 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();
|
int i = results.size();
|
||||||
while (i > 0) {
|
while (i > 0) {
|
||||||
VoiceHint hint = results.get(--i);
|
VoiceHint hint = results.get(--i);
|
||||||
|
@ -241,7 +241,7 @@ public final class VoiceHintProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<VoiceHint> postProcess(List<VoiceHint> inputs, double catchingRange, double minRange) {
|
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;
|
double distance = 0;
|
||||||
VoiceHint inputLast = null;
|
VoiceHint inputLast = null;
|
||||||
ArrayList<VoiceHint> tmpList = new ArrayList<>();
|
ArrayList<VoiceHint> tmpList = new ArrayList<>();
|
||||||
|
|
|
@ -36,10 +36,10 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
||||||
|
|
||||||
public String _modelClass;
|
public String _modelClass;
|
||||||
|
|
||||||
private Map<String, Integer> lookupNumbers = new HashMap<String, Integer>();
|
private Map<String, Integer> lookupNumbers = new HashMap<>();
|
||||||
private List<BExpressionLookupValue[]> lookupValues = new ArrayList<BExpressionLookupValue[]>();
|
private List<BExpressionLookupValue[]> lookupValues = new ArrayList<>();
|
||||||
private List<String> lookupNames = new ArrayList<String>();
|
private List<String> lookupNames = new ArrayList<>();
|
||||||
private List<int[]> lookupHistograms = new ArrayList<int[]>();
|
private List<int[]> lookupHistograms = new ArrayList<>();
|
||||||
private boolean[] lookupIdxUsed;
|
private boolean[] lookupIdxUsed;
|
||||||
|
|
||||||
private boolean lookupDataFrozen = false;
|
private boolean lookupDataFrozen = false;
|
||||||
|
@ -50,7 +50,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
||||||
private BitCoderContext ctxEndode = new BitCoderContext(abBuf);
|
private BitCoderContext ctxEndode = new BitCoderContext(abBuf);
|
||||||
private BitCoderContext ctxDecode = new BitCoderContext(new byte[0]);
|
private BitCoderContext ctxDecode = new BitCoderContext(new byte[0]);
|
||||||
|
|
||||||
private Map<String, Integer> variableNumbers = new HashMap<String, Integer>();
|
private Map<String, Integer> variableNumbers = new HashMap<>();
|
||||||
|
|
||||||
private float[] variableData;
|
private float[] variableData;
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getKeyValueList(boolean inverseDirection, byte[] ab) {
|
public List<String> getKeyValueList(boolean inverseDirection, byte[] ab) {
|
||||||
ArrayList<String> res = new ArrayList<String>();
|
ArrayList<String> res = new ArrayList<>();
|
||||||
decode(lookupData, inverseDirection, ab);
|
decode(lookupData, inverseDirection, ab);
|
||||||
for (int inum = 0; inum < lookupValues.size(); inum++) { // loop over lookup names
|
for (int inum = 0; inum < lookupValues.size(); inum++) { // loop over lookup names
|
||||||
BExpressionLookupValue[] va = lookupValues.get(inum);
|
BExpressionLookupValue[] va = lookupValues.get(inum);
|
||||||
|
@ -429,7 +429,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
||||||
|
|
||||||
|
|
||||||
public void dumpStatistics() {
|
public void dumpStatistics() {
|
||||||
TreeMap<String, String> counts = new TreeMap<String, String>();
|
TreeMap<String, String> counts = new TreeMap<>();
|
||||||
// first count
|
// first count
|
||||||
for (String name : lookupNumbers.keySet()) {
|
for (String name : lookupNumbers.keySet()) {
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
@ -815,7 +815,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
||||||
private List<BExpression> _parseFile(File file) throws Exception {
|
private List<BExpression> _parseFile(File file) throws Exception {
|
||||||
_br = new BufferedReader(new FileReader(file));
|
_br = new BufferedReader(new FileReader(file));
|
||||||
_readerDone = false;
|
_readerDone = false;
|
||||||
List<BExpression> result = new ArrayList<BExpression>();
|
List<BExpression> result = new ArrayList<>();
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
BExpression exp = BExpression.parse(this, 0);
|
BExpression exp = BExpression.parse(this, 0);
|
||||||
if (exp == null) break;
|
if (exp == null) break;
|
||||||
|
|
|
@ -26,7 +26,7 @@ final class BExpressionLookupValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAlias(String alias) {
|
public void addAlias(String alias) {
|
||||||
if (aliases == null) aliases = new ArrayList<String>();
|
if (aliases == null) aliases = new ArrayList<>();
|
||||||
aliases.add(alias);
|
aliases.add(alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public final class BExpressionMetaData {
|
||||||
public short lookupMinorVersion = -1;
|
public short lookupMinorVersion = -1;
|
||||||
public short minAppVersion = -1;
|
public short minAppVersion = -1;
|
||||||
|
|
||||||
private Map<String, BExpressionContext> listeners = new HashMap<String, BExpressionContext>();
|
private Map<String, BExpressionContext> listeners = new HashMap<>();
|
||||||
|
|
||||||
public void registerListener(String context, BExpressionContext ctx) {
|
public void registerListener(String context, BExpressionContext ctx) {
|
||||||
listeners.put(context, ctx);
|
listeners.put(context, ctx);
|
||||||
|
|
|
@ -25,7 +25,7 @@ public abstract class MapCreatorBase implements WayListener, NodeListener, Relat
|
||||||
protected Map<String, String> tags;
|
protected Map<String, String> tags;
|
||||||
|
|
||||||
public void putTag(String key, String value) {
|
public void putTag(String key, String value) {
|
||||||
if (tags == null) tags = new HashMap<String, String>();
|
if (tags == null) tags = new HashMap<>();
|
||||||
tags.put(key, value);
|
tags.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class OsmNodeP extends OsmLinkP {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkDuplicateTargets() {
|
public void checkDuplicateTargets() {
|
||||||
HashMap<OsmNodeP, OsmLinkP> targets = new HashMap<OsmNodeP, OsmLinkP>();
|
HashMap<OsmNodeP, OsmLinkP> targets = new HashMap<>();
|
||||||
|
|
||||||
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
|
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
|
||||||
OsmLinkP link = link0;
|
OsmLinkP link = link0;
|
||||||
|
@ -165,14 +165,14 @@ public class OsmNodeP extends OsmLinkP {
|
||||||
mc.writeVarBytes(getNodeDecsription());
|
mc.writeVarBytes(getNodeDecsription());
|
||||||
|
|
||||||
// buffer internal reverse links
|
// buffer internal reverse links
|
||||||
ArrayList<OsmNodeP> internalReverse = new ArrayList<OsmNodeP>();
|
ArrayList<OsmNodeP> internalReverse = new ArrayList<>();
|
||||||
|
|
||||||
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
|
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
|
||||||
OsmLinkP link = link0;
|
OsmLinkP link = link0;
|
||||||
OsmNodeP origin = this;
|
OsmNodeP origin = this;
|
||||||
OsmNodeP target = null;
|
OsmNodeP target = null;
|
||||||
|
|
||||||
ArrayList<OsmNodeP> linkNodes = new ArrayList<OsmNodeP>();
|
ArrayList<OsmNodeP> linkNodes = new ArrayList<>();
|
||||||
linkNodes.add(this);
|
linkNodes.add(this);
|
||||||
|
|
||||||
// first pass just to see if that link is consistent
|
// first pass just to see if that link is consistent
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class OsmTrafficMap {
|
||||||
public OsmTrafficElement next;
|
public OsmTrafficElement next;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompactLongMap<OsmTrafficElement> map = new CompactLongMap<OsmTrafficElement>();
|
private CompactLongMap<OsmTrafficElement> map = new CompactLongMap<>();
|
||||||
|
|
||||||
public void loadAll(File file, int minLon, int minLat, int maxLon, int maxLat, boolean includeMotorways) throws Exception {
|
public void loadAll(File file, int minLon, int minLat, int maxLon, int maxLat, boolean includeMotorways) throws Exception {
|
||||||
load(file, minLon, minLat, maxLon, maxLat, includeMotorways);
|
load(file, minLon, minLat, maxLon, maxLat, includeMotorways);
|
||||||
|
@ -107,7 +107,7 @@ public class OsmTrafficMap {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
map = new FrozenLongMap<OsmTrafficElement>(map);
|
map = new FrozenLongMap<>(map);
|
||||||
System.out.println("read traffic-elements: " + trafficElements);
|
System.out.println("read traffic-elements: " + trafficElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class PosUnifier extends MapCreatorBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetSrtm() {
|
private void resetSrtm() {
|
||||||
srtmmap = new HashMap<String, SrtmRaster>();
|
srtmmap = new HashMap<>();
|
||||||
lastSrtmLonIdx = -1;
|
lastSrtmLonIdx = -1;
|
||||||
lastSrtmLatIdx = -1;
|
lastSrtmLatIdx = -1;
|
||||||
lastSrtmRaster = null;
|
lastSrtmRaster = null;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class RelationMerger extends MapCreatorBase {
|
||||||
// expctxStat = new BExpressionContext("way");
|
// expctxStat = new BExpressionContext("way");
|
||||||
|
|
||||||
// *** read the relation file into sets for each processed tag
|
// *** read the relation file into sets for each processed tag
|
||||||
routesets = new HashMap<String, CompactLongSet>();
|
routesets = new HashMap<>();
|
||||||
routesetall = new CompactLongSet();
|
routesetall = new CompactLongSet();
|
||||||
DataInputStream dis = createInStream(relationFileIn);
|
DataInputStream dis = createInStream(relationFileIn);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class RelationStatistics extends MapCreatorBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(File relationFileIn) throws Exception {
|
public void process(File relationFileIn) throws Exception {
|
||||||
HashMap<String, long[]> relstats = new HashMap<String, long[]>();
|
HashMap<String, long[]> relstats = new HashMap<>();
|
||||||
|
|
||||||
DataInputStream dis = createInStream(relationFileIn);
|
DataInputStream dis = createInStream(relationFileIn);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
|
||||||
private void reset() {
|
private void reset() {
|
||||||
minLon = -1;
|
minLon = -1;
|
||||||
minLat = -1;
|
minLat = -1;
|
||||||
nodesMap = new CompactLongMap<OsmNodeP>();
|
nodesMap = new CompactLongMap<>();
|
||||||
borderSet = new CompactLongSet();
|
borderSet = new CompactLongSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
|
||||||
new NodeIterator(this, true).processFile(nodeFile);
|
new NodeIterator(this, true).processFile(nodeFile);
|
||||||
|
|
||||||
// freeze the nodes-map
|
// freeze the nodes-map
|
||||||
FrozenLongMap<OsmNodeP> nodesMapFrozen = new FrozenLongMap<OsmNodeP>(nodesMap);
|
FrozenLongMap<OsmNodeP> nodesMapFrozen = new FrozenLongMap<>(nodesMap);
|
||||||
nodesMap = nodesMapFrozen;
|
nodesMap = nodesMapFrozen;
|
||||||
|
|
||||||
File restrictionFile = fileFromTemplate(wayfile, new File(nodeTilesIn.getParentFile(), "restrictions55"), "rt5");
|
File restrictionFile = fileFromTemplate(wayfile, new File(nodeTilesIn.getParentFile(), "restrictions55"), "rt5");
|
||||||
|
@ -415,7 +415,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
|
||||||
int nLatSegs = (maxLat - minLat) / 1000000;
|
int nLatSegs = (maxLat - minLat) / 1000000;
|
||||||
|
|
||||||
// sort the nodes into segments
|
// sort the nodes into segments
|
||||||
LazyArrayOfLists<OsmNodeP> seglists = new LazyArrayOfLists<OsmNodeP>(nLonSegs * nLatSegs);
|
LazyArrayOfLists<OsmNodeP> seglists = new LazyArrayOfLists<>(nLonSegs * nLatSegs);
|
||||||
for (OsmNodeP n : nodesList) {
|
for (OsmNodeP n : nodesList) {
|
||||||
if (n == null || n.getFirstLink() == null || n.isTransferNode())
|
if (n == null || n.getFirstLink() == null || n.isTransferNode())
|
||||||
continue;
|
continue;
|
||||||
|
@ -450,7 +450,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
|
||||||
if (seglists.getSize(tileIndex) > 0) {
|
if (seglists.getSize(tileIndex) > 0) {
|
||||||
List<OsmNodeP> nlist = seglists.getList(tileIndex);
|
List<OsmNodeP> nlist = seglists.getList(tileIndex);
|
||||||
|
|
||||||
LazyArrayOfLists<OsmNodeP> subs = new LazyArrayOfLists<OsmNodeP>(ncaches);
|
LazyArrayOfLists<OsmNodeP> subs = new LazyArrayOfLists<>(ncaches);
|
||||||
byte[][] subByteArrays = new byte[ncaches][];
|
byte[][] subByteArrays = new byte[ncaches][];
|
||||||
for (int ni = 0; ni < nlist.size(); ni++) {
|
for (int ni = 0; ni < nlist.size(); ni++) {
|
||||||
OsmNodeP n = nlist.get(ni);
|
OsmNodeP n = nlist.get(ni);
|
||||||
|
@ -473,7 +473,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
|
||||||
MicroCache mc = new MicroCache2(size, abBuf2, lonIdxDiv, latIdxDiv, divisor);
|
MicroCache mc = new MicroCache2(size, abBuf2, lonIdxDiv, latIdxDiv, divisor);
|
||||||
|
|
||||||
// sort via treemap
|
// sort via treemap
|
||||||
TreeMap<Integer, OsmNodeP> sortedList = new TreeMap<Integer, OsmNodeP>();
|
TreeMap<Integer, OsmNodeP> sortedList = new TreeMap<>();
|
||||||
for (OsmNodeP n : subList) {
|
for (OsmNodeP n : subList) {
|
||||||
long longId = n.getIdFromPos();
|
long longId = n.getIdFromPos();
|
||||||
int shrinkid = mc.shrinkId(longId);
|
int shrinkid = mc.shrinkId(longId);
|
||||||
|
|
|
@ -95,7 +95,7 @@ public final class NodesCache {
|
||||||
fileRows = new OsmFile[180][];
|
fileRows = new OsmFile[180][];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileCache = new HashMap<String, PhysicalFile>(4);
|
fileCache = new HashMap<>(4);
|
||||||
fileRows = new OsmFile[180][];
|
fileRows = new OsmFile[180][];
|
||||||
dataBuffers = new DataBuffers();
|
dataBuffers = new DataBuffers();
|
||||||
secondarySegmentsDir = StorageConfigHelper.getSecondarySegmentDir(segmentDir);
|
secondarySegmentsDir = StorageConfigHelper.getSecondarySegmentDir(segmentDir);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class OsmNodePairSet {
|
||||||
|
|
||||||
private void addPair(long n1, long n2) {
|
private void addPair(long n1, long n2) {
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
map = new CompactLongMap<OsmNodePair>();
|
map = new CompactLongMap<>();
|
||||||
}
|
}
|
||||||
npairs++;
|
npairs++;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.Map;
|
||||||
import btools.util.ByteArrayUnifier;
|
import btools.util.ByteArrayUnifier;
|
||||||
|
|
||||||
public final class OsmNodesMap {
|
public final class OsmNodesMap {
|
||||||
private Map<OsmNode, OsmNode> hmap = new HashMap<OsmNode, OsmNode>(4096);
|
private Map<OsmNode, OsmNode> hmap = new HashMap<>(4096);
|
||||||
|
|
||||||
private ByteArrayUnifier abUnifier = new ByteArrayUnifier(16384, false);
|
private ByteArrayUnifier abUnifier = new ByteArrayUnifier(16384, false);
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public final class OsmNodesMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void collectOutreachers() {
|
public void collectOutreachers() {
|
||||||
nodes2check = new ArrayList<OsmNode>(nodesCreated);
|
nodes2check = new ArrayList<>(nodesCreated);
|
||||||
nodesCreated = 0;
|
nodesCreated = 0;
|
||||||
for (OsmNode n : hmap.values()) {
|
for (OsmNode n : hmap.values()) {
|
||||||
addActiveNode(nodes2check, n);
|
addActiveNode(nodes2check, n);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort result list
|
// sort result list
|
||||||
comparator = new Comparator<MatchedWaypoint>() {
|
comparator = new Comparator<>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(MatchedWaypoint mw1, MatchedWaypoint mw2) {
|
public int compare(MatchedWaypoint mw1, MatchedWaypoint mw2) {
|
||||||
int cmpDist = Double.compare(mw1.radius, mw2.radius);
|
int cmpDist = Double.compare(mw1.radius, mw2.radius);
|
||||||
|
|
|
@ -488,11 +488,11 @@ public class BInstallerActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadDiffVersionTiles() {
|
private void downloadDiffVersionTiles() {
|
||||||
downloadAll(new ArrayList<Integer>(), DownloadWorker.VALUE_SEGMENT_DIFFS);
|
downloadAll(new ArrayList<>(), DownloadWorker.VALUE_SEGMENT_DIFFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropDiffVersionTiles() {
|
private void dropDiffVersionTiles() {
|
||||||
downloadAll(new ArrayList<Integer>(), DownloadWorker.VALUE_SEGMENT_DROPDIFFS);
|
downloadAll(new ArrayList<>(), DownloadWorker.VALUE_SEGMENT_DROPDIFFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDownloadRunning(Class<?> serviceClass) {
|
private boolean isDownloadRunning(Class<?> serviceClass) {
|
||||||
|
|
|
@ -199,8 +199,8 @@ public class BRouterService extends Service {
|
||||||
private void readNogos(BRouterWorker worker, String baseDir) throws Exception {
|
private void readNogos(BRouterWorker worker, String baseDir) throws Exception {
|
||||||
// add nogos from waypoint database
|
// add nogos from waypoint database
|
||||||
CoordinateReader cor = CoordinateReader.obtainValidReader(baseDir, true);
|
CoordinateReader cor = CoordinateReader.obtainValidReader(baseDir, true);
|
||||||
worker.nogoList = new ArrayList<OsmNodeNamed>(cor.nogopoints);
|
worker.nogoList = new ArrayList<>(cor.nogopoints);
|
||||||
worker.nogoPolygonsList = new ArrayList<OsmNodeNamed>();
|
worker.nogoPolygonsList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean fileEqual(byte[] fileBytes, File file) throws Exception {
|
private boolean fileEqual(byte[] fileBytes, File file) throws Exception {
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class BRouterWorker {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("extraParams")) { // add user params
|
if (params.containsKey("extraParams")) { // add user params
|
||||||
if (rc.keyValues == null) rc.keyValues = new HashMap<String, String>();
|
if (rc.keyValues == null) rc.keyValues = new HashMap<>();
|
||||||
StringTokenizer tk = new StringTokenizer(extraParams, "?&");
|
StringTokenizer tk = new StringTokenizer(extraParams, "?&");
|
||||||
while (tk.hasMoreTokens()) {
|
while (tk.hasMoreTokens()) {
|
||||||
String t = tk.nextToken();
|
String t = tk.nextToken();
|
||||||
|
@ -212,7 +212,7 @@ public class BRouterWorker {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OsmNodeNamed> readPositions(Bundle params) {
|
private List<OsmNodeNamed> readPositions(Bundle params) {
|
||||||
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> wplist = new ArrayList<>();
|
||||||
|
|
||||||
double[] lats = params.getDoubleArray("lats");
|
double[] lats = params.getDoubleArray("lats");
|
||||||
double[] lons = params.getDoubleArray("lons");
|
double[] lons = params.getDoubleArray("lons");
|
||||||
|
@ -235,7 +235,7 @@ public class BRouterWorker {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OsmNodeNamed> readLonlats(Bundle params) {
|
private List<OsmNodeNamed> readLonlats(Bundle params) {
|
||||||
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> wplist = new ArrayList<>();
|
||||||
|
|
||||||
String lonLats = params.getString("lonlats");
|
String lonLats = params.getString("lonlats");
|
||||||
if (lonLats == null) throw new IllegalArgumentException("lonlats parameter not set");
|
if (lonLats == null) throw new IllegalArgumentException("lonlats parameter not set");
|
||||||
|
@ -315,7 +315,7 @@ public class BRouterWorker {
|
||||||
|
|
||||||
String[] lonLatRadList = nogos.split("\\|");
|
String[] lonLatRadList = nogos.split("\\|");
|
||||||
|
|
||||||
List<OsmNodeNamed> nogoList = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> nogoList = new ArrayList<>();
|
||||||
for (int i = 0; i < lonLatRadList.length; i++) {
|
for (int i = 0; i < lonLatRadList.length; i++) {
|
||||||
String[] lonLatRad = lonLatRadList[i].split(",");
|
String[] lonLatRad = lonLatRadList[i].split(",");
|
||||||
String nogoWeight = "NaN";
|
String nogoWeight = "NaN";
|
||||||
|
@ -344,7 +344,7 @@ public class BRouterWorker {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OsmNodeNamed> readNogoPolygons(Bundle params) {
|
private List<OsmNodeNamed> readNogoPolygons(Bundle params) {
|
||||||
List<OsmNodeNamed> result = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> result = new ArrayList<>();
|
||||||
parseNogoPolygons(params.getString("polylines"), result, false);
|
parseNogoPolygons(params.getString("polylines"), result, false);
|
||||||
parseNogoPolygons(params.getString("polygons"), result, true);
|
parseNogoPolygons(params.getString("polygons"), result, true);
|
||||||
return result.size() > 0 ? result : null;
|
return result.size() > 0 ? result : null;
|
||||||
|
@ -389,7 +389,7 @@ public class BRouterWorker {
|
||||||
|
|
||||||
String[] lonLatNameList = pois.split("\\|");
|
String[] lonLatNameList = pois.split("\\|");
|
||||||
|
|
||||||
List<OsmNodeNamed> poisList = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> poisList = new ArrayList<>();
|
||||||
for (int i = 0; i < lonLatNameList.length; i++) {
|
for (int i = 0; i < lonLatNameList.length; i++) {
|
||||||
String[] lonLatName = lonLatNameList[i].split(",");
|
String[] lonLatName = lonLatNameList[i].split(",");
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ConfigMigration {
|
||||||
}
|
}
|
||||||
br.close();
|
br.close();
|
||||||
|
|
||||||
List<String> lines = new ArrayList<String>();
|
List<String> lines = new ArrayList<>();
|
||||||
br = new BufferedReader(new FileReader(dstFile));
|
br = new BufferedReader(new FileReader(dstFile));
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
String line = br.readLine();
|
String line = br.readLine();
|
||||||
|
@ -76,7 +76,7 @@ public class ConfigMigration {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
BufferedWriter bw = null;
|
BufferedWriter bw = null;
|
||||||
File configFile = new File(segmentDir, "storageconfig.txt");
|
File configFile = new File(segmentDir, "storageconfig.txt");
|
||||||
List<String> lines = new ArrayList<String>();
|
List<String> lines = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(configFile));
|
br = new BufferedReader(new FileReader(configFile));
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class ServiceModeConfig {
|
||||||
profile = tk.nextToken();
|
profile = tk.nextToken();
|
||||||
if (tk.hasMoreTokens()) params = tk.nextToken();
|
if (tk.hasMoreTokens()) params = tk.nextToken();
|
||||||
else params = "noparams";
|
else params = "noparams";
|
||||||
nogoVetos = new TreeSet<String>();
|
nogoVetos = new TreeSet<>();
|
||||||
while (tk.hasMoreTokens()) {
|
while (tk.hasMoreTokens()) {
|
||||||
nogoVetos.add(tk.nextToken());
|
nogoVetos.add(tk.nextToken());
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class ServiceModeConfig {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
nogoVetos = new TreeSet<String>();
|
nogoVetos = new TreeSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toLine() {
|
public String toLine() {
|
||||||
|
|
|
@ -8,8 +8,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Area {
|
public class Area {
|
||||||
private List<Polygon> poslist = new ArrayList<Polygon>();
|
private List<Polygon> poslist = new ArrayList<>();
|
||||||
private List<Polygon> neglist = new ArrayList<Polygon>();
|
private List<Polygon> neglist = new ArrayList<>();
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
Area a = new Area(new File(args[0]));
|
Area a = new Area(new File(args[0]));
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class BRouter {
|
||||||
maxRunningTime = Integer.parseInt(sMaxRunningTime) * 1000;
|
maxRunningTime = Integer.parseInt(sMaxRunningTime) * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> wplist = new ArrayList<>();
|
||||||
wplist.add(from);
|
wplist.add(from);
|
||||||
wplist.add(to);
|
wplist.add(to);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class BRouter {
|
||||||
System.out.println("usage: java -jar brouter.jar <segmentdir> <lon-from> <lat-from> <lon-to> <lat-to> <profile>");
|
System.out.println("usage: java -jar brouter.jar <segmentdir> <lon-from> <lat-from> <lon-to> <lat-to> <profile>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> wplist = new ArrayList<>();
|
||||||
wplist.add(readPosition(args, 1, "from"));
|
wplist.add(readPosition(args, 1, "from"));
|
||||||
RoutingEngine re = null;
|
RoutingEngine re = null;
|
||||||
if ("seed".equals(args[3])) {
|
if ("seed".equals(args[3])) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||||
|
|
||||||
public class IpAccessMonitor {
|
public class IpAccessMonitor {
|
||||||
private static Object sync = new Object();
|
private static Object sync = new Object();
|
||||||
private static Map<String, Long> ipAccess = new HashMap<String, Long>();
|
private static Map<String, Long> ipAccess = new HashMap<>();
|
||||||
private static long MAX_IDLE = 900000; // 15 minutes
|
private static long MAX_IDLE = 900000; // 15 minutes
|
||||||
private static long CLEANUP_INTERVAL = 10000; // 10 seconds
|
private static long CLEANUP_INTERVAL = 10000; // 10 seconds
|
||||||
private static long lastCleanup;
|
private static long lastCleanup;
|
||||||
|
@ -31,7 +31,7 @@ public class IpAccessMonitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void cleanup(long t) {
|
private static void cleanup(long t) {
|
||||||
HashMap<String, Long> newMap = new HashMap<String, Long>(ipAccess.size());
|
HashMap<String, Long> newMap = new HashMap<>(ipAccess.size());
|
||||||
for (Map.Entry<String, Long> e : ipAccess.entrySet()) {
|
for (Map.Entry<String, Long> e : ipAccess.entrySet()) {
|
||||||
if (t - e.getValue().longValue() <= MAX_IDLE) {
|
if (t - e.getValue().longValue() <= MAX_IDLE) {
|
||||||
newMap.put(e.getKey(), e.getValue());
|
newMap.put(e.getKey(), e.getValue());
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class Polygon {
|
||||||
private int maxy = Integer.MIN_VALUE;
|
private int maxy = Integer.MIN_VALUE;
|
||||||
|
|
||||||
public Polygon(BufferedReader br) throws IOException {
|
public Polygon(BufferedReader br) throws IOException {
|
||||||
ArrayList<String> lines = new ArrayList<String>();
|
ArrayList<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
String line = br.readLine();
|
String line = br.readLine();
|
||||||
|
|
|
@ -199,7 +199,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
||||||
rc.forceUseStartDirection = true;
|
rc.forceUseStartDirection = true;
|
||||||
} else if (e.getKey().startsWith("profile:")) {
|
} else if (e.getKey().startsWith("profile:")) {
|
||||||
if (rc.keyValues == null) {
|
if (rc.keyValues == null) {
|
||||||
rc.keyValues = new HashMap<String, String>();
|
rc.keyValues = new HashMap<>();
|
||||||
}
|
}
|
||||||
rc.keyValues.put(e.getKey().substring(8), e.getValue());
|
rc.keyValues.put(e.getKey().substring(8), e.getValue());
|
||||||
} else if (e.getKey().equals("straight")) {
|
} else if (e.getKey().equals("straight")) {
|
||||||
|
@ -294,7 +294,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
||||||
|
|
||||||
ProfileCache.setSize(2 * maxthreads);
|
ProfileCache.setSize(2 * maxthreads);
|
||||||
|
|
||||||
PriorityQueue<RouteServer> threadQueue = new PriorityQueue<RouteServer>();
|
PriorityQueue<RouteServer> threadQueue = new PriorityQueue<>();
|
||||||
|
|
||||||
ServerSocket serverSocket = args.length > 5 ? new ServerSocket(Integer.parseInt(args[3]), 100, InetAddress.getByName(args[5])) : new ServerSocket(Integer.parseInt(args[3]));
|
ServerSocket serverSocket = args.length > 5 ? new ServerSocket(Integer.parseInt(args[3]), 100, InetAddress.getByName(args[5])) : new ServerSocket(Integer.parseInt(args[3]));
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
||||||
|
|
||||||
|
|
||||||
private static Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
|
private static Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
|
||||||
HashMap<String, String> params = new HashMap<String, String>();
|
HashMap<String, String> params = new HashMap<>();
|
||||||
String decoded = URLDecoder.decode(url, "UTF-8");
|
String decoded = URLDecoder.decode(url, "UTF-8");
|
||||||
StringTokenizer tk = new StringTokenizer(decoded, "?&");
|
StringTokenizer tk = new StringTokenizer(decoded, "?&");
|
||||||
while (tk.hasMoreTokens()) {
|
while (tk.hasMoreTokens()) {
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class SuspectManager extends Thread {
|
||||||
bw.write("<table>\n");
|
bw.write("<table>\n");
|
||||||
File countryParent = new File("worldpolys" + country);
|
File countryParent = new File("worldpolys" + country);
|
||||||
File[] files = countryParent.listFiles();
|
File[] files = countryParent.listFiles();
|
||||||
TreeSet<String> names = new TreeSet<String>();
|
TreeSet<String> names = new TreeSet<>();
|
||||||
for (File f : files) {
|
for (File f : files) {
|
||||||
String name = f.getName();
|
String name = f.getName();
|
||||||
if (name.endsWith(".poly")) {
|
if (name.endsWith(".poly")) {
|
||||||
|
@ -580,7 +580,7 @@ public class SuspectManager extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, SuspectList> allSuspectsMap = new HashMap<String, SuspectList>();
|
private static Map<String, SuspectList> allSuspectsMap = new HashMap<>();
|
||||||
|
|
||||||
private static SuspectList getDailySuspectsIfLoaded() throws IOException {
|
private static SuspectList getDailySuspectsIfLoaded() throws IOException {
|
||||||
synchronized (allSuspectsMap) {
|
synchronized (allSuspectsMap) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class ProfileUploadHandler {
|
||||||
fileWriter.flush();
|
fileWriter.flush();
|
||||||
//System.out.println("data: |" + sw.toString() + "|");
|
//System.out.println("data: |" + sw.toString() + "|");
|
||||||
|
|
||||||
Map<String, String> responseData = new HashMap<String, String>();
|
Map<String, String> responseData = new HashMap<>();
|
||||||
responseData.put("profileid", CUSTOM_PREFIX + id);
|
responseData.put("profileid", CUSTOM_PREFIX + id);
|
||||||
|
|
||||||
validateProfile(id, responseData);
|
validateProfile(id, responseData);
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class ServerHandler extends RequestHandler {
|
||||||
if (coords.length < 2)
|
if (coords.length < 2)
|
||||||
throw new IllegalArgumentException("we need two lat/lon points at least!");
|
throw new IllegalArgumentException("we need two lat/lon points at least!");
|
||||||
|
|
||||||
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> wplist = new ArrayList<>();
|
||||||
for (int i = 0; i < coords.length; i++) {
|
for (int i = 0; i < coords.length; i++) {
|
||||||
String[] lonLat = coords[i].split(",");
|
String[] lonLat = coords[i].split(",");
|
||||||
if (lonLat.length < 2)
|
if (lonLat.length < 2)
|
||||||
|
@ -213,7 +213,7 @@ public class ServerHandler extends RequestHandler {
|
||||||
|
|
||||||
String[] lonLatNameList = pois.split("\\|");
|
String[] lonLatNameList = pois.split("\\|");
|
||||||
|
|
||||||
List<OsmNodeNamed> poisList = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> poisList = new ArrayList<>();
|
||||||
for (int i = 0; i < lonLatNameList.length; i++) {
|
for (int i = 0; i < lonLatNameList.length; i++) {
|
||||||
String[] lonLatName = lonLatNameList[i].split(",");
|
String[] lonLatName = lonLatNameList[i].split(",");
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ public class ServerHandler extends RequestHandler {
|
||||||
|
|
||||||
String[] lonLatRadList = nogos.split("\\|");
|
String[] lonLatRadList = nogos.split("\\|");
|
||||||
|
|
||||||
List<OsmNodeNamed> nogoList = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> nogoList = new ArrayList<>();
|
||||||
for (int i = 0; i < lonLatRadList.length; i++) {
|
for (int i = 0; i < lonLatRadList.length; i++) {
|
||||||
String[] lonLatRad = lonLatRadList[i].split(",");
|
String[] lonLatRad = lonLatRadList[i].split(",");
|
||||||
String nogoWeight = "NaN";
|
String nogoWeight = "NaN";
|
||||||
|
@ -266,7 +266,7 @@ public class ServerHandler extends RequestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OsmNodeNamed> readNogoPolygons() {
|
private List<OsmNodeNamed> readNogoPolygons() {
|
||||||
List<OsmNodeNamed> result = new ArrayList<OsmNodeNamed>();
|
List<OsmNodeNamed> result = new ArrayList<>();
|
||||||
parseNogoPolygons(params.get("polylines"), result, false);
|
parseNogoPolygons(params.get("polylines"), result, false);
|
||||||
parseNogoPolygons(params.get("polygons"), result, true);
|
parseNogoPolygons(params.get("polygons"), result, true);
|
||||||
return result.size() > 0 ? result : null;
|
return result.size() > 0 ? result : null;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||||
* @author ab
|
* @author ab
|
||||||
*/
|
*/
|
||||||
public class DenseLongMap {
|
public class DenseLongMap {
|
||||||
private List<byte[]> blocklist = new ArrayList<byte[]>(4096);
|
private List<byte[]> blocklist = new ArrayList<>(4096);
|
||||||
|
|
||||||
private int blocksize; // bytes per bitplane in one block
|
private int blocksize; // bytes per bitplane in one block
|
||||||
private int blocksizeBits;
|
private int blocksizeBits;
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class FrozenLongMap<V> extends CompactLongMap<V> {
|
||||||
size = map.size();
|
size = map.size();
|
||||||
|
|
||||||
faid = new long[size];
|
faid = new long[size];
|
||||||
flv = new ArrayList<V>(size);
|
flv = new ArrayList<>(size);
|
||||||
|
|
||||||
map.moveToFrozenArrays(faid, flv);
|
map.moveToFrozenArrays(faid, flv);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class LazyArrayOfLists<E> {
|
||||||
private List<ArrayList<E>> lists;
|
private List<ArrayList<E>> lists;
|
||||||
|
|
||||||
public LazyArrayOfLists(int size) {
|
public LazyArrayOfLists(int size) {
|
||||||
lists = new ArrayList<ArrayList<E>>(size);
|
lists = new ArrayList<>(size);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
lists.add(null);
|
lists.add(null);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class LazyArrayOfLists<E> {
|
||||||
public List<E> getList(int idx) {
|
public List<E> getList(int idx) {
|
||||||
ArrayList<E> list = lists.get(idx);
|
ArrayList<E> list = lists.get(idx);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = new ArrayList<E>();
|
list = new ArrayList<>();
|
||||||
lists.set(idx, list);
|
lists.set(idx, list);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -22,9 +22,9 @@ public class CompactMapTest {
|
||||||
|
|
||||||
private void hashMapComparison(int mapsize, int trycount) {
|
private void hashMapComparison(int mapsize, int trycount) {
|
||||||
Random rand = new Random(12345);
|
Random rand = new Random(12345);
|
||||||
HashMap<Long, String> hmap = new HashMap<Long, String>();
|
HashMap<Long, String> hmap = new HashMap<>();
|
||||||
CompactLongMap<String> cmap_slow = new CompactLongMap<String>();
|
CompactLongMap<String> cmap_slow = new CompactLongMap<>();
|
||||||
CompactLongMap<String> cmap_fast = new CompactLongMap<String>();
|
CompactLongMap<String> cmap_fast = new CompactLongMap<>();
|
||||||
|
|
||||||
for (int i = 0; i < mapsize; i++) {
|
for (int i = 0; i < mapsize; i++) {
|
||||||
String s = "" + i;
|
String s = "" + i;
|
||||||
|
@ -40,8 +40,8 @@ public class CompactMapTest {
|
||||||
|
|
||||||
for (int i = 0; i < trycount * 2; i++) {
|
for (int i = 0; i < trycount * 2; i++) {
|
||||||
if (i == trycount) {
|
if (i == trycount) {
|
||||||
cmap_slow = new FrozenLongMap<String>(cmap_slow);
|
cmap_slow = new FrozenLongMap<>(cmap_slow);
|
||||||
cmap_fast = new FrozenLongMap<String>(cmap_fast);
|
cmap_fast = new FrozenLongMap<>(cmap_fast);
|
||||||
}
|
}
|
||||||
long k = mapsize < 10 ? i : rand.nextInt(20000);
|
long k = mapsize < 10 ? i : rand.nextInt(20000);
|
||||||
Long KK = new Long(k);
|
Long KK = new Long(k);
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class CompactSetTest {
|
||||||
|
|
||||||
private void hashSetComparison(int setsize, int trycount) {
|
private void hashSetComparison(int setsize, int trycount) {
|
||||||
Random rand = new Random(12345);
|
Random rand = new Random(12345);
|
||||||
HashSet<Long> hset = new HashSet<Long>();
|
HashSet<Long> hset = new HashSet<>();
|
||||||
CompactLongSet cset_slow = new CompactLongSet();
|
CompactLongSet cset_slow = new CompactLongSet();
|
||||||
CompactLongSet cset_fast = new CompactLongSet();
|
CompactLongSet cset_fast = new CompactLongSet();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class DenseLongMapTest {
|
||||||
|
|
||||||
private void hashMapComparison(int mapsize, int trycount, long keyrange) {
|
private void hashMapComparison(int mapsize, int trycount, long keyrange) {
|
||||||
Random rand = new Random(12345);
|
Random rand = new Random(12345);
|
||||||
HashMap<Long, Integer> hmap = new HashMap<Long, Integer>();
|
HashMap<Long, Integer> hmap = new HashMap<>();
|
||||||
DenseLongMap dmap = new DenseLongMap(512);
|
DenseLongMap dmap = new DenseLongMap(512);
|
||||||
|
|
||||||
for (int i = 0; i < mapsize; i++) {
|
for (int i = 0; i < mapsize; i++) {
|
||||||
|
@ -48,7 +48,7 @@ public class DenseLongMapTest {
|
||||||
int trycount = 100000;
|
int trycount = 100000;
|
||||||
|
|
||||||
Random rand = new Random(12345);
|
Random rand = new Random(12345);
|
||||||
HashSet<Long> hset = new HashSet<Long>();
|
HashSet<Long> hset = new HashSet<>();
|
||||||
|
|
||||||
DenseLongMap dmap = new DenseLongMap(512);
|
DenseLongMap dmap = new DenseLongMap(512);
|
||||||
for (int i = 0; i < mapputs; i++) {
|
for (int i = 0; i < mapputs; i++) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Random;
|
||||||
public class SortedHeapTest {
|
public class SortedHeapTest {
|
||||||
@Test
|
@Test
|
||||||
public void sortedHeapTest1() {
|
public void sortedHeapTest1() {
|
||||||
SortedHeap<String> sh = new SortedHeap<String>();
|
SortedHeap<String> sh = new SortedHeap<>();
|
||||||
Random rnd = new Random();
|
Random rnd = new Random();
|
||||||
for (int i = 0; i < 100000; i++) {
|
for (int i = 0; i < 100000; i++) {
|
||||||
int val = rnd.nextInt(1000000);
|
int val = rnd.nextInt(1000000);
|
||||||
|
@ -34,7 +34,7 @@ public class SortedHeapTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sortedHeapTest2() {
|
public void sortedHeapTest2() {
|
||||||
SortedHeap<String> sh = new SortedHeap<String>();
|
SortedHeap<String> sh = new SortedHeap<>();
|
||||||
Random rnd = new Random();
|
Random rnd = new Random();
|
||||||
for (int i = 0; i < 100000; i++) {
|
for (int i = 0; i < 100000; i++) {
|
||||||
sh.add(i, "" + i);
|
sh.add(i, "" + i);
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
<!-- Rules similar to Android Studio code inspection default settings -->
|
<!-- Rules similar to Android Studio code inspection default settings -->
|
||||||
<!-- <rule ref="category/java/bestpractices.xml/UnusedAssignment" /> -->
|
<!-- <rule ref="category/java/bestpractices.xml/UnusedAssignment" /> -->
|
||||||
<!-- <rule ref="category/java/codestyle.xml/UseDiamondOperator" /> -->
|
<rule ref="category/java/codestyle.xml/UseDiamondOperator" />
|
||||||
<!-- <rule ref="category/java/design.xml/ImmutableField" /> -->
|
<!-- <rule ref="category/java/design.xml/ImmutableField" /> -->
|
||||||
<!-- Will be added in PMD 7 -->
|
<!-- Will be added in PMD 7 -->
|
||||||
<!-- <rule ref="category/java/codestyle.xml/UnnecessaryBoxing" /> -->
|
<!-- <rule ref="category/java/codestyle.xml/UnnecessaryBoxing" /> -->
|
||||||
|
|
Loading…
Reference in a new issue