Enable PMD rule LooseCoupling and fix violations
This commit is contained in:
parent
c75a8cb703
commit
30be64cbbe
26 changed files with 64 additions and 50 deletions
|
@ -1,11 +1,12 @@
|
|||
package btools.codec;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import btools.util.BitCoderContext;
|
||||
|
||||
public final class StatCoderContext extends BitCoderContext {
|
||||
private static TreeMap<String, long[]> statsPerName;
|
||||
private static Map<String, long[]> statsPerName;
|
||||
private long lastbitpos = 0;
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package btools.codec;
|
|||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.PriorityQueue;
|
||||
|
||||
import btools.util.BitCoderContext;
|
||||
|
@ -16,7 +17,7 @@ import btools.util.BitCoderContext;
|
|||
* but doesn't do anything at pass1
|
||||
*/
|
||||
public final class TagValueCoder {
|
||||
private HashMap<TagValueSet, TagValueSet> identityMap;
|
||||
private Map<TagValueSet, TagValueSet> identityMap;
|
||||
private Object tree;
|
||||
private BitCoderContext bc;
|
||||
private int pass;
|
||||
|
|
|
@ -53,7 +53,7 @@ public final class OsmTrack {
|
|||
public OsmPathElementHolder nextHolder;
|
||||
}
|
||||
|
||||
public ArrayList<OsmPathElement> nodes = new ArrayList<OsmPathElement>();
|
||||
public List<OsmPathElement> nodes = new ArrayList<OsmPathElement>();
|
||||
|
||||
private CompactLongMap<OsmPathElementHolder> nodesMap;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public final class OsmTrack {
|
|||
private VoiceHintList voiceHints;
|
||||
|
||||
public String message = null;
|
||||
public ArrayList<String> messageList = null;
|
||||
public List<String> messageList = null;
|
||||
|
||||
public String name = "unset";
|
||||
|
||||
|
@ -113,7 +113,7 @@ public final class OsmTrack {
|
|||
nodesMap = new FrozenLongMap<OsmPathElementHolder>(nodesMap);
|
||||
}
|
||||
|
||||
private ArrayList<String> aggregateMessages() {
|
||||
private List<String> aggregateMessages() {
|
||||
ArrayList<String> res = new ArrayList<String>();
|
||||
MessageData current = null;
|
||||
for (OsmPathElement n : nodes) {
|
||||
|
@ -135,7 +135,7 @@ public final class OsmTrack {
|
|||
return res;
|
||||
}
|
||||
|
||||
private ArrayList<String> aggregateSpeedProfile() {
|
||||
private List<String> aggregateSpeedProfile() {
|
||||
ArrayList<String> res = new ArrayList<String>();
|
||||
int vmax = -1;
|
||||
int vmaxe = -1;
|
||||
|
@ -673,7 +673,7 @@ public final class OsmTrack {
|
|||
}
|
||||
if (showSpeedProfile) // set in profile
|
||||
{
|
||||
ArrayList<String> sp = aggregateSpeedProfile();
|
||||
List<String> sp = aggregateSpeedProfile();
|
||||
if (sp.size() > 0) {
|
||||
sb.append(" \"speedprofile\": [\n");
|
||||
for (int i = sp.size() - 1; i >= 0; i--) {
|
||||
|
|
|
@ -1078,7 +1078,7 @@ public class RoutingEngine extends Thread {
|
|||
|
||||
synchronized (openSet) {
|
||||
if (guideTrack != null) {
|
||||
ArrayList<OsmPathElement> nodes = guideTrack.nodes;
|
||||
List<OsmPathElement> nodes = guideTrack.nodes;
|
||||
int[] res = new int[nodes.size() * 2];
|
||||
int i = 0;
|
||||
for (OsmPathElement n : nodes) {
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
package btools.router;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VoiceHintList {
|
||||
private String transportMode;
|
||||
int turnInstructionMode;
|
||||
ArrayList<VoiceHint> list = new ArrayList<VoiceHint>();
|
||||
List<VoiceHint> list = new ArrayList<VoiceHint>();
|
||||
|
||||
public void setTransportMode(boolean isCar, boolean isBike) {
|
||||
transportMode = isCar ? "car" : (isBike ? "bike" : "foot");
|
||||
|
|
|
@ -37,9 +37,9 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
|||
public String _modelClass;
|
||||
|
||||
private Map<String, Integer> lookupNumbers = new HashMap<String, Integer>();
|
||||
private ArrayList<BExpressionLookupValue[]> lookupValues = new ArrayList<BExpressionLookupValue[]>();
|
||||
private ArrayList<String> lookupNames = new ArrayList<String>();
|
||||
private ArrayList<int[]> lookupHistograms = new ArrayList<int[]>();
|
||||
private List<BExpressionLookupValue[]> lookupValues = new ArrayList<BExpressionLookupValue[]>();
|
||||
private List<String> lookupNames = new ArrayList<String>();
|
||||
private List<int[]> lookupHistograms = new ArrayList<int[]>();
|
||||
private boolean[] lookupIdxUsed;
|
||||
|
||||
private boolean lookupDataFrozen = false;
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
package btools.expressions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
final class BExpressionLookupValue {
|
||||
String value;
|
||||
ArrayList<String> aliases;
|
||||
List<String> aliases;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.io.BufferedReader;
|
|||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public final class BExpressionMetaData {
|
||||
|
@ -21,7 +22,7 @@ public final class BExpressionMetaData {
|
|||
public short lookupVersion = -1;
|
||||
public short lookupMinorVersion = -1;
|
||||
|
||||
private HashMap<String, BExpressionContext> listeners = new HashMap<String, BExpressionContext>();
|
||||
private Map<String, BExpressionContext> listeners = new HashMap<String, BExpressionContext>();
|
||||
|
||||
public void registerListener(String context, BExpressionContext ctx) {
|
||||
listeners.put(context, ctx);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
package btools.mapcreator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import btools.util.CheapRuler;
|
||||
|
||||
|
@ -15,7 +15,7 @@ public class DPFilter {
|
|||
/*
|
||||
* for each node (except first+last), eventually set the DP_SURVIVOR_BIT
|
||||
*/
|
||||
public static void doDPFilter(ArrayList<OsmNodeP> nodes) {
|
||||
public static void doDPFilter(List<OsmNodeP> nodes) {
|
||||
int first = 0;
|
||||
int last = nodes.size() - 1;
|
||||
while (first < last && (nodes.get(first + 1).bits & OsmNodeP.DP_SURVIVOR_BIT) != 0) {
|
||||
|
@ -30,7 +30,7 @@ public class DPFilter {
|
|||
}
|
||||
|
||||
|
||||
public static void doDPFilter(ArrayList<OsmNodeP> nodes, int first, int last) {
|
||||
public static void doDPFilter(List<OsmNodeP> nodes, int first, int last) {
|
||||
double maxSqDist = -1.;
|
||||
int index = -1;
|
||||
OsmNodeP p1 = nodes.get(first);
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.io.FileInputStream;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.util.DiffCoderDataOutputStream;
|
||||
|
||||
|
@ -21,7 +22,7 @@ public abstract class MapCreatorBase implements WayListener, NodeListener, Relat
|
|||
private DiffCoderDataOutputStream[] tileOutStreams;
|
||||
protected File outTileDir;
|
||||
|
||||
protected HashMap<String, String> tags;
|
||||
protected Map<String, String> tags;
|
||||
|
||||
public void putTag(String key, String value) {
|
||||
if (tags == null) tags = new HashMap<String, String>();
|
||||
|
@ -32,11 +33,11 @@ public abstract class MapCreatorBase implements WayListener, NodeListener, Relat
|
|||
return tags == null ? null : tags.get(key);
|
||||
}
|
||||
|
||||
public HashMap<String, String> getTagsOrNull() {
|
||||
public Map<String, String> getTagsOrNull() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(HashMap<String, String> tags) {
|
||||
public void setTags(Map<String, String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.io.BufferedOutputStream;
|
|||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.expressions.BExpressionContextNode;
|
||||
|
@ -142,7 +142,7 @@ public class OsmCutter extends MapCreatorBase {
|
|||
}
|
||||
|
||||
|
||||
private void generatePseudoTags(HashMap<String, String> map) {
|
||||
private void generatePseudoTags(Map<String, String> map) {
|
||||
// add pseudo.tags for concrete:lanes and concrete:plates
|
||||
|
||||
String concrete = null;
|
||||
|
@ -204,7 +204,7 @@ public class OsmCutter extends MapCreatorBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void nextRelation(RelationData r) throws Exception {
|
||||
public void nextRelation(RelationData r) throws IOException {
|
||||
relsParsed++;
|
||||
checkStats();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.io.File;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import btools.expressions.BExpressionContextWay;
|
||||
import btools.util.CheapRuler;
|
||||
|
@ -188,7 +188,7 @@ public class OsmTrafficMap {
|
|||
return map.get(n);
|
||||
}
|
||||
|
||||
public byte[] addTrafficClass(ArrayList<OsmNodeP> linkNodes, byte[] description) throws IOException {
|
||||
public byte[] addTrafficClass(List<OsmNodeP> linkNodes, byte[] description) throws IOException {
|
||||
double distance = 0.;
|
||||
double sum = 0.;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.io.File;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.util.CompactLongSet;
|
||||
import btools.util.DiffCoderDataOutputStream;
|
||||
|
@ -26,7 +27,7 @@ public class PosUnifier extends MapCreatorBase {
|
|||
private File nodeTilesOut;
|
||||
private CompactLongSet[] positionSets;
|
||||
|
||||
private HashMap<String, SrtmRaster> srtmmap;
|
||||
private Map<String, SrtmRaster> srtmmap;
|
||||
private int lastSrtmLonIdx;
|
||||
private int lastSrtmLatIdx;
|
||||
private SrtmRaster lastSrtmRaster;
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.io.DataOutputStream;
|
|||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.expressions.BExpressionContextWay;
|
||||
import btools.expressions.BExpressionMetaData;
|
||||
|
@ -19,7 +20,7 @@ import btools.util.FrozenLongSet;
|
|||
* @author ab
|
||||
*/
|
||||
public class RelationMerger extends MapCreatorBase {
|
||||
private HashMap<String, CompactLongSet> routesets;
|
||||
private Map<String, CompactLongSet> routesets;
|
||||
private CompactLongSet routesetall;
|
||||
private BExpressionContextWay expctxReport;
|
||||
private BExpressionContextWay expctxCheck;
|
||||
|
|
|
@ -6,6 +6,8 @@ import java.io.DataOutputStream;
|
|||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import btools.util.CheapAngleMeter;
|
||||
|
@ -35,8 +37,8 @@ public class RestrictionData extends MapCreatorBase {
|
|||
|
||||
public boolean badWayMatch;
|
||||
|
||||
private static HashMap<String, String> names = new HashMap<>();
|
||||
private static TreeSet<Long> badTRs = new TreeSet<>();
|
||||
private static Map<String, String> names = new HashMap<>();
|
||||
private static Set<Long> badTRs = new TreeSet<>();
|
||||
|
||||
public RestrictionData() {
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.codec.DataBuffers;
|
||||
import btools.codec.MicroCache;
|
||||
|
@ -26,7 +27,7 @@ public final class NodesCache {
|
|||
private boolean forceSecondaryData;
|
||||
private String currentFileName;
|
||||
|
||||
private HashMap<String, PhysicalFile> fileCache;
|
||||
private Map<String, PhysicalFile> fileCache;
|
||||
private DataBuffers dataBuffers;
|
||||
|
||||
private OsmFile[][] fileRows;
|
||||
|
|
|
@ -7,11 +7,13 @@ package btools.mapaccess;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.util.ByteArrayUnifier;
|
||||
|
||||
public final class OsmNodesMap {
|
||||
private HashMap<OsmNode, OsmNode> hmap = new HashMap<OsmNode, OsmNode>(4096);
|
||||
private Map<OsmNode, OsmNode> hmap = new HashMap<OsmNode, OsmNode>(4096);
|
||||
|
||||
private ByteArrayUnifier abUnifier = new ByteArrayUnifier(16384, false);
|
||||
|
||||
|
@ -122,11 +124,7 @@ public final class OsmNodesMap {
|
|||
return total <= currentmaxmem;
|
||||
}
|
||||
|
||||
private void addActiveNode(ArrayList<OsmNode> nodes2check, OsmNode n) {
|
||||
n.visitID = lastVisitID;
|
||||
nodesCreated++;
|
||||
nodes2check.add(n);
|
||||
}
|
||||
private List<OsmNode> nodes2check;
|
||||
|
||||
// is there an escape from this node
|
||||
// to a hollow node (or destination node) ?
|
||||
|
@ -169,7 +167,11 @@ public final class OsmNodesMap {
|
|||
return false;
|
||||
}
|
||||
|
||||
private ArrayList<OsmNode> nodes2check;
|
||||
private void addActiveNode(List<OsmNode> nodes2check, OsmNode n) {
|
||||
n.visitID = lastVisitID;
|
||||
nodesCreated++;
|
||||
nodes2check.add(n);
|
||||
}
|
||||
|
||||
public void clearTemp() {
|
||||
nodes2check = null;
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
|||
|
||||
public class IpAccessMonitor {
|
||||
private static Object sync = new Object();
|
||||
private static HashMap<String, Long> ipAccess = new HashMap<String, Long>();
|
||||
private static Map<String, Long> ipAccess = new HashMap<String, Long>();
|
||||
private static long MAX_IDLE = 900000; // 15 minutes
|
||||
private static long CLEANUP_INTERVAL = 10000; // 10 seconds
|
||||
private static long lastCleanup;
|
||||
|
|
|
@ -146,7 +146,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
|||
}
|
||||
|
||||
String url = getline.split(" ")[1];
|
||||
HashMap<String, String> params = getUrlParams(url);
|
||||
Map<String, String> params = getUrlParams(url);
|
||||
|
||||
long maxRunningTime = getMaxRunningTime();
|
||||
|
||||
|
@ -359,7 +359,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
|||
}
|
||||
|
||||
|
||||
private static HashMap<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>();
|
||||
String decoded = URLDecoder.decode(url, "UTF-8");
|
||||
StringTokenizer tk = new StringTokenizer(decoded, "?&");
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.io.IOException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeSet;
|
||||
|
||||
|
@ -581,7 +582,7 @@ public class SuspectManager extends Thread {
|
|||
}
|
||||
}
|
||||
|
||||
private static HashMap<String, SuspectList> allSuspectsMap = new HashMap<String, SuspectList>();
|
||||
private static Map<String, SuspectList> allSuspectsMap = new HashMap<String, SuspectList>();
|
||||
|
||||
private static SuspectList getDailySuspectsIfLoaded() throws IOException {
|
||||
synchronized (allSuspectsMap) {
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.io.BufferedWriter;
|
|||
import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import btools.router.OsmNodeNamed;
|
||||
import btools.router.OsmNogoPolygon;
|
||||
|
@ -36,7 +36,7 @@ public class ServerHandler extends RequestHandler {
|
|||
|
||||
private RoutingContext rc;
|
||||
|
||||
public ServerHandler(ServiceContext serviceContext, HashMap<String, String> params) {
|
||||
public ServerHandler(ServiceContext serviceContext, Map<String, String> params) {
|
||||
super(serviceContext, params);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package btools.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Memory efficient Map to map a long-key to an object-value
|
||||
|
@ -243,7 +243,7 @@ public class CompactLongMap<V> {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected void moveToFrozenArrays(long[] faid, ArrayList<V> flv) {
|
||||
protected void moveToFrozenArrays(long[] faid, List<V> flv) {
|
||||
for (int i = 1; i < MAXLISTS; i++) {
|
||||
pa[i] = 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package btools.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Special Memory efficient Map to map a long-key to
|
||||
|
@ -16,7 +17,7 @@ import java.util.ArrayList;
|
|||
* @author ab
|
||||
*/
|
||||
public class DenseLongMap {
|
||||
private ArrayList<byte[]> blocklist = new ArrayList<byte[]>(4096);
|
||||
private List<byte[]> blocklist = new ArrayList<byte[]>(4096);
|
||||
|
||||
private int blocksize; // bytes per bitplane in one block
|
||||
private int blocksizeBits;
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||
*/
|
||||
public class FrozenLongMap<V> extends CompactLongMap<V> {
|
||||
private long[] faid;
|
||||
private ArrayList<V> flv;
|
||||
private List<V> flv;
|
||||
private int size = 0;
|
||||
private int p2size; // next power of 2 of size
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package btools.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Behaves like an Array of list
|
||||
|
@ -10,7 +10,7 @@ import java.util.ArrayList;
|
|||
* @author ab
|
||||
*/
|
||||
public class LazyArrayOfLists<E> {
|
||||
private ArrayList<ArrayList<E>> lists;
|
||||
private List<ArrayList<E>> lists;
|
||||
|
||||
public LazyArrayOfLists(int size) {
|
||||
lists = new ArrayList<ArrayList<E>>(size);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
<exclude name="ForLoopCanBeForeach" />
|
||||
<exclude name="LiteralsFirstInComparisons" />
|
||||
<exclude name="LogicInversion" />
|
||||
<exclude name="LooseCoupling" />
|
||||
<exclude name="MissingOverride" />
|
||||
<exclude name="OneDeclarationPerLine" />
|
||||
<exclude name="OverrideBothEqualsAndHashcode" />
|
||||
|
|
Loading…
Reference in a new issue