# Changeset 9062 in josm for trunk/src/org/openstreetmap/josm/tools

Ignore:
Timestamp:
2015-11-25T01:21:14+01:00 (7 years ago)
Message:

Sonar - squid:S1941 - Variables should not be declared before they are relevant

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
6 edited

Unmodified
Removed
• ## trunk/src/org/openstreetmap/josm/tools/Geometry.java

 r9059 double a2 = p4.getY() - p3.getY(); double b2 = p3.getX() - p4.getX(); double c2 = (p4.getX() - p1.getX()) * (p3.getY() - p1.getY()) - (p3.getX() - p1.getX()) * (p4.getY() - p1.getY()); // Solve the equations if (det == 0) return null; // Lines are parallel double c2 = (p4.getX() - p1.getX()) * (p3.getY() - p1.getY()) - (p3.getX() - p1.getX()) * (p4.getY() - p1.getY()); return new EastNorth(b1 * c2 / det + p1.getX(), -a1 * c2 / det + p1.getY()); return false; //iterate each side of the polygon, start with the last segment Node oldPoint = polygonNodes.get(polygonNodes.size() - 1); if (!oldPoint.isLatLonKnown()) { return false; } boolean inside = false; Node p1, p2; //iterate each side of the polygon, start with the last segment Node oldPoint = polygonNodes.get(polygonNodes.size() - 1); if (!oldPoint.isLatLonKnown()) { return false; } for (Node newPoint : polygonNodes) { */ public static boolean isClockwise(List nodes) { double area2 = 0.; int nodesCount = nodes.size(); if (nodesCount < 3 || nodes.get(0) != nodes.get(nodesCount - 1)) { throw new IllegalArgumentException("Way must be closed to check orientation."); } double area2 = 0.; for (int node = 1; node <= /*sic! consider last-first as well*/ nodesCount; node++) {
• ## trunk/src/org/openstreetmap/josm/tools/I18n.java

 r8989 } String[] enstrings = new String[ennum]; String[] trstrings = new String[trnum]; for (int i = 0; i < ennum; ++i) { int val = ens.read(enlen); enstrings[i] = new String(str, 0, val, StandardCharsets.UTF_8); } String[] trstrings = new String[trnum]; for (int i = 0; i < trnum; ++i) { int val = trs.read(trlen);
• ## trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

 r8992 Matcher m = dataUrlPattern.matcher(url); if (m.matches()) { String mediatype = m.group(1); String base64 = m.group(2); String data = m.group(3); } } String mediatype = m.group(1); if ("image/svg+xml".equals(mediatype)) { String s = new String(bytes, StandardCharsets.UTF_8);
• ## trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

 r8846 } int zoom; double lat, lon; try { zoom = Integer.parseInt(parts[0]); return null; } double lat, lon; try { lat = Double.parseDouble(parts[1]);
• ## trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java

 r8924 */ public static WindowGeometry centerInWindow(Component reference, Dimension extent) { Window parentWindow = null; while (reference != null && !(reference instanceof Window)) { reference = reference.getParent(); if (reference == null) return new WindowGeometry(new Point(0, 0), extent); parentWindow = (Window) reference; Window parentWindow = (Window) reference; Point topLeft = new Point( Math.max(0, (parentWindow.getSize().width - extent.width) /2),
• ## trunk/src/org/openstreetmap/josm/tools/date/PrimaryDateParser.java

 r8870 private static boolean isDateInShortStandardFormat(String date) { char[] dateChars; // We can only parse the date if it is in a very specific format. // eg. 2007-09-23T08:25:43Z } dateChars = date.toCharArray(); char[] dateChars = date.toCharArray(); // Make sure any fixed characters are in the correct place. private static boolean isDateInLongStandardFormat(String date) { char[] dateChars; // We can only parse the date if it is in a very specific format. // eg. 2007-09-23T08:25:43.000Z } dateChars = date.toCharArray(); char[] dateChars = date.toCharArray(); // Make sure any fixed characters are in the correct place.
Note: See TracChangeset for help on using the changeset viewer.