diff --git a/brouter/src/main/java/slash/navigation/brouter/BRouter.java b/brouter/src/main/java/slash/navigation/brouter/BRouter.java index a840d51339..a9c422b60d 100644 --- a/brouter/src/main/java/slash/navigation/brouter/BRouter.java +++ b/brouter/src/main/java/slash/navigation/brouter/BRouter.java @@ -226,7 +226,7 @@ protected void second(int second) { } if (!profile.exists()) { List availableTravelModes = getAvailableTravelModes(); - if (availableTravelModes.size() == 0) { + if (availableTravelModes.isEmpty()) { log.warning(format("Cannot route between %s and %s: no travel modes found in %s", from, to, getProfilesDirectory())); return new RoutingResult(asList(from, to), new DistanceAndTime(calculateBearing(from.getLongitude(), from.getLatitude(), to.getLongitude(), to.getLatitude()).getDistance(), null), Invalid); } diff --git a/brouter/src/test/java/slash/navigation/brouter/BRouterTest.java b/brouter/src/test/java/slash/navigation/brouter/BRouterTest.java index 89b161ace2..88366023e6 100644 --- a/brouter/src/test/java/slash/navigation/brouter/BRouterTest.java +++ b/brouter/src/test/java/slash/navigation/brouter/BRouterTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.assertEquals; public class BRouterTest { - private BRouter router = new BRouter(null); + private final BRouter router = new BRouter(null); @Test public void testLongitude() { diff --git a/browser-mapview/src/main/java/slash/navigation/mapview/browser/BrowserMapView.java b/browser-mapview/src/main/java/slash/navigation/mapview/browser/BrowserMapView.java index 4942d44181..ad56aa9893 100644 --- a/browser-mapview/src/main/java/slash/navigation/mapview/browser/BrowserMapView.java +++ b/browser-mapview/src/main/java/slash/navigation/mapview/browser/BrowserMapView.java @@ -452,7 +452,7 @@ public void componentHidden(ComponentEvent e) { List render = new ArrayList<>(positionReducer.reduceSelectedPositions(copiedPositions, copiedSelectedPositionIndices)); render.addAll(selectedPositions); - NavigationPosition centerPosition = render.size() > 0 ? new BoundingBox(render).getCenter() : null; + NavigationPosition centerPosition = !render.isEmpty() ? new BoundingBox(render).getCenter() : null; selectPositions(render, recenter ? centerPosition : null); log.info("Selected positions updated for " + render.size() + " positions, reason: " + selectionUpdateReason + ", recentering: " + recenter + " to: " + centerPosition); @@ -491,13 +491,11 @@ protected void initializeCallbackListener() { try { final Socket socket = callbackListenerServerSocket.accept(); - executor.execute(new Runnable() { - public void run() { - try { - processStream(socket); - } catch (IOException e) { - log.severe(format("Cannot process stream from callback listener socket: %s, %s ", e, printStackTrace(e))); - } + executor.execute(() -> { + try { + processStream(socket); + } catch (IOException e) { + log.severe(format("Cannot process stream from callback listener socket: %s, %s ", e, printStackTrace(e))); } }); } catch (SocketTimeoutException e) { @@ -581,42 +579,40 @@ public void receivedCallback(int port) { } }; - executor.execute(new Runnable() { - public void run() { - addMapViewListener(callbackWaiter); - try { - executeScript("checkCallbackListenerPort();"); - - long start = currentTimeMillis(); - while (true) { - synchronized (receivedCallback) { - if (receivedCallback[0]) { - long end = currentTimeMillis(); - log.info("Received callback from browser after " + (end - start) + " milliseconds"); - break; - } - } + executor.execute(() -> { + addMapViewListener(callbackWaiter); + try { + executeScript("checkCallbackListenerPort();"); - if (start + 5000 < currentTimeMillis()) + long start = currentTimeMillis(); + while (true) { + synchronized (receivedCallback) { + if (receivedCallback[0]) { + long end = currentTimeMillis(); + log.info("Received callback from browser after " + (end - start) + " milliseconds"); break; - - try { - sleep(50); - } catch (InterruptedException e) { - // intentionally left empty } } - synchronized (receivedCallback) { - if (!receivedCallback[0]) { - setCallbackListenerPort(-1); - initializeCallbackPoller(); - log.warning("Switched from callback to polling the browser"); - } + if (start + 5000 < currentTimeMillis()) + break; + + try { + sleep(50); + } catch (InterruptedException e) { + // intentionally left empty + } + } + + synchronized (receivedCallback) { + if (!receivedCallback[0]) { + setCallbackListenerPort(-1); + initializeCallbackPoller(); + log.warning("Switched from callback to polling the browser"); } - } finally { - removeMapViewListener(callbackWaiter); } + } finally { + removeMapViewListener(callbackWaiter); } }); } @@ -643,7 +639,7 @@ private String registerMaps(List tileServers) { String apiKey = APIKeyRegistry.getInstance().getAPIKey("thunderforest", "map"); for (TileServer tileServer : tileServers) { - if (!tileServer.isActive() || tileServer.getHosts().size() == 0) + if (!tileServer.isActive() || tileServer.getHosts().isEmpty()) continue; String copyright = tileServer.getCopyright().toLowerCase(); @@ -861,7 +857,7 @@ public void setSelectedPositions(List selectedPositions) { synchronized (notificationMutex) { this.selectedPositions = selectedPositions; this.selectedPositionIndices = new int[0]; - haveToRecenterMap = selectedPositions.size() > 0; + haveToRecenterMap = !selectedPositions.isEmpty(); haveToRepaintSelection = true; selectionUpdateReason = "selected " + selectedPositions.size() + " positions without model"; notificationMutex.notifyAll(); @@ -1153,7 +1149,7 @@ private void addMarkersToMap(List positions) { private void setCenterOfMap(List positions, boolean recenter) { StringBuilder buffer = new StringBuilder(); - boolean fitBoundsToPositions = positions.size() > 0 && recenter; + boolean fitBoundsToPositions = !positions.isEmpty() && recenter; if (fitBoundsToPositions) { BoundingBox boundingBox = new BoundingBox(positions); buffer.append("fitBounds(new google.maps.LatLng(").append(asCoordinates(boundingBox.getSouthWest())).append("),"). @@ -1164,7 +1160,7 @@ private void setCenterOfMap(List positions, boolean recenter if (haveToInitializeMapOnFirstStart) { NavigationPosition center; // if there are positions right at the start center on them else take the last known center and zoom - if (positions.size() > 0) { + if (!positions.isEmpty()) { center = new BoundingBox(positions).getCenter(); } else { int zoom = getZoom(); @@ -1754,7 +1750,7 @@ private void insertPosition(int row, Double longitude, Double latitude) { } private int getAddRow() { - NavigationPosition position = lastSelectedPositions.size() > 0 ? lastSelectedPositions.get(lastSelectedPositions.size() - 1) : null; + NavigationPosition position = !lastSelectedPositions.isEmpty() ? lastSelectedPositions.get(lastSelectedPositions.size() - 1) : null; // quite crude logic to be as robust as possible on failures if (position == null && positionsModel.getRowCount() > 0) position = positionsModel.getPosition(positionsModel.getRowCount() - 1); diff --git a/browser-mapview/src/test/java/slash/navigation/mapview/browser/PositionReducerTest.java b/browser-mapview/src/test/java/slash/navigation/mapview/browser/PositionReducerTest.java index 2ae09508ad..5087421ce8 100644 --- a/browser-mapview/src/test/java/slash/navigation/mapview/browser/PositionReducerTest.java +++ b/browser-mapview/src/test/java/slash/navigation/mapview/browser/PositionReducerTest.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertEquals; public class PositionReducerTest { - private PositionReducer reducer = new PositionReducer(new PositionReducer.Callback() { + private final PositionReducer reducer = new PositionReducer(new PositionReducer.Callback() { public int getZoom() { throw new UnsupportedOperationException(); } diff --git a/common-gui/src/main/java/slash/navigation/gui/actions/ActionManager.java b/common-gui/src/main/java/slash/navigation/gui/actions/ActionManager.java index 2f083345b0..d81d1254be 100644 --- a/common-gui/src/main/java/slash/navigation/gui/actions/ActionManager.java +++ b/common-gui/src/main/java/slash/navigation/gui/actions/ActionManager.java @@ -50,8 +50,8 @@ public class ActionManager { private static final Preferences preferences = Preferences.userNodeForPackage(ActionManager.class); private static final String RUN_COUNT_PREFERENCE = "runCount"; - private Map actionMap = new HashMap<>(); - private Map proxyActionMap = new HashMap<>(); + private final Map actionMap = new HashMap<>(); + private final Map proxyActionMap = new HashMap<>(); private String localName; public String getLocalName() { @@ -143,12 +143,12 @@ public void logUsage() { if (runs > 0) builder.append(format("%n%s, runs: %d", actionName, runs)); } - log.info("Action usage:" + builder.toString()); + log.info("Action usage:" + builder); } private static class ProxyAction implements Action, PropertyChangeListener { private Action delegate; - private SwingPropertyChangeSupport changeSupport = new SwingPropertyChangeSupport(this); + private final SwingPropertyChangeSupport changeSupport = new SwingPropertyChangeSupport(this); private ProxyAction() { } diff --git a/common-gui/src/main/java/slash/navigation/gui/events/ContinousRange.java b/common-gui/src/main/java/slash/navigation/gui/events/ContinousRange.java index a44becafe0..7587c065d8 100644 --- a/common-gui/src/main/java/slash/navigation/gui/events/ContinousRange.java +++ b/common-gui/src/main/java/slash/navigation/gui/events/ContinousRange.java @@ -64,7 +64,7 @@ private void perform(List> ranges) { if (operation.isInterrupted()) return; } - if (range.size() == 0) + if (range.isEmpty()) continue; int firstValue = range.get(0); int lastValue = range.get(range.size() - 1); diff --git a/common-gui/src/main/java/slash/navigation/gui/events/Range.java b/common-gui/src/main/java/slash/navigation/gui/events/Range.java index fcff2ab315..c3cba4ed10 100644 --- a/common-gui/src/main/java/slash/navigation/gui/events/Range.java +++ b/common-gui/src/main/java/slash/navigation/gui/events/Range.java @@ -52,7 +52,7 @@ public static List> asContinuousMonotonicallyIncreasingRanges(int[ List> result = new ArrayList<>(); List range = new ArrayList<>(); for (int index : indices) { - if ((range.size() == 0 || index == range.get(range.size() - 1) + 1) && range.size() < maximumRangeLength) { + if ((range.isEmpty() || index == range.get(range.size() - 1) + 1) && range.size() < maximumRangeLength) { range.add(index); } else { result.add(range); @@ -69,7 +69,7 @@ public static List> asContinuousMonotonicallyDecreasingRanges(int[ List> result = new ArrayList<>(); List range = new ArrayList<>(); for (int index : indices) { - if (range.size() == 0 || index == range.get(range.size() - 1) - 1) { + if (range.isEmpty() || index == range.get(range.size() - 1) - 1) { range.add(index); } else { result.add(range); diff --git a/common-gui/src/main/java/slash/navigation/gui/helpers/JMenuHelper.java b/common-gui/src/main/java/slash/navigation/gui/helpers/JMenuHelper.java index 46ceb1e46c..34f97d3413 100644 --- a/common-gui/src/main/java/slash/navigation/gui/helpers/JMenuHelper.java +++ b/common-gui/src/main/java/slash/navigation/gui/helpers/JMenuHelper.java @@ -53,7 +53,7 @@ public static JMenu createMenu(String name) { JMenu menu = new JMenu(getString(name + "-menu")); menu.setName(name); String mnemonic = getOptionalString(name + "-menu-mnemonic"); - if (mnemonic != null && mnemonic.length() > 0) + if (mnemonic != null && !mnemonic.isEmpty()) menu.setMnemonic(mnemonic.charAt(0)); return menu; } @@ -89,7 +89,7 @@ private static void setMnemonic(AbstractButton item, char mnemonic) { public static void setMnemonic(AbstractButton button, String key) { String mnemonic = getOptionalString(key); - if (mnemonic != null && mnemonic.length() > 0) + if (mnemonic != null && !mnemonic.isEmpty()) setMnemonic(button, mnemonic.charAt(0)); } diff --git a/common-gui/src/main/java/slash/navigation/gui/notifications/NotificationManager.java b/common-gui/src/main/java/slash/navigation/gui/notifications/NotificationManager.java index fceb74a706..fd20819d15 100644 --- a/common-gui/src/main/java/slash/navigation/gui/notifications/NotificationManager.java +++ b/common-gui/src/main/java/slash/navigation/gui/notifications/NotificationManager.java @@ -45,8 +45,8 @@ public class NotificationManager { private static final int DISPLAY_TIMEOUT = 2 * 1000; - private JWindow window; - private JLabel label = new JLabel(); + private final JWindow window; + private final JLabel label = new JLabel(); private static final Object notificationMutex = new Object(); private boolean running = true; diff --git a/common-navigation/src/main/java/slash/navigation/common/Bearing.java b/common-navigation/src/main/java/slash/navigation/common/Bearing.java index 50c2ee2616..a93b7da2ba 100644 --- a/common-navigation/src/main/java/slash/navigation/common/Bearing.java +++ b/common-navigation/src/main/java/slash/navigation/common/Bearing.java @@ -39,17 +39,17 @@ public class Bearing { /** * the azimuth, degrees, 0 = north, clockwise positive */ - private double azimuth; + private final double azimuth; /** * the back azimuth, degrees, 0 = north, clockwise positive */ - private double backazimuth; + private final double backazimuth; /** * separation in meters */ - private double distance; + private final double distance; /** * Earth radius in meters diff --git a/common-navigation/src/main/java/slash/navigation/common/BoundingBox.java b/common-navigation/src/main/java/slash/navigation/common/BoundingBox.java index 619d0bf32f..013e5154d0 100644 --- a/common-navigation/src/main/java/slash/navigation/common/BoundingBox.java +++ b/common-navigation/src/main/java/slash/navigation/common/BoundingBox.java @@ -24,6 +24,7 @@ import slash.common.type.CompactCalendar; import java.util.List; +import java.util.Objects; import static java.lang.Math.abs; import static slash.common.type.CompactCalendar.fromMillis; @@ -135,8 +136,8 @@ public boolean equals(Object o) { BoundingBox that = (BoundingBox) o; - return !(northEast != null ? !northEast.equals(that.northEast) : that.northEast != null) && - !(southWest != null ? !southWest.equals(that.southWest) : that.southWest != null); + return !(!Objects.equals(northEast, that.northEast)) && + !(!Objects.equals(southWest, that.southWest)); } public int hashCode() { diff --git a/common-navigation/src/main/java/slash/navigation/common/Orientation.java b/common-navigation/src/main/java/slash/navigation/common/Orientation.java index 409e7e3442..75d25cc770 100644 --- a/common-navigation/src/main/java/slash/navigation/common/Orientation.java +++ b/common-navigation/src/main/java/slash/navigation/common/Orientation.java @@ -34,7 +34,7 @@ public enum Orientation { West("W"), East("E"); - private String value; + private final String value; Orientation(String value) { this.value = value; diff --git a/common-navigation/src/main/java/slash/navigation/common/SimpleNavigationPosition.java b/common-navigation/src/main/java/slash/navigation/common/SimpleNavigationPosition.java index 8b80a288fc..3298775570 100644 --- a/common-navigation/src/main/java/slash/navigation/common/SimpleNavigationPosition.java +++ b/common-navigation/src/main/java/slash/navigation/common/SimpleNavigationPosition.java @@ -21,6 +21,8 @@ import slash.common.type.CompactCalendar; +import java.util.Objects; + /** * A navigation position that supports just longitude, latitude, elevation, description and time. * @@ -142,12 +144,12 @@ public boolean equals(Object o) { SimpleNavigationPosition that = (SimpleNavigationPosition) o; - return !(description != null ? !description.equals(that.description) : that.description != null) && - !(speed != null ? !speed.equals(that.speed) : that.speed != null) && - !(elevation != null ? !elevation.equals(that.elevation) : that.elevation != null) && - !(latitude != null ? !latitude.equals(that.latitude) : that.latitude != null) && - !(longitude != null ? !longitude.equals(that.longitude) : that.longitude != null) && - !(time != null ? !time.equals(that.time) : that.time != null); + return !(!Objects.equals(description, that.description)) && + !(!Objects.equals(speed, that.speed)) && + !(!Objects.equals(elevation, that.elevation)) && + !(!Objects.equals(latitude, that.latitude)) && + !(!Objects.equals(longitude, that.longitude)) && + !(!Objects.equals(time, that.time)); } public int hashCode() { diff --git a/common-navigation/src/main/java/slash/navigation/common/ValueAndOrientation.java b/common-navigation/src/main/java/slash/navigation/common/ValueAndOrientation.java index 0f7c639e10..6533d92cd8 100644 --- a/common-navigation/src/main/java/slash/navigation/common/ValueAndOrientation.java +++ b/common-navigation/src/main/java/slash/navigation/common/ValueAndOrientation.java @@ -30,8 +30,8 @@ * @author Christian Pesch */ public class ValueAndOrientation { - private double value; - private Orientation orientation; + private final double value; + private final Orientation orientation; public ValueAndOrientation(double value, Orientation orientation) { this.value = value; diff --git a/common/src/main/java/slash/common/helpers/APIKeyRegistry.java b/common/src/main/java/slash/common/helpers/APIKeyRegistry.java index a77bdf3471..7a7ae945d4 100644 --- a/common/src/main/java/slash/common/helpers/APIKeyRegistry.java +++ b/common/src/main/java/slash/common/helpers/APIKeyRegistry.java @@ -84,7 +84,7 @@ public void logUsage() { String apiKey = getAPIKey(serviceName, "usage"); if (apiKey != null) - log.info(serviceName + " API key: " + apiKey + " usage:" + builder.toString()); + log.info(serviceName + " API key: " + apiKey + " usage:" + builder); } } catch (BackingStoreException e) { diff --git a/common/src/main/java/slash/common/helpers/JAXBHelper.java b/common/src/main/java/slash/common/helpers/JAXBHelper.java index b37f8ab79a..326620e607 100644 --- a/common/src/main/java/slash/common/helpers/JAXBHelper.java +++ b/common/src/main/java/slash/common/helpers/JAXBHelper.java @@ -40,7 +40,7 @@ public class JAXBHelper { private static final String HEADER_LINE = "\n\n"; private static final String JAXB_IMPL_HEADER = "com.sun.xml.internal.bind.xmlHeaders"; - private static Map>, JAXBContext> classesToContext = new HashMap<>(); + private static final Map>, JAXBContext> classesToContext = new HashMap<>(); private static boolean cacheContexts; public static void setCacheContexts(boolean cacheContexts) { diff --git a/common/src/main/java/slash/common/helpers/ThreadHelper.java b/common/src/main/java/slash/common/helpers/ThreadHelper.java index 0044f3caaf..6e81a00639 100644 --- a/common/src/main/java/slash/common/helpers/ThreadHelper.java +++ b/common/src/main/java/slash/common/helpers/ThreadHelper.java @@ -57,7 +57,7 @@ public static ExecutorService createSingleThreadExecutor(String namePrefix) { } private static class NamedThreadFactory implements ThreadFactory { - private String namePrefix; + private final String namePrefix; private int number = 1; private NamedThreadFactory(String namePrefix) { diff --git a/common/src/main/java/slash/common/helpers/TimeZoneAndId.java b/common/src/main/java/slash/common/helpers/TimeZoneAndId.java index 5d23be5511..feb4ed71b5 100644 --- a/common/src/main/java/slash/common/helpers/TimeZoneAndId.java +++ b/common/src/main/java/slash/common/helpers/TimeZoneAndId.java @@ -27,8 +27,8 @@ * @author Christian Pesch */ public class TimeZoneAndId { - private String id; - private TimeZone timeZone; + private final String id; + private final TimeZone timeZone; public TimeZoneAndId(String id, TimeZone timeZone) { this.id = id; diff --git a/common/src/main/java/slash/common/io/NotClosingUnderlyingInputStream.java b/common/src/main/java/slash/common/io/NotClosingUnderlyingInputStream.java index 33d6948c22..19d85eb41b 100644 --- a/common/src/main/java/slash/common/io/NotClosingUnderlyingInputStream.java +++ b/common/src/main/java/slash/common/io/NotClosingUnderlyingInputStream.java @@ -30,7 +30,7 @@ */ public class NotClosingUnderlyingInputStream extends InputStream { - private InputStream delegate; + private final InputStream delegate; public NotClosingUnderlyingInputStream(InputStream delegate) { this.delegate = delegate; diff --git a/common/src/main/java/slash/common/io/TokenReplacingReader.java b/common/src/main/java/slash/common/io/TokenReplacingReader.java index 41c8d3b577..4a50fbfa2d 100644 --- a/common/src/main/java/slash/common/io/TokenReplacingReader.java +++ b/common/src/main/java/slash/common/io/TokenReplacingReader.java @@ -34,9 +34,9 @@ */ public class TokenReplacingReader extends Reader { - private PushbackReader pushbackReader; - private TokenResolver tokenResolver; - private StringBuilder tokenNameBuffer = new StringBuilder(); + private final PushbackReader pushbackReader; + private final TokenResolver tokenResolver; + private final StringBuilder tokenNameBuffer = new StringBuilder(); private String tokenValue; private int tokenValueIndex; @@ -79,7 +79,7 @@ public int read() throws IOException { tokenValue = tokenResolver.resolveToken(tokenNameBuffer.toString()); if (tokenValue == null) - tokenValue = "${" + tokenNameBuffer.toString() + "}"; + tokenValue = "${" + tokenNameBuffer + "}"; // token replaces to empty string else if (tokenValueIndex >= tokenValue.length()) @@ -88,7 +88,7 @@ else if (tokenValueIndex >= tokenValue.length()) return tokenValue.charAt(tokenValueIndex++); } - public int read(char cbuf[], int off, int len) throws IOException { + public int read(char[] cbuf, int off, int len) throws IOException { int charsRead = -1; for (int i = 0; i < len; i++) { int nextChar = read(); diff --git a/common/src/main/java/slash/common/io/Transfer.java b/common/src/main/java/slash/common/io/Transfer.java index 83eaf19d56..91427991a2 100644 --- a/common/src/main/java/slash/common/io/Transfer.java +++ b/common/src/main/java/slash/common/io/Transfer.java @@ -99,7 +99,7 @@ public static String trim(String string) { if (string == null) return null; string = string.trim(); - if (string.length() == 0) + if (string.isEmpty()) return null; else return string; @@ -296,7 +296,7 @@ public static Short parseShort(String string) { } public static boolean isEmpty(String string) { - return string == null || string.length() == 0; + return string == null || string.isEmpty(); } public static boolean isEmpty(Short aShort) { diff --git a/common/src/main/java/slash/common/jarinjar/JarInJarURLStreamHandlerFactory.java b/common/src/main/java/slash/common/jarinjar/JarInJarURLStreamHandlerFactory.java index dc1bef6a6e..a34c06b6ff 100644 --- a/common/src/main/java/slash/common/jarinjar/JarInJarURLStreamHandlerFactory.java +++ b/common/src/main/java/slash/common/jarinjar/JarInJarURLStreamHandlerFactory.java @@ -33,7 +33,7 @@ * @author Christian Pesch, inspired from https://code.google.com/p/entail/source/browse/jarinjarloader/org/eclipse/jdt/internal/jarinjarloader/ */ class JarInJarURLStreamHandlerFactory implements URLStreamHandlerFactory { - private ClassLoader classLoader; + private final ClassLoader classLoader; JarInJarURLStreamHandlerFactory(ClassLoader classLoader) { this.classLoader = classLoader; @@ -44,4 +44,4 @@ public URLStreamHandler createURLStreamHandler(String protocol) { return new JarInJarURLStreamHandler(classLoader); return null; } -} \ No newline at end of file +} diff --git a/common/src/main/java/slash/common/log/LoggingOutputStream.java b/common/src/main/java/slash/common/log/LoggingOutputStream.java index 72bae1482f..670d4fa054 100644 --- a/common/src/main/java/slash/common/log/LoggingOutputStream.java +++ b/common/src/main/java/slash/common/log/LoggingOutputStream.java @@ -34,9 +34,9 @@ */ public class LoggingOutputStream extends ByteArrayOutputStream { - private String lineSeparator = System.getProperty("line.separator"); - private Logger logger; - private Level level; + private final String lineSeparator = System.getProperty("line.separator"); + private final Logger logger; + private final Level level; public LoggingOutputStream(Logger logger, Level level) { super(); @@ -52,11 +52,11 @@ public void flush() throws IOException { super.reset(); // avoid empty records - if (record.length() == 0 || record.equals(lineSeparator)) { + if (record.isEmpty() || record.equals(lineSeparator)) { return; } logger.logp(level, "", "", record); } } -} \ No newline at end of file +} diff --git a/common/src/main/java/slash/common/type/ISO8601.java b/common/src/main/java/slash/common/type/ISO8601.java index 8fecc81300..d8af1b3061 100644 --- a/common/src/main/java/slash/common/type/ISO8601.java +++ b/common/src/main/java/slash/common/type/ISO8601.java @@ -251,7 +251,7 @@ public static String formatDate(Calendar calendar, boolean includeMilliseconds) * calculate year using astronomical system: * year n BCE => astronomical year -n + 1 */ - year = 0 - year + 1; + year = -year + 1; } /* diff --git a/common/src/test/java/slash/common/TestCase.java b/common/src/test/java/slash/common/TestCase.java index 8029126205..ffa9492f6b 100644 --- a/common/src/test/java/slash/common/TestCase.java +++ b/common/src/test/java/slash/common/TestCase.java @@ -37,7 +37,7 @@ public static void assertNotEquals(Object expected, Object was) { } public static void assertNotEquals(String message, Object expected, Object was) { - assertTrue(message, !expected.equals(was)); + assertNotEquals(message, expected, was); } public static void assertDoubleEquals(double expected, double was) { diff --git a/datasource/src/main/java/slash/navigation/datasources/DataSourceManager.java b/datasource/src/main/java/slash/navigation/datasources/DataSourceManager.java index d1d462626e..039642dad4 100644 --- a/datasource/src/main/java/slash/navigation/datasources/DataSourceManager.java +++ b/datasource/src/main/java/slash/navigation/datasources/DataSourceManager.java @@ -97,7 +97,7 @@ private Edition loadEdition(java.io.File file) throws IOException, JAXBException DataSourceService service = loadDataSource(file); List editions = service.getEditions(); - return editions.size() > 0 ? editions.get(0) : null; + return !editions.isEmpty() ? editions.get(0) : null; } private void loadDataSources(List dataSources, java.io.File dataSourceDirectory) throws IOException, JAXBException { diff --git a/download-tools/src/main/java/slash/navigation/download/tools/ScanWebsite.java b/download-tools/src/main/java/slash/navigation/download/tools/ScanWebsite.java index 13aa222996..1ca9743433 100644 --- a/download-tools/src/main/java/slash/navigation/download/tools/ScanWebsite.java +++ b/download-tools/src/main/java/slash/navigation/download/tools/ScanWebsite.java @@ -155,9 +155,9 @@ private void scan() throws IOException, JAXBException { removedUris.removeAll(collectedUris); if (hasDataSourcesServer()) { - if (addedUris.size() > 0) + if (!addedUris.isEmpty()) addUrisInChunks(source, addedUris); - if (removedUris.size() > 0) + if (!removedUris.isEmpty()) removeUris(source, removedUris); } @@ -198,7 +198,7 @@ private void addUrisInChunks(DataSource dataSource, Collection uris) thr } } - if (chunk.size() > 0) + if (!chunk.isEmpty()) addUris(dataSource, chunk); } diff --git a/download-tools/src/main/java/slash/navigation/download/tools/helpers/AnchorFilter.java b/download-tools/src/main/java/slash/navigation/download/tools/helpers/AnchorFilter.java index 58b5fdf0f3..7d4fd03add 100644 --- a/download-tools/src/main/java/slash/navigation/download/tools/helpers/AnchorFilter.java +++ b/download-tools/src/main/java/slash/navigation/download/tools/helpers/AnchorFilter.java @@ -51,7 +51,7 @@ public List filterAnchors(String url, List anchors, Set if (anchor.equals("index.html") || anchor.startsWith("..")) anchor = ""; - if (anchor.length() > 0 && filterExtension(anchor, extensions) && filterIncludes(anchor, includes) && !filterExcludes(anchor, excludes)) + if (!anchor.isEmpty() && filterExtension(anchor, extensions) && filterIncludes(anchor, includes) && !filterExcludes(anchor, excludes)) result.add(anchor); } catch (URISyntaxException e) { log.warning("No valid uri: " + e); diff --git a/download-tools/src/main/java/slash/navigation/download/tools/helpers/DownloadableType.java b/download-tools/src/main/java/slash/navigation/download/tools/helpers/DownloadableType.java index fbf6353328..df6871fed3 100644 --- a/download-tools/src/main/java/slash/navigation/download/tools/helpers/DownloadableType.java +++ b/download-tools/src/main/java/slash/navigation/download/tools/helpers/DownloadableType.java @@ -31,7 +31,7 @@ public enum DownloadableType { Map("map"), Theme("theme"); - private String value; + private final String value; DownloadableType(String value) { this.value = value; diff --git a/download-tools/src/test/java/slash/navigation/download/tools/helpers/AnchorFilterTest.java b/download-tools/src/test/java/slash/navigation/download/tools/helpers/AnchorFilterTest.java index f744aef856..76a20ec380 100644 --- a/download-tools/src/test/java/slash/navigation/download/tools/helpers/AnchorFilterTest.java +++ b/download-tools/src/test/java/slash/navigation/download/tools/helpers/AnchorFilterTest.java @@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals; public class AnchorFilterTest { - private AnchorFilter filter = new AnchorFilter(); + private final AnchorFilter filter = new AnchorFilter(); @Test public void testFilterAbsoluteURLs() { diff --git a/download-tools/src/test/java/slash/navigation/download/tools/helpers/AnchorParserTest.java b/download-tools/src/test/java/slash/navigation/download/tools/helpers/AnchorParserTest.java index 03944c331e..11cf9de34f 100644 --- a/download-tools/src/test/java/slash/navigation/download/tools/helpers/AnchorParserTest.java +++ b/download-tools/src/test/java/slash/navigation/download/tools/helpers/AnchorParserTest.java @@ -27,7 +27,7 @@ import static org.junit.Assert.assertEquals; public class AnchorParserTest { - private AnchorParser parser = new AnchorParser(); + private final AnchorParser parser = new AnchorParser(); @Test public void testParseSingleAnchor() throws IOException { diff --git a/download/src/main/java/slash/navigation/download/Checksum.java b/download/src/main/java/slash/navigation/download/Checksum.java index 26f7a9f12b..2459ddf787 100644 --- a/download/src/main/java/slash/navigation/download/Checksum.java +++ b/download/src/main/java/slash/navigation/download/Checksum.java @@ -25,6 +25,7 @@ import java.io.File; import java.io.IOException; import java.util.List; +import java.util.Objects; import static slash.common.io.Files.generateChecksum; import static slash.common.io.Transfer.roundMillisecondsToSecondPrecision; @@ -85,9 +86,9 @@ public boolean equals(Object o) { Checksum checksum = (Checksum) o; - return !(contentLength != null ? !contentLength.equals(checksum.contentLength) : checksum.contentLength != null) && - !(lastModified != null ? !lastModified.equals(checksum.lastModified) : checksum.lastModified != null) && - !(sha1 != null ? !sha1.equals(checksum.sha1) : checksum.sha1 != null); + return !(!Objects.equals(contentLength, checksum.contentLength)) && + !(!Objects.equals(lastModified, checksum.lastModified)) && + !(!Objects.equals(sha1, checksum.sha1)); } public int hashCode() { diff --git a/download/src/main/java/slash/navigation/download/Download.java b/download/src/main/java/slash/navigation/download/Download.java index 5825767eb6..1d85383273 100644 --- a/download/src/main/java/slash/navigation/download/Download.java +++ b/download/src/main/java/slash/navigation/download/Download.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import static java.io.File.createTempFile; @@ -185,7 +186,7 @@ public boolean equals(Object o) { Download download = (Download) o; - return !(url != null ? !url.equals(download.url) : download.url != null); + return !(!Objects.equals(url, download.url)); } public int hashCode() { diff --git a/download/src/main/java/slash/navigation/download/DownloadManager.java b/download/src/main/java/slash/navigation/download/DownloadManager.java index 759a73b3ab..b3ad1440d6 100644 --- a/download/src/main/java/slash/navigation/download/DownloadManager.java +++ b/download/src/main/java/slash/navigation/download/DownloadManager.java @@ -245,7 +245,7 @@ Download queue(Download download, boolean startExecutor) { throw new IllegalArgumentException(format("Need a directory for extraction but got %s", download.getFile().getFile())); List fragments = download.getFragments(); - if (fragments == null || fragments.size() == 0) + if (fragments == null || fragments.isEmpty()) log.severe("No fragments given for " + download); else for (FileAndChecksum fragmentTarget : fragments) { diff --git a/geonames/src/main/java/slash/navigation/geonames/GeoNamesService.java b/geonames/src/main/java/slash/navigation/geonames/GeoNamesService.java index 2295589dcb..635e99aaef 100644 --- a/geonames/src/main/java/slash/navigation/geonames/GeoNamesService.java +++ b/geonames/src/main/java/slash/navigation/geonames/GeoNamesService.java @@ -168,7 +168,7 @@ private String getNearByFor(String uri, double longitude, double latitude) throw for (Geonames.Geoname geoname : geonames.getGeoname()) { result.add(geoname.getName() + (trim(geoname.getCountryName()) != null ? ", " + geoname.getCountryName() : "")); } - return result.size() > 0 ? result.get(0) : null; + return !result.isEmpty() ? result.get(0) : null; } String getNearByToponymFor(double longitude, double latitude) throws IOException { diff --git a/geonames/src/main/java/slash/navigation/geonames/PostalCode.java b/geonames/src/main/java/slash/navigation/geonames/PostalCode.java index 2a2df35391..9d59a4a820 100644 --- a/geonames/src/main/java/slash/navigation/geonames/PostalCode.java +++ b/geonames/src/main/java/slash/navigation/geonames/PostalCode.java @@ -20,6 +20,8 @@ package slash.navigation.geonames; +import java.util.Objects; + /** * A country code, postal code, place name aggregate returned when accessing the GeoNames.org service. * @@ -41,9 +43,9 @@ public boolean equals(Object o) { PostalCode that = (PostalCode) o; - return !(countryCode != null ? !countryCode.equals(that.countryCode) : that.countryCode != null) && - !(placeName != null ? !placeName.equals(that.placeName) : that.placeName != null) && - !(postalCode != null ? !postalCode.equals(that.postalCode) : that.postalCode != null); + return !(!Objects.equals(countryCode, that.countryCode)) && + !(!Objects.equals(placeName, that.placeName)) && + !(!Objects.equals(postalCode, that.postalCode)); } public int hashCode() { diff --git a/geonames/src/test/java/slash/navigation/geonames/GeoNamesServiceIT.java b/geonames/src/test/java/slash/navigation/geonames/GeoNamesServiceIT.java index 8c249657f0..d9d17efe32 100644 --- a/geonames/src/test/java/slash/navigation/geonames/GeoNamesServiceIT.java +++ b/geonames/src/test/java/slash/navigation/geonames/GeoNamesServiceIT.java @@ -30,7 +30,7 @@ import static org.junit.Assert.*; public class GeoNamesServiceIT { - private GeoNamesService service = new GeoNamesService(); + private final GeoNamesService service = new GeoNamesService(); @Before public void setUp() { diff --git a/googlemaps/src/main/java/slash/navigation/googlemaps/GoogleService.java b/googlemaps/src/main/java/slash/navigation/googlemaps/GoogleService.java index 950b6af445..96500fcd26 100644 --- a/googlemaps/src/main/java/slash/navigation/googlemaps/GoogleService.java +++ b/googlemaps/src/main/java/slash/navigation/googlemaps/GoogleService.java @@ -130,7 +130,7 @@ private String extractClosestLocation(List results, }) .map(GeocodeResponse.Result::getFormattedAddress) .collect(Collectors.toList()); - return locations.size() > 0 ? locations.get(0) : null; + return !locations.isEmpty() ? locations.get(0) : null; } public List getPositionsFor(String address) throws IOException { @@ -174,7 +174,7 @@ public Double getElevationFor(double longitude, double latitude) throws IOExcept String status = elevationResponse.getStatus(); checkForError(url, status); List elevations = extractElevations(elevationResponse.getResult()); - return elevations != null && elevations.size() > 0 ? elevations.get(0) : null; + return elevations != null && !elevations.isEmpty() ? elevations.get(0) : null; } } catch (JAXBException e) { throw new IOException("Cannot unmarshall " + result + ": " + e, e); diff --git a/graphhopper/src/main/java/slash/navigation/graphhopper/DownloadableFinder.java b/graphhopper/src/main/java/slash/navigation/graphhopper/DownloadableFinder.java index ded5189423..ecdd4ba602 100644 --- a/graphhopper/src/main/java/slash/navigation/graphhopper/DownloadableFinder.java +++ b/graphhopper/src/main/java/slash/navigation/graphhopper/DownloadableFinder.java @@ -58,7 +58,7 @@ private List getGraphDescriptorsFor(MapDescriptor mapDescriptor .sorted(new GraphDescriptorComparator()) .collect(toList()); // if there is no other choice use the graphs with the invalid bounding boxes - if(remoteDescriptors.size() == 0) + if(remoteDescriptors.isEmpty()) remoteDescriptors = graphManager.getRemoteGraphDescriptors().stream() .filter(graphDescriptor -> graphDescriptor.matches(mapDescriptor)) .sorted(new GraphDescriptorComparator()) diff --git a/graphhopper/src/main/java/slash/navigation/graphhopper/GraphHopper.java b/graphhopper/src/main/java/slash/navigation/graphhopper/GraphHopper.java index ebc26c9537..9adad49bc6 100644 --- a/graphhopper/src/main/java/slash/navigation/graphhopper/GraphHopper.java +++ b/graphhopper/src/main/java/slash/navigation/graphhopper/GraphHopper.java @@ -207,14 +207,14 @@ protected void second(int second) { String errors = asDialogString(response.getErrors(), false); log.severe(format("Error while routing between %s and %s: %s", from, to, errors)); - boolean pointNotFound = response.getErrors().size() > 0 && response.getErrors().get(0) instanceof PointNotFoundException; + boolean pointNotFound = !response.getErrors().isEmpty() && response.getErrors().get(0) instanceof PointNotFoundException; if (pointNotFound) return new RoutingResult(null, null, PointNotFound); throw new RuntimeException(errors); } PathWrapper best = response.getBest(); - Validity validity = best.getErrors().size() == 0 ? Valid : Invalid; + Validity validity = best.getErrors().isEmpty() ? Valid : Invalid; return new RoutingResult(asPositions(best.getPoints()), new DistanceAndTime(best.getDistance(), best.getTime()), validity); } finally { counter.stop(); diff --git a/hgt/src/main/java/slash/navigation/hgt/ElevationTile.java b/hgt/src/main/java/slash/navigation/hgt/ElevationTile.java index 209f9fe0b4..05fe5a79cd 100644 --- a/hgt/src/main/java/slash/navigation/hgt/ElevationTile.java +++ b/hgt/src/main/java/slash/navigation/hgt/ElevationTile.java @@ -106,19 +106,19 @@ public Double getElevationFor(Double longitude, Double latitude) throws IOExcept int pos; // The index of the elevation into the hgt file pos = (((intervalCount - latitudeIntervalIndex) - 1) * (intervalCount + 1)) + longitudeIntervalIndex; // The index for the left top elevation - file.seek(pos * 2); // We have 16-bit values for elevation, so multiply by 2 + file.seek(pos * 2L); // We have 16-bit values for elevation, so multiply by 2 dLeftTop = file.readShort(); // Now read the left top elevation from hgt file pos = ((intervalCount - latitudeIntervalIndex) * (intervalCount + 1)) + longitudeIntervalIndex; // The index for the left bottom elevation - file.seek(pos * 2); // We have 16-bit values for elevation, so multiply by 2 + file.seek(pos * 2L); // We have 16-bit values for elevation, so multiply by 2 dLeftBottom = file.readShort(); // Now read the left bottom elevation from hgt file pos = (((intervalCount - latitudeIntervalIndex) - 1) * (intervalCount + 1)) + longitudeIntervalIndex + 1; // The index for the right top elevation - file.seek(pos * 2); // We have 16-bit values for elevation, so multiply by 2 + file.seek(pos * 2L); // We have 16-bit values for elevation, so multiply by 2 dRightTop = file.readShort(); // Now read the right top elevation from hgt file pos = ((intervalCount - latitudeIntervalIndex) * (intervalCount + 1)) + longitudeIntervalIndex + 1; // The index for the right bottom elevation - file.seek(pos * 2); // We have 16-bit values for elevation, so multiply by 2 + file.seek(pos * 2L); // We have 16-bit values for elevation, so multiply by 2 dRightBottom = file.readShort(); // Now read the right bottom top elevation from hgt file // if one of the read elevation values is not valid, we cannot interpolate diff --git a/hgt/src/main/java/slash/navigation/hgt/HgtFilesService.java b/hgt/src/main/java/slash/navigation/hgt/HgtFilesService.java index 99cb0f12e7..33159830c3 100644 --- a/hgt/src/main/java/slash/navigation/hgt/HgtFilesService.java +++ b/hgt/src/main/java/slash/navigation/hgt/HgtFilesService.java @@ -46,7 +46,7 @@ public class HgtFilesService { "ferranti1" )); - private DataSourceManager dataSourceManager; + private final DataSourceManager dataSourceManager; public HgtFilesService(DataSourceManager dataSourceManager) { this.dataSourceManager = dataSourceManager; diff --git a/hgt/src/test/java/slash/navigation/hgt/HgtFilesTest.java b/hgt/src/test/java/slash/navigation/hgt/HgtFilesTest.java index 786a2f8acf..8a427e74b3 100644 --- a/hgt/src/test/java/slash/navigation/hgt/HgtFilesTest.java +++ b/hgt/src/test/java/slash/navigation/hgt/HgtFilesTest.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertEquals; public class HgtFilesTest { - private HgtFiles files = new HgtFiles(null, new DownloadManager(null)); + private final HgtFiles files = new HgtFiles(null, new DownloadManager(null)); @Test public void createFileKey() { diff --git a/javafx8-mapview/src/main/java/slash/navigation/mapview/browser/JavaFX8WebViewMapView.java b/javafx8-mapview/src/main/java/slash/navigation/mapview/browser/JavaFX8WebViewMapView.java index 7f5a53b2e5..fe80f58bdd 100644 --- a/javafx8-mapview/src/main/java/slash/navigation/mapview/browser/JavaFX8WebViewMapView.java +++ b/javafx8-mapview/src/main/java/slash/navigation/mapview/browser/JavaFX8WebViewMapView.java @@ -282,7 +282,7 @@ public void run() { // script execution protected void executeScript(final String script) { - if (webView == null || script.length() == 0) + if (webView == null || script.isEmpty()) return; if (DEBUG) @@ -313,7 +313,7 @@ public void run() { private static final Object LOCK = new Object(); protected synchronized String executeScriptWithResult(final String script) { - if (script.length() == 0) + if (script.isEmpty()) return null; final boolean pollingCallback = !script.contains("getCallbacks"); diff --git a/kml/src/main/java/slash/navigation/kml/binding20/AddressDetails.java b/kml/src/main/java/slash/navigation/kml/binding20/AddressDetails.java index 91c287f106..5b1fe043cf 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/AddressDetails.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/AddressDetails.java @@ -243,7 +243,7 @@ public class AddressDetails { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the postalServiceElements property. @@ -660,7 +660,7 @@ public static class Address { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -818,7 +818,7 @@ public static class Country { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1058,7 +1058,7 @@ public static class CountryNameCode { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1317,7 +1317,7 @@ public static class PostalServiceElements { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressIdentifier property. @@ -1675,7 +1675,7 @@ public static class AddressIdentifier { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1825,7 +1825,7 @@ public static class AddressLatitude { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1953,7 +1953,7 @@ public static class AddressLatitudeDirection { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Specific to postal service @@ -2079,7 +2079,7 @@ public static class AddressLongitude { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2205,7 +2205,7 @@ public static class AddressLongitudeDirection { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2331,7 +2331,7 @@ public static class Barcode { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2457,7 +2457,7 @@ public static class EndorsementLineCode { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2583,7 +2583,7 @@ public static class KeyLineCode { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2787,7 +2787,7 @@ public static class SupplementaryPostalServiceData { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/AddressLine.java b/kml/src/main/java/slash/navigation/kml/binding20/AddressLine.java index 5fa089c435..2996e8be6a 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/AddressLine.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/AddressLine.java @@ -46,7 +46,7 @@ public class AddressLine { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/AddressLinesType.java b/kml/src/main/java/slash/navigation/kml/binding20/AddressLinesType.java index 0fbf7573cf..2daf52f2cd 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/AddressLinesType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/AddressLinesType.java @@ -48,7 +48,7 @@ public class AddressLinesType { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/AdministrativeArea.java b/kml/src/main/java/slash/navigation/kml/binding20/AdministrativeArea.java index 83ba8ef8ed..09c9073f79 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/AdministrativeArea.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/AdministrativeArea.java @@ -118,7 +118,7 @@ public class AdministrativeArea { @XmlAttribute(name = "UsageType") protected String usageType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -425,7 +425,7 @@ public static class AdministrativeAreaName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -588,7 +588,7 @@ public static class SubAdministrativeArea { @XmlAttribute(name = "UsageType") protected String usageType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -871,7 +871,7 @@ public static class SubAdministrativeAreaName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/BuildingNameType.java b/kml/src/main/java/slash/navigation/kml/binding20/BuildingNameType.java index 03d18768f6..e8902170ee 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/BuildingNameType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/BuildingNameType.java @@ -58,7 +58,7 @@ public class BuildingNameType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/CountryName.java b/kml/src/main/java/slash/navigation/kml/binding20/CountryName.java index 5f09ff8918..9dc961d735 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/CountryName.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/CountryName.java @@ -46,7 +46,7 @@ public class CountryName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/Department.java b/kml/src/main/java/slash/navigation/kml/binding20/Department.java index f531000eec..8d899a2195 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/Department.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/Department.java @@ -73,7 +73,7 @@ public class Department { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -284,7 +284,7 @@ public static class DepartmentName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/DependentLocalityType.java b/kml/src/main/java/slash/navigation/kml/binding20/DependentLocalityType.java index 47cc5e7b10..08d265e4b4 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/DependentLocalityType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/DependentLocalityType.java @@ -129,7 +129,7 @@ public class DependentLocalityType { @XmlAttribute(name = "UsageType") protected String usageType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -580,7 +580,7 @@ public static class DependentLocalityName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -714,7 +714,7 @@ public static class DependentLocalityNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/FirmType.java b/kml/src/main/java/slash/navigation/kml/binding20/FirmType.java index 5854013e7c..ea1db81638 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/FirmType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/FirmType.java @@ -76,7 +76,7 @@ public class FirmType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -316,7 +316,7 @@ public static class FirmName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/LargeMailUserType.java b/kml/src/main/java/slash/navigation/kml/binding20/LargeMailUserType.java index c52532f179..b0dfda4550 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/LargeMailUserType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/LargeMailUserType.java @@ -98,7 +98,7 @@ public class LargeMailUserType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -413,7 +413,7 @@ public static class LargeMailUserIdentifier { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -563,7 +563,7 @@ public static class LargeMailUserName { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/Locality.java b/kml/src/main/java/slash/navigation/kml/binding20/Locality.java index 36fb0d11db..b79029d7bd 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/Locality.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/Locality.java @@ -105,7 +105,7 @@ public class Locality { @XmlAttribute(name = "UsageType") protected String usageType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -508,7 +508,7 @@ public static class LocalityName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/MailStopType.java b/kml/src/main/java/slash/navigation/kml/binding20/MailStopType.java index c84a110abf..9493bfe99c 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/MailStopType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/MailStopType.java @@ -77,7 +77,7 @@ public class MailStopType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -259,7 +259,7 @@ public static class MailStopName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -385,7 +385,7 @@ public static class MailStopNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/PostBox.java b/kml/src/main/java/slash/navigation/kml/binding20/PostBox.java index cc45d76d8b..7a560bfae2 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/PostBox.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/PostBox.java @@ -113,7 +113,7 @@ public class PostBox { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -412,7 +412,7 @@ public static class PostBoxNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -511,7 +511,7 @@ public static class PostBoxNumberExtension { @XmlAttribute(name = "NumberExtensionSeparator") protected String numberExtensionSeparator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -613,7 +613,7 @@ public static class PostBoxNumberPrefix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -739,7 +739,7 @@ public static class PostBoxNumberSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/PostOffice.java b/kml/src/main/java/slash/navigation/kml/binding20/PostOffice.java index b739699ec7..54fee3233f 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/PostOffice.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/PostOffice.java @@ -105,7 +105,7 @@ public class PostOffice { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -388,7 +388,7 @@ public static class PostOfficeName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -525,7 +525,7 @@ public static class PostOfficeNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/PostalCode.java b/kml/src/main/java/slash/navigation/kml/binding20/PostalCode.java index 2223e3e363..844b27269a 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/PostalCode.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/PostalCode.java @@ -113,7 +113,7 @@ public class PostalCode { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -354,7 +354,7 @@ public static class PostTown { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -512,7 +512,7 @@ public static class PostTownName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -635,7 +635,7 @@ public static class PostTownSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -739,7 +739,7 @@ public static class PostalCodeNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -868,7 +868,7 @@ public static class PostalCodeNumberExtension { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/PostalRouteType.java b/kml/src/main/java/slash/navigation/kml/binding20/PostalRouteType.java index 62ffef719e..86656ba12f 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/PostalRouteType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/PostalRouteType.java @@ -82,7 +82,7 @@ public class PostalRouteType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -293,7 +293,7 @@ public static class PostalRouteName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -416,7 +416,7 @@ public static class PostalRouteNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/Premise.java b/kml/src/main/java/slash/navigation/kml/binding20/Premise.java index 1a3b98df84..074cec6188 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/Premise.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/Premise.java @@ -201,7 +201,7 @@ public class Premise { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -722,7 +722,7 @@ public static class PremiseLocation { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -835,7 +835,7 @@ public static class PremiseName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumber.java b/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumber.java index 847c0d11ed..673860adbd 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumber.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumber.java @@ -84,7 +84,7 @@ public class PremiseNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumberPrefix.java b/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumberPrefix.java index 968223e710..7e4512cef9 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumberPrefix.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumberPrefix.java @@ -49,7 +49,7 @@ public class PremiseNumberPrefix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the value property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumberSuffix.java b/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumberSuffix.java index 860b1d0a04..3353328d46 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumberSuffix.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/PremiseNumberSuffix.java @@ -49,7 +49,7 @@ public class PremiseNumberSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/SubPremiseType.java b/kml/src/main/java/slash/navigation/kml/binding20/SubPremiseType.java index 48d22f6674..12d80547de 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/SubPremiseType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/SubPremiseType.java @@ -167,7 +167,7 @@ public class SubPremiseType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -656,7 +656,7 @@ public static class SubPremiseName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -834,7 +834,7 @@ public static class SubPremiseNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1059,7 +1059,7 @@ public static class SubPremiseNumberPrefix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1212,7 +1212,7 @@ public static class SubPremiseNumberSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/Thoroughfare.java b/kml/src/main/java/slash/navigation/kml/binding20/Thoroughfare.java index 079cf4d760..a1a1f2dcb5 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/Thoroughfare.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/Thoroughfare.java @@ -221,7 +221,7 @@ public class Thoroughfare { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -808,7 +808,7 @@ public static class DependentThoroughfare { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1149,7 +1149,7 @@ public static class ThoroughfareNumberRange { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1455,7 +1455,7 @@ public static class ThoroughfareNumberFrom { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1575,7 +1575,7 @@ public static class ThoroughfareNumberTo { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareLeadingTypeType.java b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareLeadingTypeType.java index c6cdcd42b5..5ba037c883 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareLeadingTypeType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareLeadingTypeType.java @@ -45,7 +45,7 @@ public class ThoroughfareLeadingTypeType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNameType.java b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNameType.java index f3cc5af6f9..f5f6014a0f 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNameType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNameType.java @@ -45,7 +45,7 @@ public class ThoroughfareNameType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumber.java b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumber.java index 6cbd46cf84..b45230e26c 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumber.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumber.java @@ -86,7 +86,7 @@ public class ThoroughfareNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumberPrefix.java b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumberPrefix.java index a2a593b60c..2cd0734a15 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumberPrefix.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumberPrefix.java @@ -51,7 +51,7 @@ public class ThoroughfareNumberPrefix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * A-12 where 12 is number and A is prefix and "-" is the separator diff --git a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumberSuffix.java b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumberSuffix.java index 625e064e69..9d8ebb0574 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumberSuffix.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareNumberSuffix.java @@ -49,7 +49,7 @@ public class ThoroughfareNumberSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfarePostDirectionType.java b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfarePostDirectionType.java index 5bd11c5824..6218161d84 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfarePostDirectionType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfarePostDirectionType.java @@ -45,7 +45,7 @@ public class ThoroughfarePostDirectionType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfarePreDirectionType.java b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfarePreDirectionType.java index fdb0c1ea1c..3ef5d29dcb 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfarePreDirectionType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfarePreDirectionType.java @@ -45,7 +45,7 @@ public class ThoroughfarePreDirectionType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareTrailingTypeType.java b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareTrailingTypeType.java index d9c38fd237..f74319385a 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareTrailingTypeType.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/ThoroughfareTrailingTypeType.java @@ -45,7 +45,7 @@ public class ThoroughfareTrailingTypeType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding20/XAL.java b/kml/src/main/java/slash/navigation/kml/binding20/XAL.java index 2278c871ed..ec2c15b5b7 100644 --- a/kml/src/main/java/slash/navigation/kml/binding20/XAL.java +++ b/kml/src/main/java/slash/navigation/kml/binding20/XAL.java @@ -52,7 +52,7 @@ public class XAL { @XmlAttribute(name = "Version") protected String version; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressDetails property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/AddressDetails.java b/kml/src/main/java/slash/navigation/kml/binding22beta/AddressDetails.java index a70d05f3c6..50f6e3492f 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/AddressDetails.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/AddressDetails.java @@ -243,7 +243,7 @@ public class AddressDetails { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the postalServiceElements property. @@ -660,7 +660,7 @@ public static class Address { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -818,7 +818,7 @@ public static class Country { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1058,7 +1058,7 @@ public static class CountryNameCode { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1317,7 +1317,7 @@ public static class PostalServiceElements { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressIdentifier property. @@ -1675,7 +1675,7 @@ public static class AddressIdentifier { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1825,7 +1825,7 @@ public static class AddressLatitude { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1953,7 +1953,7 @@ public static class AddressLatitudeDirection { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Specific to postal service @@ -2079,7 +2079,7 @@ public static class AddressLongitude { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2205,7 +2205,7 @@ public static class AddressLongitudeDirection { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2331,7 +2331,7 @@ public static class Barcode { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2457,7 +2457,7 @@ public static class EndorsementLineCode { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2583,7 +2583,7 @@ public static class KeyLineCode { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2787,7 +2787,7 @@ public static class SupplementaryPostalServiceData { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/AddressLine.java b/kml/src/main/java/slash/navigation/kml/binding22beta/AddressLine.java index 9f22119359..1f7f8b8800 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/AddressLine.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/AddressLine.java @@ -46,7 +46,7 @@ public class AddressLine { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/AddressLinesType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/AddressLinesType.java index 06f92943bf..72049ab344 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/AddressLinesType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/AddressLinesType.java @@ -48,7 +48,7 @@ public class AddressLinesType { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/AdministrativeArea.java b/kml/src/main/java/slash/navigation/kml/binding22beta/AdministrativeArea.java index 43b37ffbca..4070cc7880 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/AdministrativeArea.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/AdministrativeArea.java @@ -118,7 +118,7 @@ public class AdministrativeArea { @XmlAttribute(name = "UsageType") protected String usageType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -425,7 +425,7 @@ public static class AdministrativeAreaName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -588,7 +588,7 @@ public static class SubAdministrativeArea { @XmlAttribute(name = "UsageType") protected String usageType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -871,7 +871,7 @@ public static class SubAdministrativeAreaName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/BuildingNameType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/BuildingNameType.java index fcf74cff86..8868cb33af 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/BuildingNameType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/BuildingNameType.java @@ -58,7 +58,7 @@ public class BuildingNameType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/CountryName.java b/kml/src/main/java/slash/navigation/kml/binding22beta/CountryName.java index 3435237a1d..ae85982057 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/CountryName.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/CountryName.java @@ -46,7 +46,7 @@ public class CountryName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/Department.java b/kml/src/main/java/slash/navigation/kml/binding22beta/Department.java index 6e45fec179..36eed7629b 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/Department.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/Department.java @@ -73,7 +73,7 @@ public class Department { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -284,7 +284,7 @@ public static class DepartmentName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/DependentLocalityType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/DependentLocalityType.java index a952aa2e22..36fa61a51a 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/DependentLocalityType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/DependentLocalityType.java @@ -129,7 +129,7 @@ public class DependentLocalityType { @XmlAttribute(name = "UsageType") protected String usageType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -580,7 +580,7 @@ public static class DependentLocalityName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -714,7 +714,7 @@ public static class DependentLocalityNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/FirmType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/FirmType.java index dd22b4f82d..fc7c01d5e1 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/FirmType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/FirmType.java @@ -76,7 +76,7 @@ public class FirmType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -316,7 +316,7 @@ public static class FirmName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/LargeMailUserType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/LargeMailUserType.java index 56353c2e85..1b530c5d4e 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/LargeMailUserType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/LargeMailUserType.java @@ -98,7 +98,7 @@ public class LargeMailUserType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -413,7 +413,7 @@ public static class LargeMailUserIdentifier { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -563,7 +563,7 @@ public static class LargeMailUserName { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/Locality.java b/kml/src/main/java/slash/navigation/kml/binding22beta/Locality.java index 4af156ccf3..f53453d2d7 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/Locality.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/Locality.java @@ -105,7 +105,7 @@ public class Locality { @XmlAttribute(name = "UsageType") protected String usageType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -508,7 +508,7 @@ public static class LocalityName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/MailStopType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/MailStopType.java index 7a1679d01f..941cad51ca 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/MailStopType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/MailStopType.java @@ -77,7 +77,7 @@ public class MailStopType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -259,7 +259,7 @@ public static class MailStopName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -385,7 +385,7 @@ public static class MailStopNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/PostBox.java b/kml/src/main/java/slash/navigation/kml/binding22beta/PostBox.java index c98fe77980..ef8019d5af 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/PostBox.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/PostBox.java @@ -113,7 +113,7 @@ public class PostBox { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -412,7 +412,7 @@ public static class PostBoxNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -511,7 +511,7 @@ public static class PostBoxNumberExtension { @XmlAttribute(name = "NumberExtensionSeparator") protected String numberExtensionSeparator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -613,7 +613,7 @@ public static class PostBoxNumberPrefix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -739,7 +739,7 @@ public static class PostBoxNumberSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/PostOffice.java b/kml/src/main/java/slash/navigation/kml/binding22beta/PostOffice.java index d018374fcd..73653277ac 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/PostOffice.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/PostOffice.java @@ -105,7 +105,7 @@ public class PostOffice { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -388,7 +388,7 @@ public static class PostOfficeName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -525,7 +525,7 @@ public static class PostOfficeNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/PostalCode.java b/kml/src/main/java/slash/navigation/kml/binding22beta/PostalCode.java index edc5157b12..e2b7d56a41 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/PostalCode.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/PostalCode.java @@ -113,7 +113,7 @@ public class PostalCode { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -354,7 +354,7 @@ public static class PostTown { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -512,7 +512,7 @@ public static class PostTownName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -635,7 +635,7 @@ public static class PostTownSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -739,7 +739,7 @@ public static class PostalCodeNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -868,7 +868,7 @@ public static class PostalCodeNumberExtension { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/PostalRouteType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/PostalRouteType.java index 81a6f5f971..91d425958d 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/PostalRouteType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/PostalRouteType.java @@ -82,7 +82,7 @@ public class PostalRouteType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -293,7 +293,7 @@ public static class PostalRouteName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -416,7 +416,7 @@ public static class PostalRouteNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/Premise.java b/kml/src/main/java/slash/navigation/kml/binding22beta/Premise.java index 3c54b846b4..080a886f72 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/Premise.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/Premise.java @@ -201,7 +201,7 @@ public class Premise { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -722,7 +722,7 @@ public static class PremiseLocation { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -835,7 +835,7 @@ public static class PremiseName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumber.java b/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumber.java index 75c85389bf..50373132ae 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumber.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumber.java @@ -84,7 +84,7 @@ public class PremiseNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumberPrefix.java b/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumberPrefix.java index a1b109f019..788576ca77 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumberPrefix.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumberPrefix.java @@ -49,7 +49,7 @@ public class PremiseNumberPrefix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the value property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumberSuffix.java b/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumberSuffix.java index 67f7b20803..889798c5dc 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumberSuffix.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/PremiseNumberSuffix.java @@ -49,7 +49,7 @@ public class PremiseNumberSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/SubPremiseType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/SubPremiseType.java index d1c82f7836..e2526a9ab1 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/SubPremiseType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/SubPremiseType.java @@ -167,7 +167,7 @@ public class SubPremiseType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -656,7 +656,7 @@ public static class SubPremiseName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -834,7 +834,7 @@ public static class SubPremiseNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1059,7 +1059,7 @@ public static class SubPremiseNumberPrefix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1212,7 +1212,7 @@ public static class SubPremiseNumberSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/Thoroughfare.java b/kml/src/main/java/slash/navigation/kml/binding22beta/Thoroughfare.java index cd390118ed..9abd50a510 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/Thoroughfare.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/Thoroughfare.java @@ -221,7 +221,7 @@ public class Thoroughfare { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -808,7 +808,7 @@ public static class DependentThoroughfare { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1149,7 +1149,7 @@ public static class ThoroughfareNumberRange { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1455,7 +1455,7 @@ public static class ThoroughfareNumberFrom { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1575,7 +1575,7 @@ public static class ThoroughfareNumberTo { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareLeadingTypeType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareLeadingTypeType.java index 564c24577d..7e8da4c9ee 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareLeadingTypeType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareLeadingTypeType.java @@ -45,7 +45,7 @@ public class ThoroughfareLeadingTypeType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNameType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNameType.java index e63daf8427..08398b552a 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNameType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNameType.java @@ -45,7 +45,7 @@ public class ThoroughfareNameType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumber.java b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumber.java index ba89e548c9..96c4bdb523 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumber.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumber.java @@ -86,7 +86,7 @@ public class ThoroughfareNumber { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumberPrefix.java b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumberPrefix.java index aef28f7094..c88a7052b4 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumberPrefix.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumberPrefix.java @@ -51,7 +51,7 @@ public class ThoroughfareNumberPrefix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * A-12 where 12 is number and A is prefix and "-" is the separator diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumberSuffix.java b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumberSuffix.java index fe01449312..6babdefb2a 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumberSuffix.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareNumberSuffix.java @@ -49,7 +49,7 @@ public class ThoroughfareNumberSuffix { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfarePostDirectionType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfarePostDirectionType.java index b5292dff2d..ccb68b0b6f 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfarePostDirectionType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfarePostDirectionType.java @@ -45,7 +45,7 @@ public class ThoroughfarePostDirectionType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfarePreDirectionType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfarePreDirectionType.java index 3bd6e3715f..54b7731e3b 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfarePreDirectionType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfarePreDirectionType.java @@ -45,7 +45,7 @@ public class ThoroughfarePreDirectionType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareTrailingTypeType.java b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareTrailingTypeType.java index 13a9cf2430..29d462218a 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareTrailingTypeType.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/ThoroughfareTrailingTypeType.java @@ -45,7 +45,7 @@ public class ThoroughfareTrailingTypeType { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/binding22beta/XAL.java b/kml/src/main/java/slash/navigation/kml/binding22beta/XAL.java index 011f710fa1..b3b4788dd2 100644 --- a/kml/src/main/java/slash/navigation/kml/binding22beta/XAL.java +++ b/kml/src/main/java/slash/navigation/kml/binding22beta/XAL.java @@ -52,7 +52,7 @@ public class XAL { @XmlAttribute(name = "Version") protected String version; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressDetails property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/AddressDetails.java b/kml/src/main/java/slash/navigation/kml/bindingxal/AddressDetails.java index 0a278fd315..6bf9887e40 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/AddressDetails.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/AddressDetails.java @@ -250,7 +250,7 @@ public class AddressDetails { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the postalServiceElements property. @@ -669,7 +669,7 @@ public static class Address { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -827,7 +827,7 @@ public static class Country { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1069,7 +1069,7 @@ public static class CountryNameCode { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1329,7 +1329,7 @@ public static class PostalServiceElements { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressIdentifier property. @@ -1690,7 +1690,7 @@ public static class AddressIdentifier { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1842,7 +1842,7 @@ public static class AddressLatitude { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1972,7 +1972,7 @@ public static class AddressLatitudeDirection { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Specific to postal service @@ -2100,7 +2100,7 @@ public static class AddressLongitude { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2228,7 +2228,7 @@ public static class AddressLongitudeDirection { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2356,7 +2356,7 @@ public static class Barcode { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2484,7 +2484,7 @@ public static class EndorsementLineCode { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2612,7 +2612,7 @@ public static class KeyLineCode { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -2820,7 +2820,7 @@ public static class SupplementaryPostalServiceData { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/AddressLine.java b/kml/src/main/java/slash/navigation/kml/bindingxal/AddressLine.java index 49c1f3bd8e..3319ba6e27 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/AddressLine.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/AddressLine.java @@ -48,7 +48,7 @@ public class AddressLine { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/AddressLinesType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/AddressLinesType.java index 90a548de09..7a8cb65703 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/AddressLinesType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/AddressLinesType.java @@ -48,7 +48,7 @@ public class AddressLinesType { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/AdministrativeArea.java b/kml/src/main/java/slash/navigation/kml/bindingxal/AdministrativeArea.java index 6bde051494..89cf1f82f0 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/AdministrativeArea.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/AdministrativeArea.java @@ -121,7 +121,7 @@ public class AdministrativeArea { @XmlSchemaType(name = "anySimpleType") protected String indicator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -430,7 +430,7 @@ public static class AdministrativeAreaName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -596,7 +596,7 @@ public static class SubAdministrativeArea { @XmlSchemaType(name = "anySimpleType") protected String indicator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -881,7 +881,7 @@ public static class SubAdministrativeAreaName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/BuildingNameType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/BuildingNameType.java index 029697db79..57cae1079b 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/BuildingNameType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/BuildingNameType.java @@ -60,7 +60,7 @@ public class BuildingNameType { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/CountryName.java b/kml/src/main/java/slash/navigation/kml/bindingxal/CountryName.java index b58c589eb9..9cd234b10b 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/CountryName.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/CountryName.java @@ -48,7 +48,7 @@ public class CountryName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/Department.java b/kml/src/main/java/slash/navigation/kml/bindingxal/Department.java index 11d65e903e..6698660d4d 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/Department.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/Department.java @@ -74,7 +74,7 @@ public class Department { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -287,7 +287,7 @@ public static class DepartmentName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/DependentLocalityType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/DependentLocalityType.java index 2fe7da034b..91b05b213c 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/DependentLocalityType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/DependentLocalityType.java @@ -133,7 +133,7 @@ public class DependentLocalityType { @XmlSchemaType(name = "anySimpleType") protected String indicator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -586,7 +586,7 @@ public static class DependentLocalityName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -721,7 +721,7 @@ public static class DependentLocalityNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/FirmType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/FirmType.java index 5504de52e8..1692e2ad46 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/FirmType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/FirmType.java @@ -77,7 +77,7 @@ public class FirmType { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -319,7 +319,7 @@ public static class FirmName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/LargeMailUserType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/LargeMailUserType.java index c4e4e5a92e..da89e958c1 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/LargeMailUserType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/LargeMailUserType.java @@ -98,7 +98,7 @@ public class LargeMailUserType { @XmlAttribute(name = "Type") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -415,7 +415,7 @@ public static class LargeMailUserIdentifier { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -565,7 +565,7 @@ public static class LargeMailUserName { @XmlAttribute(name = "Code") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/Locality.java b/kml/src/main/java/slash/navigation/kml/bindingxal/Locality.java index a6f4a253eb..3b16ac1f65 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/Locality.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/Locality.java @@ -108,7 +108,7 @@ public class Locality { @XmlSchemaType(name = "anySimpleType") protected String indicator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -513,7 +513,7 @@ public static class LocalityName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/MailStopType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/MailStopType.java index fafd80c4d9..08e01ba5cb 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/MailStopType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/MailStopType.java @@ -78,7 +78,7 @@ public class MailStopType { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -262,7 +262,7 @@ public static class MailStopName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -390,7 +390,7 @@ public static class MailStopNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/PostBox.java b/kml/src/main/java/slash/navigation/kml/bindingxal/PostBox.java index 8f8c760687..c4fd5aa338 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/PostBox.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/PostBox.java @@ -115,7 +115,7 @@ public class PostBox { @XmlSchemaType(name = "anySimpleType") protected String indicator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -415,7 +415,7 @@ public static class PostBoxNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -515,7 +515,7 @@ public static class PostBoxNumberExtension { @XmlSchemaType(name = "anySimpleType") protected String numberExtensionSeparator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -619,7 +619,7 @@ public static class PostBoxNumberPrefix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -747,7 +747,7 @@ public static class PostBoxNumberSuffix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/PostOffice.java b/kml/src/main/java/slash/navigation/kml/bindingxal/PostOffice.java index c7d7cadb9b..8b6479c367 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/PostOffice.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/PostOffice.java @@ -107,7 +107,7 @@ public class PostOffice { @XmlSchemaType(name = "anySimpleType") protected String indicator; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -392,7 +392,7 @@ public static class PostOfficeName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -531,7 +531,7 @@ public static class PostOfficeNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/PostalCode.java b/kml/src/main/java/slash/navigation/kml/bindingxal/PostalCode.java index b7d31ff613..cd5ecdfaad 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/PostalCode.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/PostalCode.java @@ -114,7 +114,7 @@ public class PostalCode { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -356,7 +356,7 @@ public static class PostTown { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -516,7 +516,7 @@ public static class PostTownName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -640,7 +640,7 @@ public static class PostTownSuffix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -746,7 +746,7 @@ public static class PostalCodeNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -878,7 +878,7 @@ public static class PostalCodeNumberExtension { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/PostalRouteType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/PostalRouteType.java index 45e8cec091..812c2be2bd 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/PostalRouteType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/PostalRouteType.java @@ -83,7 +83,7 @@ public class PostalRouteType { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -296,7 +296,7 @@ public static class PostalRouteName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -420,7 +420,7 @@ public static class PostalRouteNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/Premise.java b/kml/src/main/java/slash/navigation/kml/bindingxal/Premise.java index dd9241bb2c..f1934dbaff 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/Premise.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/Premise.java @@ -205,7 +205,7 @@ public class Premise { @XmlSchemaType(name = "anySimpleType") protected String premiseThoroughfareConnector; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -727,7 +727,7 @@ public static class PremiseLocation { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -842,7 +842,7 @@ public static class PremiseName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumber.java b/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumber.java index 70f2f4e01d..b651815454 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumber.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumber.java @@ -87,7 +87,7 @@ public class PremiseNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumberPrefix.java b/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumberPrefix.java index 2c29e131d7..5349ba9642 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumberPrefix.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumberPrefix.java @@ -52,7 +52,7 @@ public class PremiseNumberPrefix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the value property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumberSuffix.java b/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumberSuffix.java index 6435afbdec..7d3838d17c 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumberSuffix.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/PremiseNumberSuffix.java @@ -52,7 +52,7 @@ public class PremiseNumberSuffix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/SubPremiseType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/SubPremiseType.java index cd7adcb66f..c928692170 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/SubPremiseType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/SubPremiseType.java @@ -168,7 +168,7 @@ public class SubPremiseType { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -660,7 +660,7 @@ public static class SubPremiseName { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -842,7 +842,7 @@ public static class SubPremiseNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1070,7 +1070,7 @@ public static class SubPremiseNumberPrefix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1226,7 +1226,7 @@ public static class SubPremiseNumberSuffix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/Thoroughfare.java b/kml/src/main/java/slash/navigation/kml/bindingxal/Thoroughfare.java index 3e0fd225b1..e6a43efe5f 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/Thoroughfare.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/Thoroughfare.java @@ -225,7 +225,7 @@ public class Thoroughfare { @XmlSchemaType(name = "anySimpleType") protected String dependentThoroughfaresType; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -813,7 +813,7 @@ public static class DependentThoroughfare { @XmlSchemaType(name = "anySimpleType") protected String type; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1158,7 +1158,7 @@ public static class ThoroughfareNumberRange { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressLine property. @@ -1465,7 +1465,7 @@ public static class ThoroughfareNumberFrom { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. @@ -1586,7 +1586,7 @@ public static class ThoroughfareNumberTo { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareLeadingTypeType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareLeadingTypeType.java index 46cca25d8b..cf682891a0 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareLeadingTypeType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareLeadingTypeType.java @@ -47,7 +47,7 @@ public class ThoroughfareLeadingTypeType { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNameType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNameType.java index 43c70d0d7a..bf6c473e89 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNameType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNameType.java @@ -47,7 +47,7 @@ public class ThoroughfareNameType { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumber.java b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumber.java index 69e6e0692c..7a90ab3fad 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumber.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumber.java @@ -89,7 +89,7 @@ public class ThoroughfareNumber { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumberPrefix.java b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumberPrefix.java index 269b698e0b..d18924ab27 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumberPrefix.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumberPrefix.java @@ -54,7 +54,7 @@ public class ThoroughfareNumberPrefix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * A-12 where 12 is number and A is prefix and "-" is the separator diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumberSuffix.java b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumberSuffix.java index 9a30f8ca88..24c4ccd88b 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumberSuffix.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareNumberSuffix.java @@ -52,7 +52,7 @@ public class ThoroughfareNumberSuffix { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfarePostDirectionType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfarePostDirectionType.java index f774731978..a648d4168d 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfarePostDirectionType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfarePostDirectionType.java @@ -47,7 +47,7 @@ public class ThoroughfarePostDirectionType { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfarePreDirectionType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfarePreDirectionType.java index 841cb16cb5..3288cfbd53 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfarePreDirectionType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfarePreDirectionType.java @@ -47,7 +47,7 @@ public class ThoroughfarePreDirectionType { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareTrailingTypeType.java b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareTrailingTypeType.java index 1dc6906479..6ba49d0e64 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareTrailingTypeType.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/ThoroughfareTrailingTypeType.java @@ -47,7 +47,7 @@ public class ThoroughfareTrailingTypeType { @XmlSchemaType(name = "anySimpleType") protected String code; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the content property. diff --git a/kml/src/main/java/slash/navigation/kml/bindingxal/XAL.java b/kml/src/main/java/slash/navigation/kml/bindingxal/XAL.java index b857eb92b2..45fa6a615c 100644 --- a/kml/src/main/java/slash/navigation/kml/bindingxal/XAL.java +++ b/kml/src/main/java/slash/navigation/kml/bindingxal/XAL.java @@ -53,7 +53,7 @@ public class XAL { @XmlSchemaType(name = "anySimpleType") protected String version; @XmlAnyAttribute - private Map otherAttributes = new HashMap<>(); + private final Map otherAttributes = new HashMap<>(); /** * Gets the value of the addressDetails property. diff --git a/mapsforge-maps/src/main/java/slash/navigation/maps/mapsforge/helpers/ThemeForMapMediator.java b/mapsforge-maps/src/main/java/slash/navigation/maps/mapsforge/helpers/ThemeForMapMediator.java index b8b4bfdff0..19fbe3e569 100644 --- a/mapsforge-maps/src/main/java/slash/navigation/maps/mapsforge/helpers/ThemeForMapMediator.java +++ b/mapsforge-maps/src/main/java/slash/navigation/maps/mapsforge/helpers/ThemeForMapMediator.java @@ -97,7 +97,7 @@ private String getFirstTheme(LocalMap map) { File themesDirectory = new File(mapManager.getThemesDirectory(), map.getProvider()); if (themesDirectory.exists()) { List themes = collectFiles(mapManager.getThemesDirectory(), DOT_XML); - if(themes.size() > 0) + if(!themes.isEmpty()) return removePrefix(mapManager.getThemesDirectory(), themes.get(0)); } return getAppliedThemeModel().getItem().getDescription(); diff --git a/mapsforge-maps/src/main/java/slash/navigation/maps/mapsforge/impl/RemoteFilesAggregator.java b/mapsforge-maps/src/main/java/slash/navigation/maps/mapsforge/impl/RemoteFilesAggregator.java index c4877c5557..9f8caf29a1 100644 --- a/mapsforge-maps/src/main/java/slash/navigation/maps/mapsforge/impl/RemoteFilesAggregator.java +++ b/mapsforge-maps/src/main/java/slash/navigation/maps/mapsforge/impl/RemoteFilesAggregator.java @@ -36,7 +36,7 @@ public class RemoteFilesAggregator { private final List dataSourceRemoteFiles = new ArrayList<>(); - private DataSourceManager dataSourceManager; + private final DataSourceManager dataSourceManager; public RemoteFilesAggregator(DataSourceManager dataSourceManager) { this.dataSourceManager = dataSourceManager; diff --git a/mapsforge-mapview/src/main/java/slash/navigation/mapview/mapsforge/MapsforgeMapView.java b/mapsforge-mapview/src/main/java/slash/navigation/mapview/mapsforge/MapsforgeMapView.java index 4d1297d93d..ce294308f4 100644 --- a/mapsforge-mapview/src/main/java/slash/navigation/mapview/mapsforge/MapsforgeMapView.java +++ b/mapsforge-mapview/src/main/java/slash/navigation/mapview/mapsforge/MapsforgeMapView.java @@ -715,7 +715,7 @@ public void resize() { @SuppressWarnings("unchecked") public void showAllPositions() { List positions = positionsModel.getRoute().getPositions(); - if (positions.size() > 0) { + if (!positions.isEmpty()) { BoundingBox both = new BoundingBox(positions); zoomToBounds(both); setCenter(both.getCenter(), true); @@ -815,7 +815,7 @@ public int getTileSize() { @SuppressWarnings("unchecked") private BoundingBox getRouteBoundingBox() { BaseRoute route = positionsModel.getRoute(); - return route != null && route.getPositions().size() > 0 ? new BoundingBox(route.getPositions()) : null; + return route != null && !route.getPositions().isEmpty() ? new BoundingBox(route.getPositions()) : null; } private boolean isGoogleMap(LocalMap map) { @@ -905,7 +905,7 @@ private void centerAndZoom(BoundingBox mapBoundingBox, BoundingBox routeBounding } } - if (positions.size() > 0) { + if (!positions.isEmpty()) { BoundingBox both = new BoundingBox(positions); if (alwaysZoom) zoomToBounds(both); @@ -1118,7 +1118,7 @@ public void run() { private class AddPositionAction extends FrameAction { private int getAddRow() { List lastSelectedPositions = selectionUpdater.getPositionWithLayers(); - NavigationPosition position = lastSelectedPositions.size() > 0 ? lastSelectedPositions.get(lastSelectedPositions.size() - 1).getPosition() : null; + NavigationPosition position = !lastSelectedPositions.isEmpty() ? lastSelectedPositions.get(lastSelectedPositions.size() - 1).getPosition() : null; // quite crude logic to be as robust as possible on failures if (position == null && positionsModel.getRowCount() > 0) position = positionsModel.getPosition(positionsModel.getRowCount() - 1); @@ -1176,7 +1176,7 @@ private ZoomAction(int zoomLevelDiff) { public void run() { if (mapViewCallback.isRecenterAfterZooming()) { List selectedPositions = toPositions(selectionUpdater.getPositionWithLayers()); - NavigationPosition center = selectedPositions.size() > 0 ? new BoundingBox(selectedPositions).getCenter() : getCenter(); + NavigationPosition center = !selectedPositions.isEmpty() ? new BoundingBox(selectedPositions).getCenter() : getCenter(); mapViewMoverAndZoomer.zoomToPosition(zoomLevelDiff, asLatLong(center)); } else mapViewMoverAndZoomer.zoomToMousePosition(zoomLevelDiff); diff --git a/mapsforge-mapview/src/main/java/slash/navigation/mapview/mapsforge/helpers/MapViewCoordinateDisplayer.java b/mapsforge-mapview/src/main/java/slash/navigation/mapview/mapsforge/helpers/MapViewCoordinateDisplayer.java index 638e9423b9..8e4a64d44d 100644 --- a/mapsforge-mapview/src/main/java/slash/navigation/mapview/mapsforge/helpers/MapViewCoordinateDisplayer.java +++ b/mapsforge-mapview/src/main/java/slash/navigation/mapview/mapsforge/helpers/MapViewCoordinateDisplayer.java @@ -46,7 +46,7 @@ public class MapViewCoordinateDisplayer extends MouseAdapter { private MapView mapView; private MapViewCallback mapViewCallback; private JWindow window; - private JLabel label = new JLabel(); + private final JLabel label = new JLabel(); private boolean showCoordinates; public void initialize(AwtGraphicMapView mapView, MapViewCallback mapViewCallback) { diff --git a/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/MapsforgeMapViewTest.java b/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/MapsforgeMapViewTest.java index 29bf117c8e..831457a44b 100644 --- a/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/MapsforgeMapViewTest.java +++ b/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/MapsforgeMapViewTest.java @@ -27,7 +27,7 @@ import static slash.navigation.maps.mapsforge.helpers.MapUtil.toBoundingBox; public class MapsforgeMapViewTest { - private MapsforgeMapView mapView = new MapsforgeMapView(); + private final MapsforgeMapView mapView = new MapsforgeMapView(); @Test public void testBoundingBox() { diff --git a/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/updater/TrackUpdaterTest.java b/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/updater/TrackUpdaterTest.java index c9a656a6b9..2f2f206f9c 100644 --- a/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/updater/TrackUpdaterTest.java +++ b/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/updater/TrackUpdaterTest.java @@ -35,17 +35,17 @@ import static org.mockito.Mockito.*; public class TrackUpdaterTest { - private NavigationPosition p1 = new SimpleNavigationPosition(1.0, 0.0); - private NavigationPosition p2 = new SimpleNavigationPosition(2.0, 0.0); - private NavigationPosition p3 = new SimpleNavigationPosition(3.0, 0.0); - private NavigationPosition p4 = new SimpleNavigationPosition(4.0, 0.0); - private PairWithLayer p1p2 = new PairWithLayer(p1, p2, 0); - private PairWithLayer p1p3 = new PairWithLayer(p1, p3, 1); - private PairWithLayer p1p4 = new PairWithLayer(p1, p4, 2); - private PairWithLayer p2p3 = new PairWithLayer(p2, p3, 3); - private PairWithLayer p2p4 = new PairWithLayer(p2, p4, 4); - private PairWithLayer p3p1 = new PairWithLayer(p3, p1, 5); - private PairWithLayer p3p4 = new PairWithLayer(p3, p4, 6); + private final NavigationPosition p1 = new SimpleNavigationPosition(1.0, 0.0); + private final NavigationPosition p2 = new SimpleNavigationPosition(2.0, 0.0); + private final NavigationPosition p3 = new SimpleNavigationPosition(3.0, 0.0); + private final NavigationPosition p4 = new SimpleNavigationPosition(4.0, 0.0); + private final PairWithLayer p1p2 = new PairWithLayer(p1, p2, 0); + private final PairWithLayer p1p3 = new PairWithLayer(p1, p3, 1); + private final PairWithLayer p1p4 = new PairWithLayer(p1, p4, 2); + private final PairWithLayer p2p3 = new PairWithLayer(p2, p3, 3); + private final PairWithLayer p2p4 = new PairWithLayer(p2, p4, 4); + private final PairWithLayer p3p1 = new PairWithLayer(p3, p1, 5); + private final PairWithLayer p3p4 = new PairWithLayer(p3, p4, 6); @Test public void testInitiallyEmpty() { diff --git a/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/updater/WaypointUpdaterTest.java b/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/updater/WaypointUpdaterTest.java index bbf430f976..c7d0490878 100644 --- a/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/updater/WaypointUpdaterTest.java +++ b/mapsforge-mapview/src/test/java/slash/navigation/mapview/mapsforge/updater/WaypointUpdaterTest.java @@ -35,15 +35,15 @@ import static org.mockito.Mockito.*; public class WaypointUpdaterTest { - private NavigationPosition p1 = new SimpleNavigationPosition(1.0, 0.0); - private NavigationPosition p2 = new SimpleNavigationPosition(2.0, 0.0); - private NavigationPosition p3 = new SimpleNavigationPosition(3.0, 0.0); - private NavigationPosition p4 = new SimpleNavigationPosition(4.0, 0.0); - - private PositionWithLayer w1 = new PositionWithLayer(p1); - private PositionWithLayer w2 = new PositionWithLayer(p2); - private PositionWithLayer w3 = new PositionWithLayer(p3); - private PositionWithLayer w4 = new PositionWithLayer(p4); + private final NavigationPosition p1 = new SimpleNavigationPosition(1.0, 0.0); + private final NavigationPosition p2 = new SimpleNavigationPosition(2.0, 0.0); + private final NavigationPosition p3 = new SimpleNavigationPosition(3.0, 0.0); + private final NavigationPosition p4 = new SimpleNavigationPosition(4.0, 0.0); + + private final PositionWithLayer w1 = new PositionWithLayer(p1); + private final PositionWithLayer w2 = new PositionWithLayer(p2); + private final PositionWithLayer w3 = new PositionWithLayer(p3); + private final PositionWithLayer w4 = new PositionWithLayer(p4); @Test diff --git a/mapsforge-mbtiles/src/main/java/slash/navigation/maps/mapsforge/mbtiles/MapWorkerPool.java b/mapsforge-mbtiles/src/main/java/slash/navigation/maps/mapsforge/mbtiles/MapWorkerPool.java index 31cac0d11c..d7b292f113 100644 --- a/mapsforge-mbtiles/src/main/java/slash/navigation/maps/mapsforge/mbtiles/MapWorkerPool.java +++ b/mapsforge-mbtiles/src/main/java/slash/navigation/maps/mapsforge/mbtiles/MapWorkerPool.java @@ -141,7 +141,7 @@ public void run() { long te = totalExecutions.incrementAndGet(); long tt = totalTime.addAndGet(end - start); if (te % 10 == 0) { - LOGGER.info("TIMING " + Long.toString(te) + " " + Double.toString(tt / te)); + LOGGER.info("TIMING " + te + " " + Double.toString(tt / te)); } concurrentJobs.decrementAndGet(); } diff --git a/mapsforge-mbtiles/src/main/java/slash/navigation/maps/mapsforge/mbtiles/RendererJob.java b/mapsforge-mbtiles/src/main/java/slash/navigation/maps/mapsforge/mbtiles/RendererJob.java index 4fb86795aa..4f77d683b5 100644 --- a/mapsforge-mbtiles/src/main/java/slash/navigation/maps/mapsforge/mbtiles/RendererJob.java +++ b/mapsforge-mbtiles/src/main/java/slash/navigation/maps/mapsforge/mbtiles/RendererJob.java @@ -26,10 +26,7 @@ public boolean equals(Object obj) { return false; } RendererJob other = (RendererJob) obj; - if (!this.getDatabaseRenderer().equals(other.getDatabaseRenderer())) { - return false; - } - return true; + return this.getDatabaseRenderer().equals(other.getDatabaseRenderer()); } public int hashCode() { diff --git a/mapview/src/main/java/slash/navigation/converter/gui/models/GoogleMapsServerModel.java b/mapview/src/main/java/slash/navigation/converter/gui/models/GoogleMapsServerModel.java index 046b8dd489..18b5232475 100644 --- a/mapview/src/main/java/slash/navigation/converter/gui/models/GoogleMapsServerModel.java +++ b/mapview/src/main/java/slash/navigation/converter/gui/models/GoogleMapsServerModel.java @@ -34,7 +34,7 @@ */ public class GoogleMapsServerModel { - private EventListenerList listenerList = new EventListenerList(); + private final EventListenerList listenerList = new EventListenerList(); public GoogleMapsServer getGoogleMapsServer() { return GoogleMapsServer.getGoogleMapsServer(); diff --git a/mapview/src/main/java/slash/navigation/converter/gui/models/StringModel.java b/mapview/src/main/java/slash/navigation/converter/gui/models/StringModel.java index fedcd40c21..120c26762e 100644 --- a/mapview/src/main/java/slash/navigation/converter/gui/models/StringModel.java +++ b/mapview/src/main/java/slash/navigation/converter/gui/models/StringModel.java @@ -38,7 +38,7 @@ public class StringModel { private final String preferencesName; private final String defaultValue; - private EventListenerList listenerList = new EventListenerList(); + private final EventListenerList listenerList = new EventListenerList(); public StringModel(String preferencesName, String defaultValue) { this.preferencesName = preferencesName; diff --git a/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushCSharp.js b/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushCSharp.js index 079214efe1..74d1375108 100644 --- a/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushCSharp.js +++ b/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushCSharp.js @@ -52,7 +52,7 @@ ]; this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); - }; + } Brush.prototype = new SyntaxHighlighter.Highlighter(); Brush.aliases = ['c#', 'c-sharp', 'csharp']; diff --git a/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushCpp.js b/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushCpp.js index 9f70d3aed6..08f0f0a8a2 100644 --- a/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushCpp.js +++ b/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushCpp.js @@ -85,7 +85,7 @@ { regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' }, { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' } ]; - }; + } Brush.prototype = new SyntaxHighlighter.Highlighter(); Brush.aliases = ['cpp', 'c']; diff --git a/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushJava.js b/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushJava.js index d692fd6382..8e15413209 100644 --- a/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushJava.js +++ b/navigation-formats/src/main/doc/sygic/Sygic_ITF_Files_specification_files/shBrushJava.js @@ -45,7 +45,7 @@ left : /(<|<)%[@!=]?/g, right : /%(>|>)/g }); - }; + } Brush.prototype = new SyntaxHighlighter.Highlighter(); Brush.aliases = ['java']; diff --git a/navigation-formats/src/main/java/slash/navigation/babel/BabelFormat.java b/navigation-formats/src/main/java/slash/navigation/babel/BabelFormat.java index 6cbd46e706..f30a503463 100644 --- a/navigation-formats/src/main/java/slash/navigation/babel/BabelFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/babel/BabelFormat.java @@ -157,7 +157,7 @@ private void pumpStream(final InputStream input, final OutputStream output, fina new Thread(() -> { try { try { - byte buffer[] = new byte[DEFAULT_BUFFER_SIZE]; + byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int count = 0; while (count >= 0) { count = input.read(buffer); @@ -279,12 +279,12 @@ private int execute(String babelPath, List args, int timeout) throws IOE log.severe("Couldn't read final response: " + e); } - log.info("Executed '" + process.toString() + "' with exit value: " + exitValue); + log.info("Executed '" + process + "' with exit value: " + exitValue); return exitValue; } private void readStream(InputStream inputStream, String streamName) throws IOException { - byte buffer[] = new byte[DEFAULT_BUFFER_SIZE]; + byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int count = 0; while (inputStream.available() > 0 && count < buffer.length) { buffer[count++] = (byte) inputStream.read(); @@ -400,7 +400,7 @@ private List filterValidRoutes(List routes) { if (isValidRoute(route)) result.add(route); } - return result.size() > 0 ? result : null; + return !result.isEmpty() ? result : null; } protected boolean isValidRoute(GpxRoute route) { @@ -427,7 +427,7 @@ public void read(InputStream source, ParserContext context) throws IOE readFile(source, gpxContext); } List result = filterValidRoutes(gpxContext.getRoutes()); - if (result != null && result.size() > 0) { + if (result != null && !result.isEmpty()) { context.appendRoutes(result); log.fine("Successfully converted " + getName() + " to " + BABEL_INTERFACE_FORMAT_NAME); } diff --git a/navigation-formats/src/main/java/slash/navigation/babel/GarminPcx5Format.java b/navigation-formats/src/main/java/slash/navigation/babel/GarminPcx5Format.java index f8cd8ccca8..1207732d8e 100644 --- a/navigation-formats/src/main/java/slash/navigation/babel/GarminPcx5Format.java +++ b/navigation-formats/src/main/java/slash/navigation/babel/GarminPcx5Format.java @@ -61,7 +61,7 @@ protected boolean isStreamingCapable() { protected boolean isValidRoute(GpxRoute route) { // clashes with some TomTom POI .ov2 files List positions = route.getPositions(); - if (positions.size() == 0) + if (positions.isEmpty()) return false; int count = 0; for (GpxPosition position : positions) { diff --git a/navigation-formats/src/main/java/slash/navigation/base/BaseNavigationFormat.java b/navigation-formats/src/main/java/slash/navigation/base/BaseNavigationFormat.java index 1a8db41693..6838ec6718 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/BaseNavigationFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/base/BaseNavigationFormat.java @@ -45,7 +45,7 @@ protected String getCreator() { } protected List asDescription(String string) { - if (string == null || string.length() == 0) + if (string == null || string.isEmpty()) return null; List strings = new ArrayList<>(); StringTokenizer tokenizer = new StringTokenizer(string, ",\n"); diff --git a/navigation-formats/src/main/java/slash/navigation/base/BaseRoute.java b/navigation-formats/src/main/java/slash/navigation/base/BaseRoute.java index d920417295..ad98da6968 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/BaseRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/base/BaseRoute.java @@ -102,7 +102,7 @@ public abstract class BaseRoute

{ private static final String REVERSE_ROUTE_NAME_POSTFIX = " (rev)"; - private F format; + private final F format; private RouteCharacteristics characteristics; protected BaseRoute(F format, RouteCharacteristics characteristics) { @@ -358,7 +358,7 @@ public double[] getDistancesFromStart(int startIndex, int endIndex) { List

positions = getPositions(); int index = 0; double distance = 0.0; - NavigationPosition previous = positions.size() > 0 ? positions.get(0) : null; + NavigationPosition previous = !positions.isEmpty() ? positions.get(0) : null; while (index <= endIndex) { NavigationPosition next = positions.get(index); if (previous != null) { @@ -418,7 +418,7 @@ public long[] getTimesFromStart(int startIndex, int endIndex) { List

positions = getPositions(); int index = 0; long time = 0L; - NavigationPosition previous = positions.size() > 0 ? positions.get(0) : null; + NavigationPosition previous = !positions.isEmpty() ? positions.get(0) : null; while (index <= endIndex) { NavigationPosition next = positions.get(index); if (previous != null) { diff --git a/navigation-formats/src/main/java/slash/navigation/base/BaseUrlParsingFormat.java b/navigation-formats/src/main/java/slash/navigation/base/BaseUrlParsingFormat.java index 0350d9af87..0f75dbfdf1 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/BaseUrlParsingFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/base/BaseUrlParsingFormat.java @@ -56,14 +56,14 @@ protected void processURL(String url, String encoding, ParserContext return; List positions = parsePositions(parameters); - if (positions.size() > 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(Route, null, positions)); } protected abstract List parsePositions(Map> parameters); public/*for tests*/ Map> parseURLParameters(String data, String encoding) { - if (data == null || data.length() == 0) + if (data == null || data.isEmpty()) return null; try { diff --git a/navigation-formats/src/main/java/slash/navigation/base/FormatAndRoutes.java b/navigation-formats/src/main/java/slash/navigation/base/FormatAndRoutes.java index 75ecaebb80..9102ad61f6 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/FormatAndRoutes.java +++ b/navigation-formats/src/main/java/slash/navigation/base/FormatAndRoutes.java @@ -54,7 +54,7 @@ public void setFormat(NavigationFormat format) { } public BaseRoute getRoute() { - return getRoutes().size() > 0 ? getRoutes().get(0) : null; + return !getRoutes().isEmpty() ? getRoutes().get(0) : null; } public List> getRoutes() { diff --git a/navigation-formats/src/main/java/slash/navigation/base/GkPosition.java b/navigation-formats/src/main/java/slash/navigation/base/GkPosition.java index 7efc4e924e..5e4b37c08e 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/GkPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/base/GkPosition.java @@ -22,6 +22,8 @@ import slash.common.type.CompactCalendar; +import java.util.Objects; + import static slash.navigation.common.NavigationConversion.gaussKruegerRightHeightToWgs84LongitudeLatitude; import static slash.navigation.common.NavigationConversion.wgs84LongitudeLatitudeToGaussKruegerRightHeight; @@ -134,7 +136,7 @@ public boolean equals(Object o) { return Double.compare(that.height, height) == 0 && Double.compare(that.right, right) == 0 && - !(description != null ? !description.equals(that.description) : that.description != null) && + !(!Objects.equals(description, that.description)) && !(getElevation() != null ? !getElevation().equals(that.getElevation()) : that.getElevation() != null) && !(hasTime() ? !getTime().equals(that.getTime()) : that.hasTime()); } diff --git a/navigation-formats/src/main/java/slash/navigation/base/MercatorPosition.java b/navigation-formats/src/main/java/slash/navigation/base/MercatorPosition.java index 94316c1c4c..50e1d39bcc 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/MercatorPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/base/MercatorPosition.java @@ -22,6 +22,8 @@ import slash.common.type.CompactCalendar; +import java.util.Objects; + import static slash.navigation.common.NavigationConversion.*; /** @@ -121,10 +123,10 @@ public boolean equals(Object o) { MercatorPosition that = (MercatorPosition) o; - return !(description != null ? !description.equals(that.description) : that.description != null) && + return !(!Objects.equals(description, that.description)) && !(getElevation() != null ? !getElevation().equals(that.getElevation()) : that.getElevation() != null) && - !(x != null ? !x.equals(that.x) : that.x != null) && - !(y != null ? !y.equals(that.y) : that.y != null) && + !(!Objects.equals(x, that.x)) && + !(!Objects.equals(y, that.y)) && !(hasTime() ? !getTime().equals(that.getTime()) : that.hasTime()); } @@ -137,4 +139,4 @@ public int hashCode() { result = 31 * result + (hasTime() ? getTime().hashCode() : 0); return result; } -} \ No newline at end of file +} diff --git a/navigation-formats/src/main/java/slash/navigation/base/NavigationFormatParser.java b/navigation-formats/src/main/java/slash/navigation/base/NavigationFormatParser.java index ecb5b20554..c6ea8f8088 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/NavigationFormatParser.java +++ b/navigation-formats/src/main/java/slash/navigation/base/NavigationFormatParser.java @@ -135,7 +135,7 @@ private void internalRead(InputStream buffer, List formats, Pa buffer.close(); } - if (context.getRoutes().size() == 0 && context.getFormats().size() == 0 && firstSuccessfulFormat != null) + if (context.getRoutes().isEmpty() && context.getFormats().isEmpty() && firstSuccessfulFormat != null) context.addFormat(firstSuccessfulFormat); } @@ -189,12 +189,12 @@ private void commentRoute(BaseRoute route) { private ParserResult createResult(ParserContext context) throws IOException { List source = context.getRoutes(); // if (source != null && source.size() > 0) { - if (source != null && context.getFormats().size() > 0) { + if (source != null && !context.getFormats().isEmpty()) { NavigationFormat format = determineFormat(source, context.getFormats().get(0)); List destination = convertRoute(source, format); log.info("Detected '" + format.getName() + "' with " + destination.size() + " route(s) and " + getPositionCounts(destination) + " positions"); - if (destination.size() == 0) + if (destination.isEmpty()) destination.add(format.createRoute(RouteCharacteristics.Route, null, new ArrayList<>())); commentRoutes(destination); return new ParserResult(new FormatAndRoutes(format, destination)); diff --git a/navigation-formats/src/main/java/slash/navigation/base/ParserContextImpl.java b/navigation-formats/src/main/java/slash/navigation/base/ParserContextImpl.java index c5b871a6f2..e35818246b 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/ParserContextImpl.java +++ b/navigation-formats/src/main/java/slash/navigation/base/ParserContextImpl.java @@ -35,9 +35,9 @@ */ public class ParserContextImpl implements ParserContext { - private List routes = new ArrayList<>(); - private List> formats = new ArrayList<>(); - private File file; + private final List routes = new ArrayList<>(); + private final List> formats = new ArrayList<>(); + private final File file; private CompactCalendar startDate; public ParserContextImpl(File file, CompactCalendar startDate) { diff --git a/navigation-formats/src/main/java/slash/navigation/base/RouteCalculations.java b/navigation-formats/src/main/java/slash/navigation/base/RouteCalculations.java index 9f7fa87462..0b03588e83 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/RouteCalculations.java +++ b/navigation-formats/src/main/java/slash/navigation/base/RouteCalculations.java @@ -81,7 +81,7 @@ private static int[] douglasPeuckerSimplify(List p * @return an array of indices to the original list of positions with the significant positions */ public static int[] getSignificantPositions(List positions, double threshold) { - if (positions.size() == 0) + if (positions.isEmpty()) return new int[0]; else if (positions.size() == 1) return new int[]{0}; diff --git a/navigation-formats/src/main/java/slash/navigation/base/RouteComments.java b/navigation-formats/src/main/java/slash/navigation/base/RouteComments.java index 9ab6689196..a3bf048f92 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/RouteComments.java +++ b/navigation-formats/src/main/java/slash/navigation/base/RouteComments.java @@ -59,7 +59,7 @@ public static String shortenRouteName(BaseRoute route) { } public static String createRouteName(List positions) { - if (positions.size() > 0) + if (!positions.isEmpty()) return positions.get(0).getDescription() + " to " + positions.get(positions.size() - 1).getDescription(); else return "?"; @@ -98,7 +98,7 @@ public static String createRouteDescription(BaseRoute route) { List description = route.getDescription(); if (description != null && !description.isEmpty()) { - if (buffer.length() > 0) + if (!buffer.isEmpty()) buffer.append("; "); for (String line : description) @@ -347,16 +347,14 @@ public static void parseDescription(NavigationPosition position, String comment) position.setTime(parseTripmaster14Time(matcher.group(2))); position.setElevation(parseDouble(matcher.group(3))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String reason = trim(matcher.group(1)); tomTomPosition.setReason(reason); tomTomPosition.setHeading(parseTripmasterHeading(reason)); tomTomPosition.setCity(trim(matcher.group(4))); } - if (position instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) position; + if (position instanceof Wgs84Position wgs84Position) { String reason = trim(matcher.group(1)); wgs84Position.setHeading(parseTripmasterHeading(reason)); } @@ -371,8 +369,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setTime(parseTripmaster14Time(timeStr)); position.setElevation(parseDouble(matcher.group(6))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String city = trim(matcher.group(3)); if (city == null) { city = dateStr; @@ -388,8 +385,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setTime(parseTripmaster14Time(matcher.group(1))); position.setElevation(parseDouble(matcher.group(2))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { tomTomPosition.setReason("Waypoint"); tomTomPosition.setCity(null); } @@ -401,16 +397,14 @@ public static void parseDescription(NavigationPosition position, String comment) position.setTime(parseTripmaster14Time(trim(matcher.group(1)))); position.setElevation(parseDouble(matcher.group(3))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String reason = trim(matcher.group(2)); tomTomPosition.setReason(reason); tomTomPosition.setHeading(parseTripmasterHeading(reason)); tomTomPosition.setCity(null); } - if (position instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) position; + if (position instanceof Wgs84Position wgs84Position) { String reason = trim(matcher.group(2)); wgs84Position.setHeading(parseTripmasterHeading(reason)); } @@ -423,8 +417,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setTime(parseTripmaster18Date(dateStr + " " + timeStr)); position.setElevation(parseDouble(matcher.group(6))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String reason = trim(matcher.group(2)); tomTomPosition.setReason(reason); tomTomPosition.setCity(null); @@ -438,8 +431,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setTime(parseTripmaster18Date(dateStr + " " + timeStr)); position.setElevation(parseDouble(matcher.group(6))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String reason = trim(matcher.group(2)); tomTomPosition.setReason(reason); tomTomPosition.setCity(null); @@ -451,8 +443,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setTime(parseTripmaster14Time(trim(matcher.group(1)))); position.setElevation(parseDouble(matcher.group(4))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String city = trim(matcher.group(3)); if (city != null && city.startsWith(": ")) city = trim(city.substring(2)); @@ -470,8 +461,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setSpeed(parseDouble(matcher.group(6))); position.setElevation(parseDouble(matcher.group(3))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String city = trim(matcher.group(2)); if (city != null && city.startsWith(": ")) city = trim(city.substring(2)); @@ -488,8 +478,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setSpeed(parseDouble(matcher.group(9))); position.setElevation(parseDouble(matcher.group(6))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String city = trim(matcher.group(5)); if (city != null && city.startsWith(": ")) city = trim(city.substring(2)); @@ -506,8 +495,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setTime(parseLogposDate(matcher.group(1))); position.setSpeed(parseDouble(matcher.group(5))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { tomTomPosition.setReason(trim(matcher.group(4))); tomTomPosition.setCity(trim(matcher.group(3))); tomTomPosition.setHeading(parseDouble(matcher.group(6))); @@ -526,8 +514,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setElevation(elevation); position.setSpeed(parseDouble(matcher.group(7))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { tomTomPosition.setReason(trim(matcher.group(5))); tomTomPosition.setCity(trim(matcher.group(3))); tomTomPosition.setHeading(parseDouble(matcher.group(8))); @@ -542,8 +529,7 @@ public static void parseDescription(NavigationPosition position, String comment) if(elevation == null) elevation = parseDouble(matcher.group(4)); // pause with elevation position.setElevation(elevation); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { tomTomPosition.setReason(trim(matcher.group(2))); } } @@ -556,8 +542,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setElevation(parseDouble(matcher.group(6))); position.setSpeed(parseDouble(matcher.group(7))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String reason = trim(matcher.group(2)); tomTomPosition.setReason(reason); String city = trim(matcher.group(3)); @@ -573,8 +558,7 @@ public static void parseDescription(NavigationPosition position, String comment) position.setElevation(parseDouble(matcher.group(3))); position.setSpeed(parseDouble(matcher.group(4))); - if (position instanceof TomTomPosition) { - TomTomPosition tomTomPosition = (TomTomPosition) position; + if (position instanceof TomTomPosition tomTomPosition) { String city = trim(matcher.group(1)); tomTomPosition.setCity(city); tomTomPosition.setHeading(parseDouble(matcher.group(6))); diff --git a/navigation-formats/src/main/java/slash/navigation/base/SimpleLineBasedFormat.java b/navigation-formats/src/main/java/slash/navigation/base/SimpleLineBasedFormat.java index 3f2ebb81ec..68cf470c1b 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/SimpleLineBasedFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/base/SimpleLineBasedFormat.java @@ -53,7 +53,7 @@ public void read(BufferedReader reader, String encoding, ParserContext contex String line = reader.readLine(); if (line == null) break; - if (line.length() == 0) + if (line.isEmpty()) continue; if (isValidLine(line)) { @@ -67,7 +67,7 @@ public void read(BufferedReader reader, String encoding, ParserContext contex } } - if (positions.size() > 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(getRouteCharacteristics(), positions)); } diff --git a/navigation-formats/src/main/java/slash/navigation/base/SimpleRoute.java b/navigation-formats/src/main/java/slash/navigation/base/SimpleRoute.java index 46d7f3498f..9ea8da5082 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/SimpleRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/base/SimpleRoute.java @@ -53,6 +53,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteComments.createRouteName; @@ -204,7 +205,7 @@ public boolean equals(Object o) { SimpleRoute route = (SimpleRoute) o; - return !(name != null ? !name.equals(route.name) : route.name != null) && + return !(!Objects.equals(name, route.name)) && getCharacteristics().equals(route.getCharacteristics()) && positions.equals(route.positions); } diff --git a/navigation-formats/src/main/java/slash/navigation/base/WaypointType.java b/navigation-formats/src/main/java/slash/navigation/base/WaypointType.java index 035fbf8df3..b7a874bb18 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/WaypointType.java +++ b/navigation-formats/src/main/java/slash/navigation/base/WaypointType.java @@ -45,7 +45,7 @@ public enum WaypointType { Voice("V"), Waypoint("T"); - private String value; + private final String value; WaypointType(String value) { this.value = value; diff --git a/navigation-formats/src/main/java/slash/navigation/base/Wgs84Position.java b/navigation-formats/src/main/java/slash/navigation/base/Wgs84Position.java index 346bfe3006..8b776df981 100644 --- a/navigation-formats/src/main/java/slash/navigation/base/Wgs84Position.java +++ b/navigation-formats/src/main/java/slash/navigation/base/Wgs84Position.java @@ -27,6 +27,8 @@ import slash.navigation.itn.TomTomPosition; import slash.navigation.nmea.NmeaPosition; +import java.util.Objects; + import static slash.navigation.base.RouteComments.parseDescription; /** @@ -246,16 +248,16 @@ public boolean equals(Object o) { Wgs84Position that = (Wgs84Position) o; - return !(description != null ? !description.equals(that.description) : that.description != null) && + return !(!Objects.equals(description, that.description)) && !(getElevation() != null ? !getElevation().equals(that.getElevation()) : that.getElevation() != null) && - !(heading != null ? !heading.equals(that.heading) : that.heading != null) && - !(latitude != null ? !latitude.equals(that.latitude) : that.latitude != null) && - !(longitude != null ? !longitude.equals(that.longitude) : that.longitude != null) && + !(!Objects.equals(heading, that.heading)) && + !(!Objects.equals(latitude, that.latitude)) && + !(!Objects.equals(longitude, that.longitude)) && !(hasTime() ? !getTime().equals(that.getTime()) : that.hasTime()) && - !(hdop != null ? !hdop.equals(that.hdop) : that.hdop != null) && - !(pdop != null ? !pdop.equals(that.pdop) : that.pdop != null) && - !(vdop != null ? !vdop.equals(that.vdop) : that.vdop != null) && - !(satellites != null ? !satellites.equals(that.satellites) : that.satellites != null); + !(!Objects.equals(hdop, that.hdop)) && + !(!Objects.equals(pdop, that.pdop)) && + !(!Objects.equals(vdop, that.vdop)) && + !(!Objects.equals(satellites, that.satellites)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/bcr/BcrFormat.java b/navigation-formats/src/main/java/slash/navigation/bcr/BcrFormat.java index cae7120da1..1d66cc6039 100644 --- a/navigation-formats/src/main/java/slash/navigation/bcr/BcrFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/bcr/BcrFormat.java @@ -97,7 +97,7 @@ public void read(BufferedReader reader, String encoding, ParserContext String line = reader.readLine(); if (line == null) break; - if (line.length() == 0) + if (line.isEmpty()) continue; if (isSectionTitle(line)) { diff --git a/navigation-formats/src/main/java/slash/navigation/bcr/BcrPosition.java b/navigation-formats/src/main/java/slash/navigation/bcr/BcrPosition.java index 96451c0041..09fa6401b9 100644 --- a/navigation-formats/src/main/java/slash/navigation/bcr/BcrPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/bcr/BcrPosition.java @@ -28,6 +28,7 @@ import java.text.DecimalFormat; import java.util.HashMap; import java.util.Locale; +import java.util.Objects; import java.util.regex.Matcher; import static slash.common.io.Transfer.trim; @@ -91,7 +92,7 @@ public String getDescription() { String result = (getZipCode() != null ? getZipCode() + " " : "") + (getCity() != null ? getCity() : "") + (getStreet() != null ? ", " + getStreet() : ""); - return result.length() > 0 ? result : null; + return !result.isEmpty() ? result : null; } public void setDescription(String description) { @@ -115,7 +116,7 @@ public void setDescription(String description) { zipCode = null; } street = trim(matcher.group(3)); - if (street != null && STREET_DEFINES_CENTER_SYMBOL.equals(street)) + if (STREET_DEFINES_CENTER_SYMBOL.equals(street)) street = STREET_DEFINES_CENTER_NAME; this.type = trim(matcher.group(4)); } @@ -162,12 +163,12 @@ public boolean equals(Object o) { BcrPosition that = (BcrPosition) o; return altitude == that.altitude && - !(x != null ? !x.equals(that.x) : that.x != null) && - !(y != null ? !y.equals(that.y) : that.y != null) && - !(description != null ? !description.equals(that.description) : that.description != null) && - !(street != null ? !street.equals(that.street) : that.street != null) && - !(type != null ? !type.equals(that.type) : that.type != null) && - !(zipCode != null ? !zipCode.equals(that.zipCode) : that.zipCode != null); + !(!Objects.equals(x, that.x)) && + !(!Objects.equals(y, that.y)) && + !(!Objects.equals(description, that.description)) && + !(!Objects.equals(street, that.street)) && + !(!Objects.equals(type, that.type)) && + !(!Objects.equals(zipCode, that.zipCode)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/bcr/BcrRoute.java b/navigation-formats/src/main/java/slash/navigation/bcr/BcrRoute.java index 5248112f6c..027dd9e924 100644 --- a/navigation-formats/src/main/java/slash/navigation/bcr/BcrRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/bcr/BcrRoute.java @@ -65,8 +65,8 @@ */ public class BcrRoute extends BaseRoute { - private List sections; - private List positions; + private final List sections; + private final List positions; public BcrRoute(BcrFormat format, List sections, List positions) { super(format, Route); diff --git a/navigation-formats/src/main/java/slash/navigation/columbus/ColumbusGpsBinaryFormat.java b/navigation-formats/src/main/java/slash/navigation/columbus/ColumbusGpsBinaryFormat.java index ac6306679a..b9eff0b196 100644 --- a/navigation-formats/src/main/java/slash/navigation/columbus/ColumbusGpsBinaryFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/columbus/ColumbusGpsBinaryFormat.java @@ -105,7 +105,7 @@ public void read(InputStream source, ParserContext context) throws I body.position(0); List positions = internalRead(body); - if (positions.size() > 0) + if (!positions.isEmpty()) context.appendRoute(new Wgs84Route(this, Track, null, positions)); } } @@ -142,7 +142,7 @@ private List internalRead(ByteBuffer buffer) { double pressure = buffer.getShort() / PRESSURE_FACTOR; double temperature = buffer.getShort() / TEMPERATURE_FACTOR; - Wgs84Position position = new Wgs84Position(longitude, latitude, altitude, speed, time, "Trackpoint " + String.valueOf(index)); + Wgs84Position position = new Wgs84Position(longitude, latitude, altitude, speed, time, "Trackpoint " + index); position.setHeading(heading); position.setPressure(pressure); position.setTemperature(temperature); diff --git a/navigation-formats/src/main/java/slash/navigation/copilot/CoPilotFormat.java b/navigation-formats/src/main/java/slash/navigation/copilot/CoPilotFormat.java index b60a25273c..db57e91e46 100644 --- a/navigation-formats/src/main/java/slash/navigation/copilot/CoPilotFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/copilot/CoPilotFormat.java @@ -85,7 +85,7 @@ public

Wgs84Route createRoute(RouteCharacteristic public BaseNavigationPosition getDuplicateFirstPosition(BaseRoute route) { List positions = route.getPositions(); - if (positions.size() == 0) + if (positions.isEmpty()) return null; NavigationPosition first = positions.get(0); return asWgs84Position(first.getLongitude(), first.getLatitude(), "Start:" + first.getDescription()); @@ -123,7 +123,7 @@ public void read(BufferedReader reader, String encoding, ParserContext 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(Route, routeName, positions)); } diff --git a/navigation-formats/src/main/java/slash/navigation/csv/CsvFormat.java b/navigation-formats/src/main/java/slash/navigation/csv/CsvFormat.java index 9e05714894..37712554b8 100644 --- a/navigation-formats/src/main/java/slash/navigation/csv/CsvFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/csv/CsvFormat.java @@ -126,7 +126,7 @@ protected boolean read(Reader reader, ParserContext context) throws IO reader.close(); } - if (positions.size() > 0) { + if (!positions.isEmpty()) { context.appendRoute(new CsvRoute(this, null, positions)); return true; } else diff --git a/navigation-formats/src/main/java/slash/navigation/csv/CsvRoute.java b/navigation-formats/src/main/java/slash/navigation/csv/CsvRoute.java index 2c5440b0f8..d2512272fb 100644 --- a/navigation-formats/src/main/java/slash/navigation/csv/CsvRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/csv/CsvRoute.java @@ -51,6 +51,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.ExtendedSensorNavigationPosition.transferExtendedSensorData; import static slash.navigation.base.RouteCharacteristics.Track; @@ -64,7 +65,7 @@ public class CsvRoute extends BaseRoute { private String name; - private List positions; + private final List positions; public CsvRoute(CsvFormat format, String name, List positions) { super(format, Track); @@ -198,8 +199,8 @@ public boolean equals(Object o) { CsvRoute csvRoute = (CsvRoute) o; - return (name != null ? name.equals(csvRoute.name) : csvRoute.name == null) && - (positions != null ? positions.equals(csvRoute.positions) : csvRoute.positions == null); + return (Objects.equals(name, csvRoute.name)) && + (Objects.equals(positions, csvRoute.positions)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/excel/ColumnTypeToRowIndexMapping.java b/navigation-formats/src/main/java/slash/navigation/excel/ColumnTypeToRowIndexMapping.java index aaf8725120..db600cfda6 100644 --- a/navigation-formats/src/main/java/slash/navigation/excel/ColumnTypeToRowIndexMapping.java +++ b/navigation-formats/src/main/java/slash/navigation/excel/ColumnTypeToRowIndexMapping.java @@ -46,7 +46,7 @@ class ColumnTypeToRowIndexMapping { DEFAULT.add(8, Description); } - private Map mapping = new LinkedHashMap<>(); + private final Map mapping = new LinkedHashMap<>(); public void add(int index, ColumnType columnType) { mapping.put(index, columnType); diff --git a/navigation-formats/src/main/java/slash/navigation/excel/ExcelPosition.java b/navigation-formats/src/main/java/slash/navigation/excel/ExcelPosition.java index d6d1db0224..e23caab911 100644 --- a/navigation-formats/src/main/java/slash/navigation/excel/ExcelPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/excel/ExcelPosition.java @@ -41,7 +41,7 @@ public class ExcelPosition extends BaseNavigationPosition implements ExtendedSensorNavigationPosition { private ColumnTypeToRowIndexMapping mapping = DEFAULT; - private Row row; + private final Row row; public ExcelPosition(Row row, ColumnTypeToRowIndexMapping mapping) { this.row = row; diff --git a/navigation-formats/src/main/java/slash/navigation/excel/ExcelRoute.java b/navigation-formats/src/main/java/slash/navigation/excel/ExcelRoute.java index 89e3bde795..ac92de09c1 100644 --- a/navigation-formats/src/main/java/slash/navigation/excel/ExcelRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/excel/ExcelRoute.java @@ -55,6 +55,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteCharacteristics.Track; import static slash.navigation.base.RouteComments.createRouteName; @@ -67,9 +68,9 @@ */ public class ExcelRoute extends BaseRoute { - private Sheet sheet; + private final Sheet sheet; private ColumnTypeToRowIndexMapping mapping = DEFAULT; - private List positions; + private final List positions; public ExcelRoute(ExcelFormat format, Sheet sheet, ColumnTypeToRowIndexMapping mapping, List positions) { super(format, Track); @@ -309,8 +310,8 @@ public boolean equals(Object o) { ExcelRoute that = (ExcelRoute) o; return !(getName() != null ? !getName().equals(that.getName()) : that.getName() != null) && - !(mapping != null ? !mapping.equals(that.mapping) : that.mapping != null) && - !(positions != null ? !positions.equals(that.positions) : that.positions != null); + !(!Objects.equals(mapping, that.mapping)) && + !(!Objects.equals(positions, that.positions)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/excel/MicrosoftExcel2008Format.java b/navigation-formats/src/main/java/slash/navigation/excel/MicrosoftExcel2008Format.java index 0c035e0b75..3f9dd07c5a 100644 --- a/navigation-formats/src/main/java/slash/navigation/excel/MicrosoftExcel2008Format.java +++ b/navigation-formats/src/main/java/slash/navigation/excel/MicrosoftExcel2008Format.java @@ -74,7 +74,7 @@ public void write(ExcelRoute route, OutputStream target, int startIndex, int end } public void write(List routes, OutputStream target) throws IOException { - if(routes.size() == 0) + if(routes.isEmpty()) return; Workbook workbook = routes.get(0).getWorkbook(); diff --git a/navigation-formats/src/main/java/slash/navigation/excel/MicrosoftExcel97Format.java b/navigation-formats/src/main/java/slash/navigation/excel/MicrosoftExcel97Format.java index 2d8d1de9b9..e7a1a1c02a 100644 --- a/navigation-formats/src/main/java/slash/navigation/excel/MicrosoftExcel97Format.java +++ b/navigation-formats/src/main/java/slash/navigation/excel/MicrosoftExcel97Format.java @@ -69,7 +69,7 @@ public void write(ExcelRoute route, OutputStream target, int startIndex, int end } public void write(List routes, OutputStream target) throws IOException { - if(routes.size() == 0) + if(routes.isEmpty()) return; Workbook workbook = routes.get(0).getWorkbook(); diff --git a/navigation-formats/src/main/java/slash/navigation/fit/FitFormat.java b/navigation-formats/src/main/java/slash/navigation/fit/FitFormat.java index fb4e2aadf6..32e7011cc9 100644 --- a/navigation-formats/src/main/java/slash/navigation/fit/FitFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/fit/FitFormat.java @@ -106,7 +106,7 @@ public void read(InputStream source, ParserContext context) throws I } List positions = parser.getPositions(); - if (positions.size() > 0) + if (!positions.isEmpty()) context.appendRoute(new Wgs84Route(this, parser.getCharacteristics(), parser.getName(), positions)); } diff --git a/navigation-formats/src/main/java/slash/navigation/fpl/CountryCode.java b/navigation-formats/src/main/java/slash/navigation/fpl/CountryCode.java index 5c458cf364..796377e844 100644 --- a/navigation-formats/src/main/java/slash/navigation/fpl/CountryCode.java +++ b/navigation-formats/src/main/java/slash/navigation/fpl/CountryCode.java @@ -344,7 +344,7 @@ public enum CountryCode { Zambia("FL"), Zimbabwe("FV"); - private String value; + private final String value; CountryCode(String value) { this.value = value; diff --git a/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanFormat.java b/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanFormat.java index 626cbfc0e4..4bbb1240e1 100644 --- a/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanFormat.java @@ -151,7 +151,7 @@ public static CountryCode createValidCountryCode(GarminFlightPlanPosition positi String identifier = position.getIdentifier(); if (identifier != null) { // extra rule for the United States - if (identifier.length() > 0 && identifier.charAt(0) == 'K') + if (!identifier.isEmpty() && identifier.charAt(0) == 'K') return United_States; if (identifier.length() >= COUNTRY_CODE_IDENTIFIER_LENGTH) { diff --git a/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanPosition.java b/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanPosition.java index ea681d1e56..d06e8a6918 100644 --- a/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanPosition.java @@ -24,6 +24,7 @@ import slash.navigation.base.Wgs84Position; import java.math.BigDecimal; +import java.util.Objects; import static slash.common.io.Transfer.formatDouble; import static slash.common.io.Transfer.trim; @@ -94,8 +95,8 @@ public boolean equals(Object o) { GarminFlightPlanPosition that = (GarminFlightPlanPosition) o; - return !(countryCode != null ? !countryCode.equals(that.countryCode) : that.countryCode != null) && - !(identifier != null ? !identifier.equals(that.identifier) : that.identifier != null) && + return !(!Objects.equals(countryCode, that.countryCode)) && + !(!Objects.equals(identifier, that.identifier)) && waypointType == that.waypointType; } diff --git a/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanRoute.java b/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanRoute.java index 6796d7a70a..8f09151dfd 100644 --- a/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/fpl/GarminFlightPlanRoute.java @@ -55,6 +55,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteCharacteristics.Track; import static slash.navigation.base.RouteComments.createRouteName; @@ -67,8 +68,8 @@ public class GarminFlightPlanRoute extends BaseRoute { private String name; - private List description; - private List positions; + private final List description; + private final List positions; public GarminFlightPlanRoute(String name, List description, List positions) { super(new GarminFlightPlanFormat(), Track); @@ -209,8 +210,8 @@ public boolean equals(Object o) { GarminFlightPlanRoute that = (GarminFlightPlanRoute) o; - return !(name != null ? !name.equals(that.name) : that.name != null) && - !(positions != null ? !positions.equals(that.positions) : that.positions != null); + return !(!Objects.equals(name, that.name)) && + !(!Objects.equals(positions, that.positions)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/gopal/GoPalPosition.java b/navigation-formats/src/main/java/slash/navigation/gopal/GoPalPosition.java index 93342ec930..12f0d886ba 100644 --- a/navigation-formats/src/main/java/slash/navigation/gopal/GoPalPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/gopal/GoPalPosition.java @@ -26,6 +26,7 @@ import slash.navigation.tour.TourPosition; import java.util.HashMap; +import java.util.Objects; /** * Represents a position in a GoPal 3 or 5 Route (.xml) file. @@ -57,7 +58,7 @@ public String getDescription() { (getCity() != null ? getCity() : "") + (getStreet() != null ? ", " + getStreet() : "") + (getHouseNumber() != null ? " " + getHouseNumber() : ""); - return result.length() > 0 ? result : null; + return !result.isEmpty() ? result : null; } public void setDescription(String description) { @@ -124,15 +125,15 @@ public boolean equals(Object o) { GoPalPosition that = (GoPalPosition) o; - return !(x != null ? !x.equals(that.x) : that.x != null) && - !(y != null ? !y.equals(that.y) : that.y != null) && - !(country != null ? !country.equals(that.country) : that.country != null) && - !(zipCode != null ? !zipCode.equals(that.zipCode) : that.zipCode != null) && - !(description != null ? !description.equals(that.description) : that.description != null) && - !(suburb != null ? !suburb.equals(that.suburb) : that.suburb != null) && - !(street != null ? !street.equals(that.street) : that.street != null) && - !(sideStreet != null ? !sideStreet.equals(that.sideStreet) : that.sideStreet != null) && - !(houseNumber != null ? !houseNumber.equals(that.houseNumber) : that.houseNumber != null); + return !(!Objects.equals(x, that.x)) && + !(!Objects.equals(y, that.y)) && + !(!Objects.equals(country, that.country)) && + !(!Objects.equals(zipCode, that.zipCode)) && + !(!Objects.equals(description, that.description)) && + !(!Objects.equals(suburb, that.suburb)) && + !(!Objects.equals(street, that.street)) && + !(!Objects.equals(sideStreet, that.sideStreet)) && + !(!Objects.equals(houseNumber, that.houseNumber)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/gopal/GoPalRoute.java b/navigation-formats/src/main/java/slash/navigation/gopal/GoPalRoute.java index 6f30fca9d4..47063f8f55 100644 --- a/navigation-formats/src/main/java/slash/navigation/gopal/GoPalRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/gopal/GoPalRoute.java @@ -52,6 +52,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteCharacteristics.Route; import static slash.navigation.base.RouteComments.createRouteName; @@ -212,8 +213,8 @@ public boolean equals(Object o) { GoPalRoute gopalRoute = (GoPalRoute) o; - return !(name != null ? !name.equals(gopalRoute.name) : gopalRoute.name != null) && - !(positions != null ? !positions.equals(gopalRoute.positions) : gopalRoute.positions != null); + return !(!Objects.equals(name, gopalRoute.name)) && + !(!Objects.equals(positions, gopalRoute.positions)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/gpx/Gpx10Format.java b/navigation-formats/src/main/java/slash/navigation/gpx/Gpx10Format.java index efe9e05dfb..3bd9cde635 100644 --- a/navigation-formats/src/main/java/slash/navigation/gpx/Gpx10Format.java +++ b/navigation-formats/src/main/java/slash/navigation/gpx/Gpx10Format.java @@ -104,7 +104,7 @@ private GpxRoute extractWayPoints(Gpx gpx, boolean hasSpeedInKiloMeterPerHourIns String name = gpx.getName(); List descriptions = asDescription(gpx.getDesc()); List positions = extractWayPoints(gpx.getWpt(), hasSpeedInKiloMeterPerHourInsteadOfMeterPerSecond); - return positions.size() == 0 ? null : new GpxRoute(this, isTripmasterTrack(positions) ? Track : Waypoints, name, descriptions, positions, gpx); + return positions.isEmpty() ? null : new GpxRoute(this, isTripmasterTrack(positions) ? Track : Waypoints, name, descriptions, positions, gpx); } private boolean isTripmasterTrack(List positions) { @@ -122,7 +122,7 @@ private List extractTracks(Gpx gpx, boolean hasSpeedInKiloMeterPerHour String desc = trk.getDesc(); List descriptions = asDescription(desc); List positions = extractTrack(trk, hasSpeedInKiloMeterPerHourInsteadOfMeterPerSecond); - if (positions.size() > 0) + if (!positions.isEmpty()) result.add(new GpxRoute(this, Track, name, descriptions, positions, gpx, trk)); } return result; diff --git a/navigation-formats/src/main/java/slash/navigation/gpx/Gpx11Format.java b/navigation-formats/src/main/java/slash/navigation/gpx/Gpx11Format.java index 02fbdeb4e3..6db25c3be7 100644 --- a/navigation-formats/src/main/java/slash/navigation/gpx/Gpx11Format.java +++ b/navigation-formats/src/main/java/slash/navigation/gpx/Gpx11Format.java @@ -114,7 +114,7 @@ private GpxRoute extractWayPoints(GpxType gpxType) { String desc = gpxType.getMetadata() != null ? gpxType.getMetadata().getDesc() : null; List descriptions = asDescription(desc); List positions = extractWayPoints(gpxType.getWpt()); - return positions.size() == 0 ? null : new GpxRoute(this, Waypoints, name, descriptions, positions, gpxType); + return positions.isEmpty() ? null : new GpxRoute(this, Waypoints, name, descriptions, positions, gpxType); } private List extractTracks(GpxType gpxType) { @@ -152,8 +152,7 @@ private List extractRouteWithRoutePointExtension(RteType rteType) { for (Object any : extensions.getAny()) { if (any instanceof JAXBElement) { Object anyValue = ((JAXBElement) any).getValue(); - if (anyValue instanceof RoutePointExtensionT) { - RoutePointExtensionT routePoint = (RoutePointExtensionT) anyValue; + if (anyValue instanceof RoutePointExtensionT routePoint) { for (AutoroutePointT autoroutePoint : routePoint.getRpt()) { positions.add(new GpxPosition(autoroutePoint.getLon(), autoroutePoint.getLat(), null, null, null, null, null, null, null, null, null, null)); } @@ -234,8 +233,7 @@ private void clearDistance(TrkType trkType) { for (Iterator iterator = anys.iterator(); iterator.hasNext(); ) { Object any = iterator.next(); - if (any instanceof Element) { - Element element = (Element) any; + if (any instanceof Element element) { // TrackStatsExtension contains Distance element which BaseCamp uses if it's present // but which might be inaccurate due to changes to the positions that affect the distance diff --git a/navigation-formats/src/main/java/slash/navigation/gpx/GpxPosition.java b/navigation-formats/src/main/java/slash/navigation/gpx/GpxPosition.java index b0010a12da..4c06866366 100644 --- a/navigation-formats/src/main/java/slash/navigation/gpx/GpxPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/gpx/GpxPosition.java @@ -29,6 +29,7 @@ import java.math.BigDecimal; import java.math.BigInteger; +import java.util.Objects; import java.util.regex.Matcher; import static slash.common.io.Transfer.*; @@ -211,17 +212,17 @@ public boolean equals(Object o) { GpxPosition that = (GpxPosition) o; - return !(description != null ? !description.equals(that.description) : that.description != null) && + return !(!Objects.equals(description, that.description)) && !(getElevation() != null ? !getElevation().equals(that.getElevation()) : that.getElevation() != null) && - !(heading != null ? !heading.equals(that.heading) : that.heading != null) && - !(temperature != null ? !temperature.equals(that.temperature) : that.temperature != null) && - !(latitude != null ? !latitude.equals(that.latitude) : that.latitude != null) && - !(longitude != null ? !longitude.equals(that.longitude) : that.longitude != null) && + !(!Objects.equals(heading, that.heading)) && + !(!Objects.equals(temperature, that.temperature)) && + !(!Objects.equals(latitude, that.latitude)) && + !(!Objects.equals(longitude, that.longitude)) && !(hasTime() ? !getTime().equals(that.getTime()) : that.hasTime()) && - !(hdop != null ? !hdop.equals(that.hdop) : that.hdop != null) && - !(pdop != null ? !pdop.equals(that.pdop) : that.pdop != null) && - !(vdop != null ? !vdop.equals(that.vdop) : that.vdop != null) && - !(satellites != null ? !satellites.equals(that.satellites) : that.satellites != null); + !(!Objects.equals(hdop, that.hdop)) && + !(!Objects.equals(pdop, that.pdop)) && + !(!Objects.equals(vdop, that.vdop)) && + !(!Objects.equals(satellites, that.satellites)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/gpx/GpxPositionExtension.java b/navigation-formats/src/main/java/slash/navigation/gpx/GpxPositionExtension.java index a370a3bc4e..00a6c1302d 100644 --- a/navigation-formats/src/main/java/slash/navigation/gpx/GpxPositionExtension.java +++ b/navigation-formats/src/main/java/slash/navigation/gpx/GpxPositionExtension.java @@ -71,8 +71,7 @@ Set getExtensionTypes() { extensionTypes.add(TrackPoint2); } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if (isWellKnownElementName(element)) { extensionTypes.add(Text); } @@ -94,13 +93,11 @@ public Double getHeading() { for (Object any : extensions.getAny()) { if (any instanceof JAXBElement) { Object anyValue = ((JAXBElement) any).getValue(); - if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT) { - slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint2.TrackPointExtensionT) anyValue; + if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint) { result = formatDouble(trackPoint.getCourse()); } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if ("course".equalsIgnoreCase(element.getLocalName())) result = parseDouble(element.getTextContent()); } @@ -122,14 +119,12 @@ public void setHeading(Double heading) { for (Object any : anys) { if (any instanceof JAXBElement) { Object anyValue = ((JAXBElement) any).getValue(); - if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT) { - slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint2.TrackPointExtensionT) anyValue; + if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint) { trackPoint.setCourse(formatHeading(heading)); foundHeading = true; } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if ("course".equalsIgnoreCase(element.getLocalName())) { element.setTextContent(formatHeadingAsString(heading)); foundHeading = true; @@ -153,13 +148,11 @@ public Double getSpeed() { for (Object any : extensions.getAny()) { if (any instanceof JAXBElement) { Object anyValue = ((JAXBElement) any).getValue(); - if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT) { - slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint2.TrackPointExtensionT) anyValue; + if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint) { result = msToKmh(trackPoint.getSpeed()); } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if ("speed".equalsIgnoreCase(element.getLocalName())) result = msToKmh(parseDouble(element.getTextContent())); } @@ -181,14 +174,12 @@ public void setSpeed(Double speed) { for (Object any : anys) { if (any instanceof JAXBElement) { Object anyValue = ((JAXBElement) any).getValue(); - if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT) { - slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint2.TrackPointExtensionT) anyValue; + if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint) { trackPoint.setSpeed(formatSpeedAsDouble(kmhToMs(speed))); foundSpeed = true; } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if ("speed".equalsIgnoreCase(element.getLocalName())) { element.setTextContent(formatSpeedAsString(kmhToMs(speed))); foundSpeed = true; @@ -230,8 +221,7 @@ public Double getTemperature() { result = trackPoint.getWtemp(); } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if ("temperature".equalsIgnoreCase(element.getLocalName())) result = parseDouble(element.getTextContent()); } @@ -273,8 +263,7 @@ public void setTemperature(Double temperature) { foundTemperature = true; } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if ("temperature".equalsIgnoreCase(element.getLocalName())) { element.setTextContent(formatTemperatureAsString(temperature)); foundTemperature = true; @@ -308,8 +297,7 @@ public Short getHeartBeat() { result = trackPoint.getHr(); } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if ("hr".equalsIgnoreCase(element.getLocalName())) result = parseShort(element.getTextContent()); } @@ -341,8 +329,7 @@ public void setHeartBeat(Short heartBeat) { foundHeartBeat = true; } - } else if (any instanceof Element) { - Element element = (Element) any; + } else if (any instanceof Element element) { if ("hr".equalsIgnoreCase(element.getLocalName())) { element.setTextContent(formatShortAsString(heartBeat)); foundHeartBeat = true; @@ -418,20 +405,20 @@ public void mergeExtensions() { private boolean isEmptyExtension(slash.navigation.gpx.garmin3.TrackPointExtensionT trackPoint) { return isEmpty(trackPoint.getDepth()) && isEmpty(trackPoint.getTemperature()) && - (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().size() == 0); + (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().isEmpty()); } private boolean isEmptyExtension(slash.navigation.gpx.trackpoint1.TrackPointExtensionT trackPoint) { return isEmpty(trackPoint.getAtemp()) && isEmpty(trackPoint.getCad()) && isEmpty(trackPoint.getDepth()) && isEmpty(trackPoint.getHr()) && isEmpty(trackPoint.getWtemp()) && - (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().size() == 0); + (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().isEmpty()); } private boolean isEmptyExtension(slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint) { return isEmpty(trackPoint.getAtemp()) && isEmpty(trackPoint.getBearing()) && isEmpty(trackPoint.getCad()) && isEmpty(trackPoint.getCourse()) && isEmpty(trackPoint.getDepth()) && isEmpty(trackPoint.getHr()) && isEmpty(trackPoint.getSpeed()) && isEmpty(trackPoint.getWtemp()) && - (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().size() == 0); + (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().isEmpty()); } private void removeExtension(Object extension) { @@ -466,8 +453,7 @@ public void removeEmptyExtensions() { for (Iterator iterator = anys.iterator(); iterator.hasNext(); ) { Object any = iterator.next(); - if (any instanceof Element) { - Element element = (Element) any; + if (any instanceof Element element) { if (isWellKnownElementName(element)) { if (isEmpty(parseDouble(element.getTextContent()))) iterator.remove(); @@ -475,7 +461,7 @@ public void removeEmptyExtensions() { } } - if (wptType.getExtensions() != null && wptType.getExtensions().getAny().size() == 0) + if (wptType.getExtensions() != null && wptType.getExtensions().getAny().isEmpty()) wptType.setExtensions(null); } } diff --git a/navigation-formats/src/main/java/slash/navigation/gpx/GpxRoute.java b/navigation-formats/src/main/java/slash/navigation/gpx/GpxRoute.java index 92d7d40f03..0a1546d4fc 100644 --- a/navigation-formats/src/main/java/slash/navigation/gpx/GpxRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/gpx/GpxRoute.java @@ -52,6 +52,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; @@ -68,9 +69,9 @@ public class GpxRoute extends BaseRoute { private String name; - private List description; - private List positions; - private List origins; + private final List description; + private final List positions; + private final List origins; public GpxRoute(GpxFormat format, RouteCharacteristics characteristics, String name, List description, List positions, @@ -239,8 +240,8 @@ public boolean equals(Object o) { final GpxRoute gpxRoute = (GpxRoute) o; - return !(description != null ? !description.equals(gpxRoute.description) : gpxRoute.description != null) && - !(name != null ? !name.equals(gpxRoute.name) : gpxRoute.name != null) && + return !(!Objects.equals(description, gpxRoute.description)) && + !(!Objects.equals(name, gpxRoute.name)) && getCharacteristics().equals(gpxRoute.getCharacteristics()) && positions.equals(gpxRoute.positions); } diff --git a/navigation-formats/src/main/java/slash/navigation/itn/TomTomPosition.java b/navigation-formats/src/main/java/slash/navigation/itn/TomTomPosition.java index 3befa15830..4b8e4e95e4 100644 --- a/navigation-formats/src/main/java/slash/navigation/itn/TomTomPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/itn/TomTomPosition.java @@ -26,6 +26,8 @@ import slash.navigation.gpx.GpxPosition; import slash.navigation.nmea.NmeaPosition; +import java.util.Objects; + import static slash.navigation.base.RouteComments.parseDescription; /** @@ -188,12 +190,12 @@ public boolean equals(Object o) { TomTomPosition that = (TomTomPosition) o; - return !(city != null ? !city.equals(that.city) : that.city != null) && + return !(!Objects.equals(city, that.city)) && !(getElevation() != null ? !getElevation().equals(that.getElevation()) : that.getElevation() != null) && - !(heading != null ? !heading.equals(that.heading) : that.heading != null) && - !(latitude != null ? !latitude.equals(that.latitude) : that.latitude != null) && - !(longitude != null ? !longitude.equals(that.longitude) : that.longitude != null) && - !(reason != null ? !reason.equals(that.reason) : that.reason != null) && + !(!Objects.equals(heading, that.heading)) && + !(!Objects.equals(latitude, that.latitude)) && + !(!Objects.equals(longitude, that.longitude)) && + !(!Objects.equals(reason, that.reason)) && !(hasTime() ? !getTime().equals(that.getTime()) : that.hasTime()); } diff --git a/navigation-formats/src/main/java/slash/navigation/itn/TomTomRoute.java b/navigation-formats/src/main/java/slash/navigation/itn/TomTomRoute.java index 5bde1a8f10..7ed41e3282 100644 --- a/navigation-formats/src/main/java/slash/navigation/itn/TomTomRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/itn/TomTomRoute.java @@ -51,6 +51,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteComments.createRouteName; @@ -62,7 +63,7 @@ public class TomTomRoute extends BaseRoute { private String name; - private List positions; + private final List positions; public TomTomRoute(TomTomRouteFormat format, RouteCharacteristics characteristics, String name, List positions) { super(format, characteristics); @@ -208,7 +209,7 @@ public boolean equals(Object o) { TomTomRoute route = (TomTomRoute) o; - return !(name != null ? !name.equals(route.name) : route.name != null) && + return !(!Objects.equals(name, route.name)) && getCharacteristics().equals(route.getCharacteristics()) && positions.equals(route.positions); } diff --git a/navigation-formats/src/main/java/slash/navigation/itn/TomTomRouteFormat.java b/navigation-formats/src/main/java/slash/navigation/itn/TomTomRouteFormat.java index f920cc30f1..d6e2e5e950 100644 --- a/navigation-formats/src/main/java/slash/navigation/itn/TomTomRouteFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/itn/TomTomRouteFormat.java @@ -102,7 +102,7 @@ public void read(BufferedReader reader, String encoding, ParserContext 0) + if (!positions.isEmpty()) context.appendRoute(new TomTomRoute(this, isTrack(positions) ? Track : Route, routeName, positions)); else throw new IllegalArgumentException(format("Format %s cannot find positions; exiting", getName())); diff --git a/navigation-formats/src/main/java/slash/navigation/klicktel/KlickTelRoute.java b/navigation-formats/src/main/java/slash/navigation/klicktel/KlickTelRoute.java index 0063e43066..16dac09922 100644 --- a/navigation-formats/src/main/java/slash/navigation/klicktel/KlickTelRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/klicktel/KlickTelRoute.java @@ -56,6 +56,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteCharacteristics.Route; import static slash.navigation.base.RouteComments.createRouteName; @@ -68,8 +69,8 @@ public class KlickTelRoute extends BaseRoute { private String name; - private KDRoute.RouteOptions options; - private List positions; + private final KDRoute.RouteOptions options; + private final List positions; public KlickTelRoute(String name, List positions) { this(name, defaultOptions(), positions); @@ -222,8 +223,8 @@ public boolean equals(Object o) { KlickTelRoute klicktelRoute = (KlickTelRoute) o; - return !(name != null ? !name.equals(klicktelRoute.name) : klicktelRoute.name != null) && - !(positions != null ? !positions.equals(klicktelRoute.positions) : klicktelRoute.positions != null); + return !(!Objects.equals(name, klicktelRoute.name)) && + !(!Objects.equals(positions, klicktelRoute.positions)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/kml/Kml20Format.java b/navigation-formats/src/main/java/slash/navigation/kml/Kml20Format.java index d5b4916ff9..54917bbf1e 100644 --- a/navigation-formats/src/main/java/slash/navigation/kml/Kml20Format.java +++ b/navigation-formats/src/main/java/slash/navigation/kml/Kml20Format.java @@ -58,26 +58,23 @@ public String getName() { public void read(InputStream source, ParserContext context) throws IOException { Object o = unmarshal20(source); - if (o instanceof Kml) { - Kml kml = (Kml) o; + if (o instanceof Kml kml) { extractTracks(kml.getDocument(), kml.getFolder(), context); } - if (o instanceof Document) { - Document document = (Document) o; + if (o instanceof Document document) { extractTracks(document, null, context); } - if (o instanceof Folder) { - Folder folder = (Folder) o; + if (o instanceof Folder folder) { extractTracks(null, folder, context); } } private void extractTracks(Document document, Folder folder, ParserContext context) throws IOException { List elements = null; - if (document != null && document.getDocumentOrFolderOrGroundOverlay().size() > 0) + if (document != null && !document.getDocumentOrFolderOrGroundOverlay().isEmpty()) elements = document.getDocumentOrFolderOrGroundOverlay(); - if (folder != null && folder.getDocumentOrFolderOrGroundOverlay().size() > 0) + if (folder != null && !folder.getDocumentOrFolderOrGroundOverlay().isEmpty()) elements = folder.getDocumentOrFolderOrGroundOverlay(); if (elements != null) @@ -86,8 +83,7 @@ private void extractTracks(Document document, Folder folder, ParserContext d context.appendRoute(new KmlRoute(this, characteristics, routeName, routeDescription, positions)); } } - if (waypoints.size() != 0) { + if (!waypoints.isEmpty()) { RouteCharacteristics characteristics = parseCharacteristics(name, null, Waypoints); context.prependRoute(new KmlRoute(this, characteristics, name, description, waypoints)); } @@ -230,20 +226,17 @@ private List extractPositions(LineString lineString) { private List extractPositions(List elements) { List result = new ArrayList<>(); for (Object element : elements) { - if (element instanceof Point) { - Point point = (Point) element; + if (element instanceof Point point) { result.add(asKmlPosition(parsePosition(point.getCoordinates(), null))); } if (element instanceof LineString) { LineString lineString = (LineString) element; result.addAll(extractPositions(lineString)); } - if (element instanceof MultiGeometry) { - MultiGeometry multiGeometry = (MultiGeometry) element; + if (element instanceof MultiGeometry multiGeometry) { result.addAll(extractPositions(multiGeometry.getExtrudeOrTessellateOrAltitudeMode())); } - if (element instanceof GeometryCollection) { - GeometryCollection geometryCollection = (GeometryCollection) element; + if (element instanceof GeometryCollection geometryCollection) { for (LineString lineString : geometryCollection.getLineString()) result.addAll(extractPositions(lineString)); } diff --git a/navigation-formats/src/main/java/slash/navigation/kml/Kml21Format.java b/navigation-formats/src/main/java/slash/navigation/kml/Kml21Format.java index ff386e29f8..20c0c3af47 100644 --- a/navigation-formats/src/main/java/slash/navigation/kml/Kml21Format.java +++ b/navigation-formats/src/main/java/slash/navigation/kml/Kml21Format.java @@ -78,8 +78,7 @@ private List> find(List> e private void extractTracks(KmlType kmlType, ParserContext context) throws IOException { FeatureType feature = kmlType.getFeature().getValue(); - if (feature instanceof ContainerType) { - ContainerType containerType = (ContainerType) feature; + if (feature instanceof ContainerType containerType) { List> features = null; if (containerType instanceof FolderType) features = ((FolderType) containerType).getFeature(); @@ -88,8 +87,7 @@ else if (containerType instanceof DocumentType) extractTracks(trim(containerType.getName()), trim(containerType.getDescription()), features, context); } - if (feature instanceof PlacemarkType) { - PlacemarkType placemarkType = (PlacemarkType) feature; + if (feature instanceof PlacemarkType placemarkType) { String placemarkName = asDescription(trim(placemarkType.getName()), trim(placemarkType.getDescription())); @@ -144,7 +142,7 @@ private void extractWayPointsAndTracksFromPlacemarks(String name, String descrip context.appendRoute(new KmlRoute(this, characteristics, routeName, routeDescription, positions)); } } - if (waypoints.size() > 0) { + if (!waypoints.isEmpty()) { RouteCharacteristics characteristics = parseCharacteristics(name, null, Waypoints); context.prependRoute(new KmlRoute(this, characteristics, name, asDescription(description), waypoints)); } @@ -164,16 +162,13 @@ private List extractPositions(JAXBElement g List positions = new ArrayList<>(); if (geometryType != null) { GeometryType geometryTypeValue = geometryType.getValue(); - if (geometryTypeValue instanceof PointType) { - PointType point = (PointType) geometryTypeValue; + if (geometryTypeValue instanceof PointType point) { positions.addAll(asKmlPositions(point.getCoordinates())); } - if (geometryTypeValue instanceof LineStringType) { - LineStringType lineString = (LineStringType) geometryTypeValue; + if (geometryTypeValue instanceof LineStringType lineString) { positions.addAll(asKmlPositions(lineString.getCoordinates())); } - if (geometryTypeValue instanceof MultiGeometryType) { - MultiGeometryType multiGeometryType = (MultiGeometryType) geometryTypeValue; + if (geometryTypeValue instanceof MultiGeometryType multiGeometryType) { List> geometryTypes = multiGeometryType.getGeometry(); for (JAXBElement geometryType2 : geometryTypes) { positions.addAll(extractPositions(geometryType2)); diff --git a/navigation-formats/src/main/java/slash/navigation/kml/Kml22BetaFormat.java b/navigation-formats/src/main/java/slash/navigation/kml/Kml22BetaFormat.java index 4594773012..62181a8939 100644 --- a/navigation-formats/src/main/java/slash/navigation/kml/Kml22BetaFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/kml/Kml22BetaFormat.java @@ -79,8 +79,7 @@ private List> find(List context) throws IOException { AbstractFeatureType feature = kmlType.getAbstractFeatureGroup().getValue(); - if (feature instanceof AbstractContainerType) { - AbstractContainerType containerType = (AbstractContainerType) feature; + if (feature instanceof AbstractContainerType containerType) { List> features = null; if (containerType instanceof FolderType) features = ((FolderType) containerType).getAbstractFeatureGroup(); @@ -89,8 +88,7 @@ else if (containerType instanceof DocumentType) extractTracks(trim(containerType.getNameElement()), trim(containerType.getDescription()), features, context); } - if (feature instanceof PlacemarkType) { - PlacemarkType placemarkType = (PlacemarkType) feature; + if (feature instanceof PlacemarkType placemarkType) { String placemarkName = asDescription(trim(placemarkType.getNameElement()), trim(placemarkType.getDescription())); @@ -145,7 +143,7 @@ private void extractWayPointsAndTracksFromPlacemarks(String name, String descrip context.appendRoute(new KmlRoute(this, characteristics, routeName, routeDescription, positions)); } } - if (waypoints.size() > 0) { + if (!waypoints.isEmpty()) { RouteCharacteristics characteristics = parseCharacteristics(name, null, Waypoints); context.prependRoute(new KmlRoute(this, characteristics, name, asDescription(description), waypoints)); } @@ -162,8 +160,7 @@ private void extractWayPointsAndTracksFromNetworkLinks(List> rest = networkLinkType.getValue().getRest(); for (JAXBElement r : rest) { Object rValue = r.getValue(); - if (rValue instanceof LinkType) { - LinkType linkType = (LinkType) rValue; + if (rValue instanceof LinkType linkType) { String url = linkType.getHref(); context.parse(url); } @@ -176,16 +173,13 @@ private List extractPositions(JAXBElement> geometryTypes = multiGeometryType.getAbstractGeometryGroup(); for (JAXBElement geometryType2 : geometryTypes) { positions.addAll(extractPositions(geometryType2)); diff --git a/navigation-formats/src/main/java/slash/navigation/kml/Kml22Format.java b/navigation-formats/src/main/java/slash/navigation/kml/Kml22Format.java index 1f5da10644..40c1c47c13 100644 --- a/navigation-formats/src/main/java/slash/navigation/kml/Kml22Format.java +++ b/navigation-formats/src/main/java/slash/navigation/kml/Kml22Format.java @@ -92,8 +92,7 @@ private List> find(List context) throws IOException { AbstractFeatureType feature = kmlType.getAbstractFeatureGroup().getValue(); - if (feature instanceof AbstractContainerType) { - AbstractContainerType containerType = (AbstractContainerType) feature; + if (feature instanceof AbstractContainerType containerType) { List> features = null; if (containerType instanceof FolderType) features = ((FolderType) containerType).getAbstractFeatureGroup(); @@ -102,8 +101,7 @@ else if (containerType instanceof DocumentType) extractTracks(trim(containerType.getName()), trim(containerType.getDescription()), features, context); } - if (feature instanceof PlacemarkType) { - PlacemarkType placemarkType = (PlacemarkType) feature; + if (feature instanceof PlacemarkType placemarkType) { String placemarkName = asDescription(trim(placemarkType.getName()), trim(placemarkType.getDescription())); List positions = extractPositionsFromGeometry(placemarkType.getAbstractGeometryGroup()); @@ -113,8 +111,7 @@ else if (containerType instanceof DocumentType) context.appendRoute(new KmlRoute(this, Waypoints, placemarkName, asDescription(placemarkType.getDescription()), positions)); } - if (feature instanceof TourType) { - TourType tourType = (TourType) feature; + if (feature instanceof TourType tourType) { String tourName = asDescription(trim(tourType.getName()), trim(tourType.getDescription())); List positions = extractPositionsFromTour(tourType.getPlaylist().getAbstractTourPrimitiveGroup()); @@ -187,7 +184,7 @@ private void extractWayPointsAndTracksFromPlacemarks(String name, String descrip context.appendRoute(new KmlRoute(this, characteristics, routeName, routeDescription, positions)); } } - if (waypoints.size() > 0) { + if (!waypoints.isEmpty()) { RouteCharacteristics characteristics = parseCharacteristics(name, null, Waypoints); context.prependRoute(new KmlRoute(this, characteristics, name, asDescription(description), waypoints)); } @@ -204,8 +201,7 @@ private void extractWayPointsAndTracksFromNetworkLinks(List> rest = networkLinkType.getValue().getRest(); for (JAXBElement r : rest) { Object rValue = r.getValue(); - if (rValue instanceof LinkType) { - LinkType linkType = (LinkType) rValue; + if (rValue instanceof LinkType linkType) { String url = linkType.getHref(); context.parse(url); } @@ -241,30 +237,25 @@ private List extractPositions(TrackType trackType) { private List extractPositionsFromGeometry(JAXBElement geometryType) { List positions = new ArrayList<>(); AbstractGeometryType geometryTypeValue = geometryType.getValue(); - if (geometryTypeValue instanceof PointType) { - PointType point = (PointType) geometryTypeValue; + if (geometryTypeValue instanceof PointType point) { positions.addAll(asKmlPositions(point.getCoordinates())); } - if (geometryTypeValue instanceof LineStringType) { - LineStringType lineString = (LineStringType) geometryTypeValue; + if (geometryTypeValue instanceof LineStringType lineString) { positions.addAll(asKmlPositions(lineString.getCoordinates())); } - if (geometryTypeValue instanceof MultiGeometryType) { - MultiGeometryType multiGeometryType = (MultiGeometryType) geometryTypeValue; + if (geometryTypeValue instanceof MultiGeometryType multiGeometryType) { List> geometryTypes = multiGeometryType.getAbstractGeometryGroup(); for (JAXBElement geometryType2 : geometryTypes) { positions.addAll(extractPositionsFromGeometry(geometryType2)); } } - if (geometryTypeValue instanceof MultiTrackType) { - MultiTrackType multiTrackType = (MultiTrackType) geometryTypeValue; + if (geometryTypeValue instanceof MultiTrackType multiTrackType) { List tracks = multiTrackType.getTrack(); for (TrackType track : tracks) { positions.addAll(extractPositions(track)); } } - if (geometryTypeValue instanceof TrackType) { - TrackType trackType = (TrackType) geometryTypeValue; + if (geometryTypeValue instanceof TrackType trackType) { positions.addAll(extractPositions(trackType)); } return positions; @@ -274,11 +265,9 @@ private List extractPositionsFromTour(List positions = new ArrayList<>(); for (JAXBElement tourPrimitive : tourPrimitives) { AbstractTourPrimitiveType tourPrimitiveValue = tourPrimitive.getValue(); - if (tourPrimitiveValue instanceof FlyToType) { - FlyToType flyToType = (FlyToType) tourPrimitiveValue; + if (tourPrimitiveValue instanceof FlyToType flyToType) { AbstractViewType abstractViewGroupValue = flyToType.getAbstractViewGroup().getValue(); - if (abstractViewGroupValue instanceof LookAtType) { - LookAtType lookAtType = (LookAtType) abstractViewGroupValue; + if (abstractViewGroupValue instanceof LookAtType lookAtType) { Double elevation = isEmpty(lookAtType.getAltitude()) ? null : lookAtType.getAltitude(); KmlPosition position = new KmlPosition(lookAtType.getLongitude(), lookAtType.getLatitude(), elevation, null, null, null); @@ -423,15 +412,15 @@ private int getSpeedClass(double speed) { } private String getSpeedColor(int speedClass) { - return "speedColor_" + valueOf(speedClass); + return "speedColor_" + speedClass; } private String getSpeedDescription(int speedClass) { if (speedClass == 0) - return "< " + valueOf(getSpeedScale()) + " Km/h"; + return "< " + getSpeedScale() + " Km/h"; else if (speedClass <= SPEED_COLORS.length) - return valueOf(speedClass * getSpeedScale()) + " - " + valueOf((speedClass + 1) * getSpeedScale()) + " Km/h"; - return "> " + valueOf(speedClass * getSpeedScale()) + " Km/h"; + return speedClass * getSpeedScale() + " - " + (speedClass + 1) * getSpeedScale() + " Km/h"; + return "> " + speedClass * getSpeedScale() + " Km/h"; } private List createSpeedTrackColors(float width) { diff --git a/navigation-formats/src/main/java/slash/navigation/kml/KmlPosition.java b/navigation-formats/src/main/java/slash/navigation/kml/KmlPosition.java index 46bc53578b..8fb7300203 100644 --- a/navigation-formats/src/main/java/slash/navigation/kml/KmlPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/kml/KmlPosition.java @@ -23,6 +23,8 @@ import slash.common.type.CompactCalendar; import slash.navigation.base.Wgs84Position; +import java.util.Objects; + /** * Represents a position in a Google Earth (.kml) file. * @@ -46,9 +48,9 @@ public boolean equals(Object o) { KmlPosition that = (KmlPosition) o; return !(getElevation() != null ? !getElevation().equals(that.getElevation()) : that.getElevation() != null) && - !(description != null ? !description.equals(that.description) : that.description != null) && - !(latitude != null ? !latitude.equals(that.latitude) : that.latitude != null) && - !(longitude != null ? !longitude.equals(that.longitude) : that.longitude != null) && + !(!Objects.equals(description, that.description)) && + !(!Objects.equals(latitude, that.latitude)) && + !(!Objects.equals(longitude, that.longitude)) && !(hasTime() ? !getTime().equals(that.getTime()) : that.hasTime()); } diff --git a/navigation-formats/src/main/java/slash/navigation/kml/KmlRoute.java b/navigation-formats/src/main/java/slash/navigation/kml/KmlRoute.java index 0598a283ef..1ceb9fecaa 100644 --- a/navigation-formats/src/main/java/slash/navigation/kml/KmlRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/kml/KmlRoute.java @@ -52,6 +52,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * A Google Earth (.kml) route. @@ -61,8 +62,8 @@ public class KmlRoute extends BaseRoute { private String name; - private List description; - private List positions; + private final List description; + private final List positions; public KmlRoute(BaseKmlFormat format, RouteCharacteristics characteristics, String name, List description, List positions) { super(format, characteristics); @@ -200,8 +201,8 @@ public boolean equals(Object o) { final KmlRoute kmlRoute = (KmlRoute) o; - return !(description != null ? !description.equals(kmlRoute.description) : kmlRoute.description != null) && - !(name != null ? !name.equals(kmlRoute.name) : kmlRoute.name != null) && + return !(!Objects.equals(description, kmlRoute.description)) && + !(!Objects.equals(name, kmlRoute.name)) && getCharacteristics().equals(kmlRoute.getCharacteristics()) && positions.equals(kmlRoute.positions); } diff --git a/navigation-formats/src/main/java/slash/navigation/kml/KmzFormat.java b/navigation-formats/src/main/java/slash/navigation/kml/KmzFormat.java index 7180f18199..3cdd9a7b66 100644 --- a/navigation-formats/src/main/java/slash/navigation/kml/KmzFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/kml/KmzFormat.java @@ -46,7 +46,7 @@ public abstract class KmzFormat extends BaseKmlFormat { private static final Logger log = Logger.getLogger(KmzFormat.class.getName()); - private KmlFormat delegate; + private final KmlFormat delegate; protected KmzFormat(KmlFormat delegate) { this.delegate = delegate; @@ -84,7 +84,7 @@ public void read(InputStream source, ParserContext context) throws IOE zip.closeEntry(); } } - if(context.getFormats().size() == 0) + if(context.getFormats().isEmpty()) throw new IOException(format("Cannot find %s format in %s", getName(), context.getFile())); } diff --git a/navigation-formats/src/main/java/slash/navigation/lmx/NokiaLandmarkExchangeRoute.java b/navigation-formats/src/main/java/slash/navigation/lmx/NokiaLandmarkExchangeRoute.java index f362c47c7d..f4af1dd953 100644 --- a/navigation-formats/src/main/java/slash/navigation/lmx/NokiaLandmarkExchangeRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/lmx/NokiaLandmarkExchangeRoute.java @@ -58,6 +58,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteCharacteristics.Waypoints; import static slash.navigation.base.RouteComments.createRouteName; @@ -70,9 +71,9 @@ public class NokiaLandmarkExchangeRoute extends BaseRoute { private String name; - private List description; - private List positions; - private Lmx lmx; + private final List description; + private final List positions; + private final Lmx lmx; NokiaLandmarkExchangeRoute(String name, List description, List positions, Lmx lmx) { super(new NokiaLandmarkExchangeFormat(), Waypoints); @@ -222,8 +223,8 @@ public boolean equals(Object o) { NokiaLandmarkExchangeRoute other = (NokiaLandmarkExchangeRoute) o; - return !(name != null ? !name.equals(other.name) : other.name != null) && - !(positions != null ? !positions.equals(other.positions) : other.positions != null); + return !(!Objects.equals(name, other.name)) && + !(!Objects.equals(positions, other.positions)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/mm/MagicMapsIktRoute.java b/navigation-formats/src/main/java/slash/navigation/mm/MagicMapsIktRoute.java index d83b0395c2..ae8d9b50c5 100644 --- a/navigation-formats/src/main/java/slash/navigation/mm/MagicMapsIktRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/mm/MagicMapsIktRoute.java @@ -55,6 +55,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteCharacteristics.Route; @@ -66,8 +67,8 @@ public class MagicMapsIktRoute extends BaseRoute { private String name; - private List description; - private List positions; + private final List description; + private final List positions; MagicMapsIktRoute(MagicMapsIktFormat format, String name, List description, List positions) { @@ -213,8 +214,8 @@ public boolean equals(Object o) { final MagicMapsIktRoute magicMapsIktRoute = (MagicMapsIktRoute) o; - return !(description != null ? !description.equals(magicMapsIktRoute.description) : magicMapsIktRoute.description != null) && - !(name != null ? !name.equals(magicMapsIktRoute.name) : magicMapsIktRoute.name != null) && + return !(!Objects.equals(description, magicMapsIktRoute.description)) && + !(!Objects.equals(name, magicMapsIktRoute.name)) && getCharacteristics().equals(magicMapsIktRoute.getCharacteristics()) && positions.equals(magicMapsIktRoute.positions); } diff --git a/navigation-formats/src/main/java/slash/navigation/mm/MagicMapsPthFormat.java b/navigation-formats/src/main/java/slash/navigation/mm/MagicMapsPthFormat.java index ac07553f8f..a2de386180 100644 --- a/navigation-formats/src/main/java/slash/navigation/mm/MagicMapsPthFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/mm/MagicMapsPthFormat.java @@ -86,7 +86,7 @@ public void read(BufferedReader reader, String encoding, ParserContext 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(Track, null, positions)); } diff --git a/navigation-formats/src/main/java/slash/navigation/msfs/MSFSFlightPlanRoute.java b/navigation-formats/src/main/java/slash/navigation/msfs/MSFSFlightPlanRoute.java index ee92230f9a..c662fb26b3 100644 --- a/navigation-formats/src/main/java/slash/navigation/msfs/MSFSFlightPlanRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/msfs/MSFSFlightPlanRoute.java @@ -58,6 +58,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteCharacteristics.Track; import static slash.navigation.base.RouteComments.createRouteName; @@ -70,9 +71,9 @@ public class MSFSFlightPlanRoute extends BaseRoute { private String name; - private List description; - private List positions; - private SimBaseDocument simBaseDocument; + private final List description; + private final List positions; + private final SimBaseDocument simBaseDocument; MSFSFlightPlanRoute(String name, List description, List positions, SimBaseDocument simBaseDocument) { super(new MSFSFlightPlanFormat(), Track); @@ -222,8 +223,8 @@ public boolean equals(Object o) { MSFSFlightPlanRoute other = (MSFSFlightPlanRoute) o; - return !(name != null ? !name.equals(other.name) : other.name != null) && - !(positions != null ? !positions.equals(other.positions) : other.positions != null); + return !(!Objects.equals(name, other.name)) && + !(!Objects.equals(positions, other.positions)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/nmea/BaseNmeaFormat.java b/navigation-formats/src/main/java/slash/navigation/nmea/BaseNmeaFormat.java index 7846f55af0..947b5b21aa 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmea/BaseNmeaFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/nmea/BaseNmeaFormat.java @@ -144,7 +144,7 @@ public void read(BufferedReader reader, String encoding, ParserContext 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(getCharacteristics(), null, positions)); } diff --git a/navigation-formats/src/main/java/slash/navigation/nmea/MagellanRouteFormat.java b/navigation-formats/src/main/java/slash/navigation/nmea/MagellanRouteFormat.java index dfbdafd23a..315ec08a7e 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmea/MagellanRouteFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/nmea/MagellanRouteFormat.java @@ -144,8 +144,8 @@ String formatRouteName(String name) { else buffer.deleteCharAt(i); } - if (buffer.length() > 0) - return buffer.toString().substring(0, Math.min(buffer.length(), 20)); + if (!buffer.isEmpty()) + return buffer.substring(0, Math.min(buffer.length(), 20)); } return "route01"; } @@ -205,4 +205,4 @@ private void writeRte(NmeaPosition start, NmeaPosition end, PrintWriter writer, protected void writeFooter(PrintWriter writer) { writeSentence(writer, "PMGNCMD,END"); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/main/java/slash/navigation/nmea/NmeaFormat.java b/navigation-formats/src/main/java/slash/navigation/nmea/NmeaFormat.java index 088d68f6f9..69a6079b36 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmea/NmeaFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/nmea/NmeaFormat.java @@ -407,7 +407,7 @@ protected void writePosition(NmeaPosition position, PrintWriter writer) { writeSentence(writer, rmc); // $GPGGA,130441.89,5239.3154,N,00907.7011,E,1,08,1.25,16.76,M,46.79,M,,*6D - if(time.length() > 0 || altitude.length() > 0 || satellites.length() > 0) { + if(!time.isEmpty() || !altitude.isEmpty() || !satellites.isEmpty()) { String gga = "GPGGA" + SEPARATOR + time + SEPARATOR + latitude + SEPARATOR + northOrSouth + SEPARATOR + longitude + SEPARATOR + westOrEast + SEPARATOR + "1" + SEPARATOR + satellites + SEPARATOR + SEPARATOR + altitude + SEPARATOR + "M" + SEPARATOR + SEPARATOR + "M" + SEPARATOR + SEPARATOR; diff --git a/navigation-formats/src/main/java/slash/navigation/nmea/NmeaPosition.java b/navigation-formats/src/main/java/slash/navigation/nmea/NmeaPosition.java index d203df5b1f..5501544351 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmea/NmeaPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/nmea/NmeaPosition.java @@ -28,6 +28,8 @@ import slash.navigation.gpx.GpxPosition; import slash.navigation.itn.TomTomPosition; +import java.util.Objects; + import static slash.navigation.common.UnitConversion.*; /** @@ -203,16 +205,16 @@ public boolean equals(Object o) { NmeaPosition that = (NmeaPosition) o; - return !(description != null ? !description.equals(that.description) : that.description != null) && + return !(!Objects.equals(description, that.description)) && !(getElevation() != null ? !getElevation().equals(that.getElevation()) : that.getElevation() != null) && - !(heading != null ? !heading.equals(that.heading) : that.heading != null) && - !(latitude != null ? !latitude.equals(that.latitude) : that.latitude != null) && - !(longitude != null ? !longitude.equals(that.longitude) : that.longitude != null) && + !(!Objects.equals(heading, that.heading)) && + !(!Objects.equals(latitude, that.latitude)) && + !(!Objects.equals(longitude, that.longitude)) && !(hasTime() ? !getTime().equals(that.getTime()) : that.hasTime()) && - !(hdop != null ? !hdop.equals(that.hdop) : that.hdop != null) && - !(pdop != null ? !pdop.equals(that.pdop) : that.pdop != null) && - !(vdop != null ? !vdop.equals(that.vdop) : that.vdop != null) && - !(satellites != null ? !satellites.equals(that.satellites) : that.satellites != null); } + !(!Objects.equals(hdop, that.hdop)) && + !(!Objects.equals(pdop, that.pdop)) && + !(!Objects.equals(vdop, that.vdop)) && + !(!Objects.equals(satellites, that.satellites)); } public int hashCode() { int result; diff --git a/navigation-formats/src/main/java/slash/navigation/nmn/Nmn5Format.java b/navigation-formats/src/main/java/slash/navigation/nmn/Nmn5Format.java index 94241b0bfa..ef09c6dc17 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmn/Nmn5Format.java +++ b/navigation-formats/src/main/java/slash/navigation/nmn/Nmn5Format.java @@ -92,7 +92,7 @@ protected void writePosition(Wgs84Position position, PrintWriter writer, int ind String number = escape(nmnPosition.isUnstructured() ? null : nmnPosition.getNumber()); writer.println("-" + SEPARATOR + "-" + SEPARATOR + "-" + SEPARATOR + "-" + SEPARATOR + "-" + SEPARATOR + - city + "" + SEPARATOR + + city + SEPARATOR + "-" + SEPARATOR + street + SEPARATOR + number + SEPARATOR + diff --git a/navigation-formats/src/main/java/slash/navigation/nmn/NmnFormat.java b/navigation-formats/src/main/java/slash/navigation/nmn/NmnFormat.java index 8124afdce9..7f8b64f5cb 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmn/NmnFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/nmn/NmnFormat.java @@ -55,7 +55,7 @@ public

NmnRoute createRoute(RouteCharacteristics public BaseNavigationPosition getDuplicateFirstPosition(BaseRoute route) { List positions = route.getPositions(); - if (positions.size() == 0) + if (positions.isEmpty()) return null; NavigationPosition first = positions.get(0); return new NmnPosition(first.getLongitude() + DUPLICATE_OFFSET, diff --git a/navigation-formats/src/main/java/slash/navigation/nmn/NmnPosition.java b/navigation-formats/src/main/java/slash/navigation/nmn/NmnPosition.java index 37d5b083b8..11966f001e 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmn/NmnPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/nmn/NmnPosition.java @@ -23,6 +23,7 @@ import slash.common.type.CompactCalendar; import slash.navigation.base.Wgs84Position; +import java.util.Objects; import java.util.regex.Matcher; import static slash.common.io.Transfer.escape; @@ -59,7 +60,7 @@ public String getDescription() { (getCity() != null ? getCity() : "") + (getStreet() != null ? ", " + getStreet() : "") + (getNumber() != null ? " " + getNumber() : ""); - return result.length() > 0 ? result : null; + return !result.isEmpty() ? result : null; } public void setDescription(String description) { @@ -111,12 +112,12 @@ public boolean equals(Object o) { NmnPosition that = (NmnPosition) o; - return !(description != null ? !description.equals(that.description) : that.description != null) && - !(street != null ? !street.equals(that.street) : that.street != null) && - !(number != null ? !number.equals(that.number) : that.number != null) && + return !(!Objects.equals(description, that.description)) && + !(!Objects.equals(street, that.street)) && + !(!Objects.equals(number, that.number)) && !(getElevation() != null ? !getElevation().equals(that.getElevation()) : that.getElevation() != null) && - !(latitude != null ? !latitude.equals(that.latitude) : that.latitude != null) && - !(longitude != null ? !longitude.equals(that.longitude) : that.longitude != null) && + !(!Objects.equals(latitude, that.latitude)) && + !(!Objects.equals(longitude, that.longitude)) && !(hasTime() ? !getTime().equals(that.getTime()) : that.hasTime()); } diff --git a/navigation-formats/src/main/java/slash/navigation/nmn/NmnRouteFormat.java b/navigation-formats/src/main/java/slash/navigation/nmn/NmnRouteFormat.java index fb4ab053b2..9e77766536 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmn/NmnRouteFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/nmn/NmnRouteFormat.java @@ -533,7 +533,7 @@ private byte[] encodePoint(Wgs84Position position, int positionNo, String mapNam int timeStamp = (int) (System.currentTimeMillis() / 1000L); byteBuffer.putInt(timeStamp); //copied from itconv export - byte unknownBytes[] = new byte[]{ + byte[] unknownBytes = new byte[]{ (byte) 0x28, (byte) 0x00, (byte) 0x00, (byte) 0x00 }; byteBuffer.put(unknownBytes); @@ -557,7 +557,7 @@ private byte[] encodePoint(Wgs84Position position, int positionNo, String mapNam //unknown copyied from itconv export. wechselt in itconf an den ersten Stellen. Timestamp //passt nicht. Datum ist von 1990 //Sind eigentlich 2x 4 Bytes. Die ersten 4 werden im Land nochmal verwendet - byte rawData[] = { + byte[] rawData = { (byte) 0x90, (byte) 0xF9, (byte) 0x46, (byte) 0x27, (byte) 0x0A, (byte) 0x00, (byte) 0x00, (byte) 0x00 }; diff --git a/navigation-formats/src/main/java/slash/navigation/nmn/bindingcruiser/Route.java b/navigation-formats/src/main/java/slash/navigation/nmn/bindingcruiser/Route.java index 41f8b1c70e..d43b099e40 100644 --- a/navigation-formats/src/main/java/slash/navigation/nmn/bindingcruiser/Route.java +++ b/navigation-formats/src/main/java/slash/navigation/nmn/bindingcruiser/Route.java @@ -26,7 +26,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class Route { - private List coords = new ArrayList<>(); + private final List coords = new ArrayList<>(); public int v = 1; public Settings settings = new Settings(); diff --git a/navigation-formats/src/main/java/slash/navigation/ovl/OvlFormat.java b/navigation-formats/src/main/java/slash/navigation/ovl/OvlFormat.java index 0629ae8453..51e959e444 100644 --- a/navigation-formats/src/main/java/slash/navigation/ovl/OvlFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/ovl/OvlFormat.java @@ -89,7 +89,7 @@ public void read(BufferedReader reader, String encoding, ParserContext String line = reader.readLine(); if (line == null) break; - if (line.length() == 0) + if (line.isEmpty()) continue; if (isSectionTitle(line)) { @@ -225,7 +225,7 @@ private OvlRoute extractRoute(List symbols, OvlSection overlay, OvlS } symbol.removePositions(); } - OvlSection symbol = symbols.size() > 0 ? symbols.get(0) : null; + OvlSection symbol = !symbols.isEmpty() ? symbols.get(0) : null; return new OvlRoute(this, estimateCharacteristics(positions.size()), mapLage.getTitle(), symbol, overlay, mapLage, positions); } @@ -303,7 +303,7 @@ public void write(List routes, OutputStream target) throws IOException writeSymbol(route, writer, 0, route.getPositionCount(), ++symbols); } // stupid logic: the first route written determines the properties of the Overlays and MapLage sections - OvlRoute first = routes.size() > 0 ? routes.get(0) : null; + OvlRoute first = !routes.isEmpty() ? routes.get(0) : null; if (first != null) { writeOverlay(first, writer, symbols); writeMapLage(first, writer); diff --git a/navigation-formats/src/main/java/slash/navigation/ovl/OvlRoute.java b/navigation-formats/src/main/java/slash/navigation/ovl/OvlRoute.java index 25ee92dcd2..a9a2ff4531 100644 --- a/navigation-formats/src/main/java/slash/navigation/ovl/OvlRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/ovl/OvlRoute.java @@ -55,6 +55,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteComments.createRouteName; @@ -65,8 +66,10 @@ */ public class OvlRoute extends BaseRoute { - private OvlSection symbol, overlay, mapLage; - private List positions; + private final OvlSection symbol; + private final OvlSection overlay; + private final OvlSection mapLage; + private final List positions; OvlRoute(OvlFormat format, RouteCharacteristics characteristics, String name, OvlSection symbol, OvlSection overlay, OvlSection mapLage, @@ -230,10 +233,10 @@ public boolean equals(Object o) { OvlRoute ovlRoute = (OvlRoute) o; - return !(mapLage != null ? !mapLage.equals(ovlRoute.mapLage) : ovlRoute.mapLage != null) && - !(overlay != null ? !overlay.equals(ovlRoute.overlay) : ovlRoute.overlay != null) && - !(positions != null ? !positions.equals(ovlRoute.positions) : ovlRoute.positions != null) && - !(symbol != null ? !symbol.equals(ovlRoute.symbol) : ovlRoute.symbol != null); + return !(!Objects.equals(mapLage, ovlRoute.mapLage)) && + !(!Objects.equals(overlay, ovlRoute.overlay)) && + !(!Objects.equals(positions, ovlRoute.positions)) && + !(!Objects.equals(symbol, ovlRoute.symbol)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/simple/SygicFormat.java b/navigation-formats/src/main/java/slash/navigation/simple/SygicFormat.java index 6cc86bba91..dae7b1e145 100644 --- a/navigation-formats/src/main/java/slash/navigation/simple/SygicFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/simple/SygicFormat.java @@ -58,7 +58,7 @@ public

SimpleRoute createRoute(RouteCharacteristi } protected boolean isValidLine(String line) { - return isPosition(line) || line.length() == 0 || line.startsWith(COMMENT_LINE); + return isPosition(line) || line.isEmpty() || line.startsWith(COMMENT_LINE); } protected boolean isPosition(String line) { diff --git a/navigation-formats/src/main/java/slash/navigation/tcx/Tcx1Format.java b/navigation-formats/src/main/java/slash/navigation/tcx/Tcx1Format.java index 4b9c7f4e11..6cb17da66a 100644 --- a/navigation-formats/src/main/java/slash/navigation/tcx/Tcx1Format.java +++ b/navigation-formats/src/main/java/slash/navigation/tcx/Tcx1Format.java @@ -84,7 +84,7 @@ private TcxRoute processCoursePoints(String name, CourseT courseT) { coursePointT.getName(), coursePointT)); } - return positions.size() > 0 ? new TcxRoute(this, Route, name, positions) : null; + return !positions.isEmpty() ? new TcxRoute(this, Route, name, positions) : null; } private TcxRoute processCourseLap(String name, CourseLapT courseLapT) { diff --git a/navigation-formats/src/main/java/slash/navigation/tcx/Tcx2Format.java b/navigation-formats/src/main/java/slash/navigation/tcx/Tcx2Format.java index 7aa3fe4c4d..345da91b6e 100644 --- a/navigation-formats/src/main/java/slash/navigation/tcx/Tcx2Format.java +++ b/navigation-formats/src/main/java/slash/navigation/tcx/Tcx2Format.java @@ -84,7 +84,7 @@ private TcxRoute processCoursePoints(CourseT courseT) { coursePointT.getName(), coursePointT)); } - return positions.size() > 0 ? new TcxRoute(this, Route, courseT.getName(), positions) : null; + return !positions.isEmpty() ? new TcxRoute(this, Route, courseT.getName(), positions) : null; } private TcxRoute processCourseLap(String name, CourseLapT courseLapT) { diff --git a/navigation-formats/src/main/java/slash/navigation/tcx/TcxFormat.java b/navigation-formats/src/main/java/slash/navigation/tcx/TcxFormat.java index 7cae0d02d4..b9fe60d95d 100644 --- a/navigation-formats/src/main/java/slash/navigation/tcx/TcxFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/tcx/TcxFormat.java @@ -89,8 +89,7 @@ private Double getHeartBeat(WptType wptType) { Double heartBeat = null; if (wptType.getExtensions() != null) { for (Object any : wptType.getExtensions().getAny()) { - if (any instanceof Element) { - Element extension = (Element) any; + if (any instanceof Element extension) { if ("TrackPointExtension".equals(extension.getLocalName())) { for (int i = 0; i < extension.getChildNodes().getLength(); i++) { Node hr = extension.getChildNodes().item(i); diff --git a/navigation-formats/src/main/java/slash/navigation/tcx/TcxRoute.java b/navigation-formats/src/main/java/slash/navigation/tcx/TcxRoute.java index 73be763efe..1dd2670acd 100644 --- a/navigation-formats/src/main/java/slash/navigation/tcx/TcxRoute.java +++ b/navigation-formats/src/main/java/slash/navigation/tcx/TcxRoute.java @@ -54,6 +54,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static slash.navigation.base.RouteComments.createRouteName; @@ -65,7 +66,7 @@ public class TcxRoute extends BaseRoute { private String name; - private List positions; + private final List positions; public TcxRoute(TcxFormat format, RouteCharacteristics characteristics, String name, List positions) { super(format, characteristics); @@ -202,8 +203,8 @@ public boolean equals(Object o) { TcxRoute nokiaLandmarkExchangeRoute = (TcxRoute) o; - return !(name != null ? !name.equals(nokiaLandmarkExchangeRoute.name) : nokiaLandmarkExchangeRoute.name != null) && - !(positions != null ? !positions.equals(nokiaLandmarkExchangeRoute.positions) : nokiaLandmarkExchangeRoute.positions != null); + return !(!Objects.equals(name, nokiaLandmarkExchangeRoute.name)) && + !(!Objects.equals(positions, nokiaLandmarkExchangeRoute.positions)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/tour/TourFormat.java b/navigation-formats/src/main/java/slash/navigation/tour/TourFormat.java index 456abf4553..d6d0657a3b 100644 --- a/navigation-formats/src/main/java/slash/navigation/tour/TourFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/tour/TourFormat.java @@ -105,7 +105,7 @@ public void read(BufferedReader reader, String encoding, ParserContext 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(Waypoints, routeName, sortPositions(positions))); } @@ -206,7 +206,7 @@ public void write(TourRoute route, PrintWriter writer, int startIndex, int endIn if (name == null) name = position.getDescription(); writer.println(NAME + TOUR_FORMAT_NAME_VALUE_SEPARATOR + name); - writer.println(POSITION_IN_LIST + TOUR_FORMAT_NAME_VALUE_SEPARATOR + Integer.toString(i)); + writer.println(POSITION_IN_LIST + TOUR_FORMAT_NAME_VALUE_SEPARATOR + i); if (position.getZipCode() != null) writer.println(ZIPCODE + TOUR_FORMAT_NAME_VALUE_SEPARATOR + position.getZipCode()); if (position.getCity() != null && !position.getCity().equals(name)) diff --git a/navigation-formats/src/main/java/slash/navigation/tour/TourPosition.java b/navigation-formats/src/main/java/slash/navigation/tour/TourPosition.java index 1ed3c74c0c..733296a2d2 100644 --- a/navigation-formats/src/main/java/slash/navigation/tour/TourPosition.java +++ b/navigation-formats/src/main/java/slash/navigation/tour/TourPosition.java @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.Set; /** @@ -60,8 +61,8 @@ public String getDescription() { (getStreet() != null ? ", " + getStreet() : "") + (getHouseNo() != null ? " " + getHouseNo() : ""); if (getName() != null) - result += (result.length() > 0 ? ", " : "") + getName(); - return result.length() > 0 ? result : null; + result += (!result.isEmpty() ? ", " : "") + getName(); + return !result.isEmpty() ? result : null; } public void setDescription(String description) { @@ -135,14 +136,14 @@ public boolean equals(Object o) { TourPosition that = (TourPosition) o; - return !(x != null ? !x.equals(that.x) : that.x != null) && - !(y != null ? !y.equals(that.y) : that.y != null) && - !(name != null ? !name.equals(that.name) : that.name != null) && - !(zipCode != null ? !zipCode.equals(that.zipCode) : that.zipCode != null) && - !(description != null ? !description.equals(that.description) : that.description != null) && - !(street != null ? !street.equals(that.street) : that.street != null) && - !(houseNo != null ? !houseNo.equals(that.houseNo) : that.houseNo != null) && - !(nameValues != null ? !nameValues.equals(that.nameValues) : that.nameValues != null); + return !(!Objects.equals(x, that.x)) && + !(!Objects.equals(y, that.y)) && + !(!Objects.equals(name, that.name)) && + !(!Objects.equals(zipCode, that.zipCode)) && + !(!Objects.equals(description, that.description)) && + !(!Objects.equals(street, that.street)) && + !(!Objects.equals(houseNo, that.houseNo)) && + !(!Objects.equals(nameValues, that.nameValues)); } public int hashCode() { diff --git a/navigation-formats/src/main/java/slash/navigation/url/GoogleMapsUrlFormat.java b/navigation-formats/src/main/java/slash/navigation/url/GoogleMapsUrlFormat.java index 840b38959e..865ae8cc4b 100644 --- a/navigation-formats/src/main/java/slash/navigation/url/GoogleMapsUrlFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/url/GoogleMapsUrlFormat.java @@ -95,7 +95,7 @@ private static String internalFindUrl(String text) { protected void processURL(String url, String encoding, ParserContext context) { if (url.startsWith("/dir/")) { List positions = parsePositions(url.substring(5)); - if (positions.size() > 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(Route, null, positions)); } else super.processURL(url, encoding, context); @@ -180,7 +180,7 @@ protected List parsePositions(Map> parameter } List geocode = parameters.get("geocode"); - if(geocode != null && geocode.size() > 0 && result.size() > 0) { + if(geocode != null && !geocode.isEmpty() && !result.isEmpty()) { List geocodePositions = extractGeocodePositions(result); StringTokenizer tokenizer = new StringTokenizer(geocode.get(0), ",;"); int positionIndex = 0; diff --git a/navigation-formats/src/main/java/slash/navigation/url/KurvigerUrlFormat.java b/navigation-formats/src/main/java/slash/navigation/url/KurvigerUrlFormat.java index 5eb2da96ec..96a72cc11a 100644 --- a/navigation-formats/src/main/java/slash/navigation/url/KurvigerUrlFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/url/KurvigerUrlFormat.java @@ -90,14 +90,14 @@ List parsePositions(String data) { } private List parseMatrixParameters(String data) { - if (data == null || data.length() == 0) + if (data == null || data.isEmpty()) return null; return parsePositions(data); } protected void processURL(String url, String encoding, ParserContext context) { List positions = parseMatrixParameters(url); - if (positions.size() > 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(Route, null, positions)); } diff --git a/navigation-formats/src/main/java/slash/navigation/url/MotoPlanerUrlFormat.java b/navigation-formats/src/main/java/slash/navigation/url/MotoPlanerUrlFormat.java index 1c45d699cd..6b02d67ab0 100644 --- a/navigation-formats/src/main/java/slash/navigation/url/MotoPlanerUrlFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/url/MotoPlanerUrlFormat.java @@ -91,14 +91,14 @@ List parsePositions(String data) { } private List parseMatrixParameters(String data) { - if (data == null || data.length() == 0) + if (data == null || data.isEmpty()) return null; return parsePositions(data); } protected void processURL(String url, String encoding, ParserContext context) { List positions = parseMatrixParameters(url); - if (positions.size() > 0) + if (!positions.isEmpty()) context.appendRoute(createRoute(Route, null, positions)); } diff --git a/navigation-formats/src/main/java/slash/navigation/viamichelin/ViaMichelinFormat.java b/navigation-formats/src/main/java/slash/navigation/viamichelin/ViaMichelinFormat.java index 20779ff90e..a88fcdf1e5 100644 --- a/navigation-formats/src/main/java/slash/navigation/viamichelin/ViaMichelinFormat.java +++ b/navigation-formats/src/main/java/slash/navigation/viamichelin/ViaMichelinFormat.java @@ -92,15 +92,13 @@ private ViaMichelinRoute process(PoiList poiList) { String routeName = null; List positions = new ArrayList<>(); for (Object itineraryOrPoi : poiList.getItineraryOrPoi()) { - if (itineraryOrPoi instanceof Itinerary) { - Itinerary itinerary = (Itinerary) itineraryOrPoi; + if (itineraryOrPoi instanceof Itinerary itinerary) { routeName = itinerary.getName(); for (Step step : itinerary.getStep()) { positions.add(asWgs84Position(parseDouble(step.getLongitude()), parseDouble(step.getLatitude()), step.getName())); } } - if (itineraryOrPoi instanceof Poi) { - Poi poi = (Poi) itineraryOrPoi; + if (itineraryOrPoi instanceof Poi poi) { positions.add(asWgs84Position(parseDouble(poi.getLongitude()), parseDouble(poi.getLatitude()), parseDescription(poi))); } } diff --git a/navigation-formats/src/main/java/slash/navigation/wbt/WintecWbt201Format.java b/navigation-formats/src/main/java/slash/navigation/wbt/WintecWbt201Format.java index ec3dc57999..f9f0ba4018 100644 --- a/navigation-formats/src/main/java/slash/navigation/wbt/WintecWbt201Format.java +++ b/navigation-formats/src/main/java/slash/navigation/wbt/WintecWbt201Format.java @@ -220,9 +220,9 @@ protected BaseNavigationPosition createWaypoint(long time, long latitude, long l String description; if (isTrackpoint) - description = "Trackpoint " + String.valueOf(pointNo); + description = "Trackpoint " + pointNo; else - description = "Pushpoint " + String.valueOf(pointNo); + description = "Pushpoint " + pointNo; return new Wgs84Position(longitude / FACTOR, latitude / FACTOR, (double) altitude, null, fromCalendar(calendar), description); diff --git a/navigation-formats/src/test/java/slash/navigation/babel/CompeGPSDataFormatIT.java b/navigation-formats/src/test/java/slash/navigation/babel/CompeGPSDataFormatIT.java index 08bfd445e0..447fdfa517 100644 --- a/navigation-formats/src/test/java/slash/navigation/babel/CompeGPSDataFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/babel/CompeGPSDataFormatIT.java @@ -34,7 +34,7 @@ import static slash.navigation.base.RouteCharacteristics.*; public class CompeGPSDataFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); private void checkFile(String testFileName, RouteCharacteristics characteristics, int positionCount) throws IOException { File source = new File(TEST_PATH + testFileName); @@ -62,4 +62,4 @@ public void testTrack() throws IOException { public void testWaypoints() throws IOException { checkFile("from-compegps.wpt", Waypoints, 31); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/babel/OziExplorerFormatIT.java b/navigation-formats/src/test/java/slash/navigation/babel/OziExplorerFormatIT.java index a18e479df4..fe428d143c 100644 --- a/navigation-formats/src/test/java/slash/navigation/babel/OziExplorerFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/babel/OziExplorerFormatIT.java @@ -35,7 +35,7 @@ import static slash.navigation.base.RouteCharacteristics.*; public class OziExplorerFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); private void checkFile(String testFileName, RouteCharacteristics characteristics, int routeCount, int positionCount) throws IOException { File source = new File(TEST_PATH + testFileName); @@ -73,4 +73,4 @@ public void testEliminateNonsenseRoutes() throws IOException { BaseRoute route = result.getTheRoute(); assertEquals(49, route.getPositionCount()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/base/AppendIT.java b/navigation-formats/src/test/java/slash/navigation/base/AppendIT.java index c01a9c307c..ab66d569f6 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/AppendIT.java +++ b/navigation-formats/src/test/java/slash/navigation/base/AppendIT.java @@ -43,7 +43,7 @@ import static slash.navigation.base.NavigationTestCase.assertRouteNameEquals; public class AppendIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); private static boolean isStoringRouteName(NavigationFormat format) { return !(format instanceof GoPalRouteFormat) && !(format instanceof GoPalTrackFormat) && @@ -60,7 +60,7 @@ private void append(String testFileName, String appendFileName) throws IOExcepti assertNotNull(appendResult.getTheRoute()); assertNotNull(appendResult.getFormat()); assertNotNull(appendResult.getAllRoutes()); - assertTrue(appendResult.getAllRoutes().size() > 0); + assertTrue(!appendResult.getAllRoutes().isEmpty()); int appendPositionCount = appendResult.getTheRoute().getPositionCount(); List appendPositions = appendResult.getTheRoute().getPositions(); diff --git a/navigation-formats/src/test/java/slash/navigation/base/BaseUrlParsingFormatTest.java b/navigation-formats/src/test/java/slash/navigation/base/BaseUrlParsingFormatTest.java index 628c7bcf75..d088388943 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/BaseUrlParsingFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/base/BaseUrlParsingFormatTest.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertNotNull; public class BaseUrlParsingFormatTest { - private BaseUrlParsingFormat urlFormat = new BaseUrlParsingFormatImpl(); + private final BaseUrlParsingFormat urlFormat = new BaseUrlParsingFormatImpl(); @Test public void testParseSingleURLParameters() { diff --git a/navigation-formats/src/test/java/slash/navigation/base/ConvertBase.java b/navigation-formats/src/test/java/slash/navigation/base/ConvertBase.java index c530ae8349..411461639b 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/ConvertBase.java +++ b/navigation-formats/src/test/java/slash/navigation/base/ConvertBase.java @@ -60,7 +60,7 @@ public static void convertRoundtrip(String testFileName, assertNotNull(result.getFormat()); assertNotNull(result.getTheRoute()); assertNotNull(result.getAllRoutes()); - assertTrue(result.getAllRoutes().size() > 0); + assertTrue(!result.getAllRoutes().isEmpty()); // check append NavigationPosition sourcePosition = result.getTheRoute().getPositions().get(0); @@ -113,11 +113,11 @@ private static void convertSingleRouteRoundtrip(BaseNavigationFormat sourceForma removeTcxLap(targetFormat, targetResult); compareRouteMetaData(sourceRoute, targetResult.getTheRoute()); - comparePositions(sourceRoute, sourceFormat, targetResult.getTheRoute(), targetFormat, targetResult.getAllRoutes().size() > 0); + comparePositions(sourceRoute, sourceFormat, targetResult.getTheRoute(), targetFormat, !targetResult.getAllRoutes().isEmpty()); for (BaseRoute targetRoute : targetResult.getAllRoutes()) { compareRouteMetaData(sourceRoute, targetRoute); - comparePositions(sourceRoute, sourceFormat, targetRoute, targetFormat, targetResult.getAllRoutes().size() > 0); + comparePositions(sourceRoute, sourceFormat, targetRoute, targetFormat, !targetResult.getAllRoutes().isEmpty()); } assertTrue(target.exists()); @@ -188,4 +188,4 @@ public static void ignoreLocalTimeZone(RunnableThrowsException runnable) throws setUseLocalTimeZone(localTimeZone); } } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/base/NavigationFormatParserIT.java b/navigation-formats/src/test/java/slash/navigation/base/NavigationFormatParserIT.java index 8e6187dc36..671a7b976b 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/NavigationFormatParserIT.java +++ b/navigation-formats/src/test/java/slash/navigation/base/NavigationFormatParserIT.java @@ -37,14 +37,14 @@ import static slash.navigation.base.RouteCharacteristics.*; public class NavigationFormatParserIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); ParserResult read(String testFileName) throws IOException { File source = new File(testFileName); ParserResult result = parser.read(source); assertNotNull(result.getFormat()); assertNotNull(result.getAllRoutes()); - assertTrue(result.getAllRoutes().size() > 0); + assertTrue(!result.getAllRoutes().isEmpty()); assertNotNull("Cannot read route from " + source, result.getTheRoute()); assertTrue(result.getTheRoute().getPositionCount() > 0); return result; @@ -56,7 +56,7 @@ private List getRouteCharacteristics(List routes, RouteCha if (route.getCharacteristics().equals(characteristics)) result.add(route); } - return result.size() > 0 ? result : null; + return !result.isEmpty() ? result : null; } void readRouteCharacteristics(String testFileName, RouteCharacteristics characteristics, diff --git a/navigation-formats/src/test/java/slash/navigation/base/NavigationTestCase.java b/navigation-formats/src/test/java/slash/navigation/base/NavigationTestCase.java index 22cb728d89..f564a7e518 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/NavigationTestCase.java +++ b/navigation-formats/src/test/java/slash/navigation/base/NavigationTestCase.java @@ -92,9 +92,9 @@ public static void assertDescriptionEquals(List expected, List w if (!w.equals(GENERATED_BY)) wasFiltered.add(w); } - if (expected.size() == 0) + if (expected.isEmpty()) expected = null; - if (wasFiltered.size() == 0) + if (wasFiltered.isEmpty()) wasFiltered = null; assertEquals(expected, wasFiltered); } @@ -175,7 +175,7 @@ private static String getTrainingCenterRouteName(BaseRoute route) { // remove RouteConverter course folder name prefix int index = name.indexOf('/'); if (index != -1) - name = name.substring(index + 1, name.length()); + name = name.substring(index + 1); name = name.replaceAll("\\d+: ", ""); return name.substring(0, min(15 - "RouteConverter".length() /* Prefix length */, name.length())); } @@ -390,8 +390,7 @@ private static void compareHeading(NavigationFormat sourceFormat, NavigationForm private static void compareHdop(NavigationFormat sourceFormat, NavigationFormat targetFormat, int index, NavigationPosition sourcePosition, NavigationPosition targetPosition) { Double sourceHdop = null; - if (sourcePosition instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) sourcePosition; + if (sourcePosition instanceof Wgs84Position wgs84Position) { sourceHdop = wgs84Position.getHdop(); } if (sourcePosition instanceof NmeaPosition) { @@ -400,8 +399,7 @@ private static void compareHdop(NavigationFormat sourceFormat, NavigationFormat } Double targetHdop = null; - if (targetPosition instanceof Wgs84Position) { - Wgs84Position wgs84TargetPosition = (Wgs84Position) targetPosition; + if (targetPosition instanceof Wgs84Position wgs84TargetPosition) { targetHdop = wgs84TargetPosition.getHdop(); } if (targetPosition instanceof NmeaPosition) { @@ -425,8 +423,7 @@ private static void compareHdop(NavigationFormat sourceFormat, NavigationFormat private static void comparePdop(NavigationFormat sourceFormat, NavigationFormat targetFormat, int index, NavigationPosition sourcePosition, NavigationPosition targetPosition) { Double sourcePdop = null; - if (sourcePosition instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) sourcePosition; + if (sourcePosition instanceof Wgs84Position wgs84Position) { sourcePdop = wgs84Position.getPdop(); } if (sourcePosition instanceof NmeaPosition) { @@ -435,8 +432,7 @@ private static void comparePdop(NavigationFormat sourceFormat, NavigationFormat } Double targetPdop = null; - if (targetPosition instanceof Wgs84Position) { - Wgs84Position wgs84TargetPosition = (Wgs84Position) targetPosition; + if (targetPosition instanceof Wgs84Position wgs84TargetPosition) { targetPdop = wgs84TargetPosition.getPdop(); } if (targetPosition instanceof NmeaPosition) { @@ -456,8 +452,7 @@ private static void comparePdop(NavigationFormat sourceFormat, NavigationFormat private static void compareVdop(NavigationFormat sourceFormat, NavigationFormat targetFormat, int index, NavigationPosition sourcePosition, NavigationPosition targetPosition) { Double sourceVdop = null; - if (sourcePosition instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) sourcePosition; + if (sourcePosition instanceof Wgs84Position wgs84Position) { sourceVdop = wgs84Position.getVdop(); } if (sourcePosition instanceof NmeaPosition) { @@ -466,8 +461,7 @@ private static void compareVdop(NavigationFormat sourceFormat, NavigationFormat } Double targetVdop = null; - if (targetPosition instanceof Wgs84Position) { - Wgs84Position wgs84TargetPosition = (Wgs84Position) targetPosition; + if (targetPosition instanceof Wgs84Position wgs84TargetPosition) { targetVdop = wgs84TargetPosition.getVdop(); } if (targetPosition instanceof NmeaPosition) { @@ -487,8 +481,7 @@ private static void compareVdop(NavigationFormat sourceFormat, NavigationFormat private static void compareSatellites(NavigationFormat sourceFormat, NavigationFormat targetFormat, int index, NavigationPosition sourcePosition, NavigationPosition targetPosition) { Integer sourceSatellites = null; - if (sourcePosition instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) sourcePosition; + if (sourcePosition instanceof Wgs84Position wgs84Position) { sourceSatellites = wgs84Position.getSatellites(); } if (sourcePosition instanceof NmeaPosition) { @@ -497,8 +490,7 @@ private static void compareSatellites(NavigationFormat sourceFormat, NavigationF } Integer targetSatellites = null; - if (targetPosition instanceof Wgs84Position) { - Wgs84Position wgs84TargetPosition = (Wgs84Position) targetPosition; + if (targetPosition instanceof Wgs84Position wgs84TargetPosition) { targetSatellites = wgs84TargetPosition.getSatellites(); } if (targetPosition instanceof NmeaPosition) { @@ -991,7 +983,7 @@ public static void readFile(File source, int routeCount, boolean expectElevation if (expectTime) { assertTrue("Position " + j + " has no time", position.hasTime()); if (previous != null) - assertTrue(!position.getTime().getCalendar().before(previous.getTime().getCalendar())); + assertFalse(position.getTime().getCalendar().before(previous.getTime().getCalendar())); } previous = position; } diff --git a/navigation-formats/src/test/java/slash/navigation/base/ReadIT.java b/navigation-formats/src/test/java/slash/navigation/base/ReadIT.java index e90a7aa7e1..c957b37edf 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/ReadIT.java +++ b/navigation-formats/src/test/java/slash/navigation/base/ReadIT.java @@ -74,7 +74,7 @@ public void test(File file) throws IOException { assertNotNull(result.getFormat()); assertNotNull("Cannot get route from " + file, result.getTheRoute()); assertNotNull(result.getAllRoutes()); - assertTrue(result.getAllRoutes().size() > 0); + assertTrue(!result.getAllRoutes().isEmpty()); for (BaseRoute route : result.getAllRoutes()) { List positions = route.getPositions(); for (NavigationPosition position : positions) { diff --git a/navigation-formats/src/test/java/slash/navigation/base/ReadWriteBase.java b/navigation-formats/src/test/java/slash/navigation/base/ReadWriteBase.java index d7f0bc5d89..9e9c7ebab1 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/ReadWriteBase.java +++ b/navigation-formats/src/test/java/slash/navigation/base/ReadWriteBase.java @@ -45,7 +45,7 @@ public static void readWriteRoundtrip(String testFileName, ReadWriteTestCallback assertNotNull(result); assertNotNull(result.getFormat()); assertNotNull(result.getAllRoutes()); - assertTrue(result.getAllRoutes().size() > 0); + assertTrue(!result.getAllRoutes().isEmpty()); File target = createTempFile("target", getExtension(source)); // see AlanWaypointsAndRoutesFormat#isSupportsMultipleRoutes @@ -79,7 +79,7 @@ public static void readWriteRoundtrip(String testFileName, ReadWriteTestCallback BaseRoute sourceRoute = sourceRoutes.get(i); BaseRoute targetRoute = targetRoutes.get(i); compareRouteMetaData(sourceRoute, targetRoute); - comparePositions(sourceRoute, sourceFormat, targetRoute, targetFormat, targetRoutes.size() > 0); + comparePositions(sourceRoute, sourceFormat, targetRoute, targetFormat, !targetRoutes.isEmpty()); } if (parserCallback != null) diff --git a/navigation-formats/src/test/java/slash/navigation/base/RouteCommentsTest.java b/navigation-formats/src/test/java/slash/navigation/base/RouteCommentsTest.java index 48c25f9daf..e5ea765284 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/RouteCommentsTest.java +++ b/navigation-formats/src/test/java/slash/navigation/base/RouteCommentsTest.java @@ -36,7 +36,7 @@ import static slash.navigation.common.NumberPattern.*; public class RouteCommentsTest { - private BcrRoute route = new BcrRoute(new MTP0607Format(), "r", null, new ArrayList<>()); + private final BcrRoute route = new BcrRoute(new MTP0607Format(), "r", null, new ArrayList<>()); private BcrPosition createPosition(String description) { return new BcrPosition(1, 2, 3, description); diff --git a/navigation-formats/src/test/java/slash/navigation/base/SplitIT.java b/navigation-formats/src/test/java/slash/navigation/base/SplitIT.java index c10562b689..2f4809aeac 100644 --- a/navigation-formats/src/test/java/slash/navigation/base/SplitIT.java +++ b/navigation-formats/src/test/java/slash/navigation/base/SplitIT.java @@ -52,7 +52,7 @@ private void splitReadWriteRoundtrip(String testFileName, boolean duplicateFirst BaseRoute sourceRoute = result.getTheRoute(); assertNotNull(sourceRoute); assertNotNull(result.getAllRoutes()); - assertTrue(result.getAllRoutes().size() > 0); + assertTrue(!result.getAllRoutes().isEmpty()); int maximumPositionCount = result.getFormat().getMaximumPositionCount(); if (maximumPositionCount == UNLIMITED_MAXIMUM_POSITION_COUNT) { @@ -76,7 +76,7 @@ private void splitReadWriteRoundtrip(String testFileName, boolean duplicateFirst NavigationFormat sourceFormat = sourceResult.getFormat(); NavigationFormat targetFormat = targetResult.getFormat(); assertEquals(sourceFormat, targetFormat); - assertEquals(i != targets.length - 1 ? maximumPositionCount : (positionCount - i * maximumPositionCount), + assertEquals(i != targets.length - 1 ? maximumPositionCount : (positionCount - (long) i * maximumPositionCount), targetResult.getTheRoute().getPositionCount()); targetPositionCount += targetResult.getTheRoute().getPositionCount(); @@ -178,7 +178,7 @@ void convertSplitRoundtrip(String testFileName, BaseNavigationFormat sourceForma assertNotNull(result.getFormat()); assertNotNull(result.getTheRoute()); assertNotNull(result.getAllRoutes()); - assertTrue(result.getAllRoutes().size() > 0); + assertTrue(!result.getAllRoutes().isEmpty()); BaseRoute sourceRoute = result.getTheRoute(); int maximumPositionCount = targetFormat.getMaximumPositionCount(); @@ -199,7 +199,7 @@ void convertSplitRoundtrip(String testFileName, BaseNavigationFormat sourceForma assertEquals(targetFormat.getClass(), targetResult.getFormat().getClass()); assertEquals(sourceFormat.getName(), sourceResult.getFormat().getName()); assertEquals(targetFormat.getName(), targetResult.getFormat().getName()); - assertEquals(i != targets.length - 1 ? maximumPositionCount : (positionCount - i * maximumPositionCount), + assertEquals(i != targets.length - 1 ? maximumPositionCount : (positionCount - (long) i * maximumPositionCount), targetResult.getTheRoute().getPositionCount()); compareSplitPositions(sourceResult.getTheRoute().getPositions(), sourceFormat, diff --git a/navigation-formats/src/test/java/slash/navigation/bcr/BcrRouteTest.java b/navigation-formats/src/test/java/slash/navigation/bcr/BcrRouteTest.java index 429dad6f0e..8a367e9b0c 100644 --- a/navigation-formats/src/test/java/slash/navigation/bcr/BcrRouteTest.java +++ b/navigation-formats/src/test/java/slash/navigation/bcr/BcrRouteTest.java @@ -32,13 +32,13 @@ import static slash.common.type.CompactCalendar.fromMillis; public class BcrRouteTest { - private BcrRoute route = new BcrRoute(new MTP0607Format(), "r", null, new ArrayList<>()); - private BcrPosition a = new BcrPosition(1, 1, 0, "a"); - private BcrPosition b = new BcrPosition(2, 1, 0, "b"); - private BcrPosition c = new BcrPosition(3, 2, 0, "c"); - private BcrPosition d = new BcrPosition(1, 3, 0, "d"); - private BcrPosition e = new BcrPosition(1, 1, 0, "e"); - private BcrPosition zero = new BcrPosition(null, null, null, null, null, null); + private final BcrRoute route = new BcrRoute(new MTP0607Format(), "r", null, new ArrayList<>()); + private final BcrPosition a = new BcrPosition(1, 1, 0, "a"); + private final BcrPosition b = new BcrPosition(2, 1, 0, "b"); + private final BcrPosition c = new BcrPosition(3, 2, 0, "c"); + private final BcrPosition d = new BcrPosition(1, 3, 0, "d"); + private final BcrPosition e = new BcrPosition(1, 1, 0, "e"); + private final BcrPosition zero = new BcrPosition(null, null, null, null, null, null); private void initialize() { List positions = route.getPositions(); diff --git a/navigation-formats/src/test/java/slash/navigation/bcr/MG2009IntranetTest.java b/navigation-formats/src/test/java/slash/navigation/bcr/MG2009IntranetTest.java index 63e19aa3dc..38e6ad53d5 100644 --- a/navigation-formats/src/test/java/slash/navigation/bcr/MG2009IntranetTest.java +++ b/navigation-formats/src/test/java/slash/navigation/bcr/MG2009IntranetTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.assertTrue; public class MG2009IntranetTest { - private MTP0809Format format = new MTP0809Format(); + private final MTP0809Format format = new MTP0809Format(); @Test public void testIsSectionTitle() { diff --git a/navigation-formats/src/test/java/slash/navigation/bcr/MTP0607FormatTest.java b/navigation-formats/src/test/java/slash/navigation/bcr/MTP0607FormatTest.java index 58957dd51a..ba00b5057f 100644 --- a/navigation-formats/src/test/java/slash/navigation/bcr/MTP0607FormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/bcr/MTP0607FormatTest.java @@ -35,8 +35,8 @@ import static slash.navigation.bcr.BcrPosition.STREET_DEFINES_CENTER_NAME; public class MTP0607FormatTest { - private MTP0607Format format = new MTP0607Format(); - private BcrRoute route = new BcrRoute(format, "RouteName", asList("Description1", "Description2"), asList(new BcrPosition(1, 2, 3, "Start"), new BcrPosition(3, 4, 5, "End"))); + private final MTP0607Format format = new MTP0607Format(); + private final BcrRoute route = new BcrRoute(format, "RouteName", asList("Description1", "Description2"), asList(new BcrPosition(1, 2, 3, "Start"), new BcrPosition(3, 4, 5, "End"))); @Test public void testIsSectionTitle() { diff --git a/navigation-formats/src/test/java/slash/navigation/bcr/MTP0809FormatTest.java b/navigation-formats/src/test/java/slash/navigation/bcr/MTP0809FormatTest.java index f423bad4d7..7d407b2ae7 100644 --- a/navigation-formats/src/test/java/slash/navigation/bcr/MTP0809FormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/bcr/MTP0809FormatTest.java @@ -33,8 +33,8 @@ import static slash.common.io.Transfer.ISO_LATIN1_ENCODING; public class MTP0809FormatTest { - private MTP0809Format format = new MTP0809Format(); - private BcrRoute route = new BcrRoute(format, "RouteName", Arrays.asList("Description1", "Description2"), Arrays.asList(new BcrPosition(1, 2, 3, "Start"), new BcrPosition(3, 4, 5, "WP,End,@,,0,"))); + private final MTP0809Format format = new MTP0809Format(); + private final BcrRoute route = new BcrRoute(format, "RouteName", Arrays.asList("Description1", "Description2"), Arrays.asList(new BcrPosition(1, 2, 3, "Start"), new BcrPosition(3, 4, 5, "WP,End,@,,0,"))); @Test public void testReaddescription() throws IOException { diff --git a/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusGpsBinaryFormatTest.java b/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusGpsBinaryFormatTest.java index eaf32f8deb..85c6673022 100644 --- a/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusGpsBinaryFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusGpsBinaryFormatTest.java @@ -10,7 +10,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class ColumbusGpsBinaryFormatTest { - private ColumbusGpsBinaryFormat format = new ColumbusGpsBinaryFormat(); + private final ColumbusGpsBinaryFormat format = new ColumbusGpsBinaryFormat(); @Test public void testHasBitSet() { diff --git a/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusGpsType1FormatTest.java b/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusGpsType1FormatTest.java index 051102c96e..b21f4b6aaf 100644 --- a/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusGpsType1FormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusGpsType1FormatTest.java @@ -32,7 +32,7 @@ import static slash.common.TestCase.calendar; public class ColumbusGpsType1FormatTest { - private ColumbusGpsType1Format format = new ColumbusGpsType1Format(); + private final ColumbusGpsType1Format format = new ColumbusGpsType1Format(); @Test public void testIsValidLine() { @@ -131,4 +131,4 @@ public void testParseTypeBPOIDPosition() { Wgs84Position position = format.parsePosition("8 ,D,090421,061058,47.797278S,013.049739W,502 ,8 ,206,", new ParserContextImpl()); assertEquals("PointOfInterestD 8", position.getDescription()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusNavigationFormatRegistryTest.java b/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusNavigationFormatRegistryTest.java index 14f4818c54..443b61d6f4 100644 --- a/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusNavigationFormatRegistryTest.java +++ b/navigation-formats/src/test/java/slash/navigation/columbus/ColumbusNavigationFormatRegistryTest.java @@ -35,7 +35,7 @@ import static org.junit.Assert.*; public class ColumbusNavigationFormatRegistryTest { - private NavigationFormatRegistry registry = new ColumbusNavigationFormatRegistry(); + private final NavigationFormatRegistry registry = new ColumbusNavigationFormatRegistry(); @Test public void testNotExistingExtension() { diff --git a/navigation-formats/src/test/java/slash/navigation/copilot/CoPilotFormatTest.java b/navigation-formats/src/test/java/slash/navigation/copilot/CoPilotFormatTest.java index 2ffaf8988c..f0e3844a57 100644 --- a/navigation-formats/src/test/java/slash/navigation/copilot/CoPilotFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/copilot/CoPilotFormatTest.java @@ -30,7 +30,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class CoPilotFormatTest { - private CoPilot6Format format = new CoPilot6Format(); + private final CoPilot6Format format = new CoPilot6Format(); @Test public void testIsValidLine() { diff --git a/navigation-formats/src/test/java/slash/navigation/csv/CsvFormatIT.java b/navigation-formats/src/test/java/slash/navigation/csv/CsvFormatIT.java index 66ae523091..0301445dca 100644 --- a/navigation-formats/src/test/java/slash/navigation/csv/CsvFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/csv/CsvFormatIT.java @@ -31,7 +31,7 @@ import static slash.navigation.base.NavigationTestCase.TEST_PATH; public class CsvFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new NavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new NavigationFormatRegistry()); private void checkRoute(BaseRoute route) { assertEquals(3, route.getPositionCount()); diff --git a/navigation-formats/src/test/java/slash/navigation/excel/ExcelFormatIT.java b/navigation-formats/src/test/java/slash/navigation/excel/ExcelFormatIT.java index c160d37ccb..f98e13db6e 100644 --- a/navigation-formats/src/test/java/slash/navigation/excel/ExcelFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/excel/ExcelFormatIT.java @@ -31,7 +31,7 @@ import static slash.navigation.base.NavigationTestCase.calendar; public class ExcelFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new NavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new NavigationFormatRegistry()); private void checkAllRoutes(ParserResult result) { assertEquals(3, result.getAllRoutes().size()); diff --git a/navigation-formats/src/test/java/slash/navigation/excel/ExcelRowOrderIT.java b/navigation-formats/src/test/java/slash/navigation/excel/ExcelRowOrderIT.java index 460515cffd..efe47f9ccb 100644 --- a/navigation-formats/src/test/java/slash/navigation/excel/ExcelRowOrderIT.java +++ b/navigation-formats/src/test/java/slash/navigation/excel/ExcelRowOrderIT.java @@ -34,7 +34,7 @@ import static slash.navigation.base.NavigationTestCase.calendar; public class ExcelRowOrderIT { - private NavigationFormatParser parser = new NavigationFormatParser(new NavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new NavigationFormatRegistry()); private static final File SOURCE = new File(TEST_PATH + "from-order.xls"); private BaseRoute readRoute() throws IOException { diff --git a/navigation-formats/src/test/java/slash/navigation/gopal/GoPalTrackFormatIT.java b/navigation-formats/src/test/java/slash/navigation/gopal/GoPalTrackFormatIT.java index 3349976b9e..6a3cc04779 100644 --- a/navigation-formats/src/test/java/slash/navigation/gopal/GoPalTrackFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/gopal/GoPalTrackFormatIT.java @@ -33,7 +33,7 @@ import static slash.navigation.base.NavigationTestCase.SAMPLE_PATH; public class GoPalTrackFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new NavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new NavigationFormatRegistry()); @Test public void testIsNotNmn6FavoritesWithValidPositions() throws IOException { @@ -42,4 +42,4 @@ public void testIsNotNmn6FavoritesWithValidPositions() throws IOException { assertNotNull(result); assertEquals(GoPalTrackFormat.class, result.getFormat().getClass()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/gpx/Gpx11ExtensionsTest.java b/navigation-formats/src/test/java/slash/navigation/gpx/Gpx11ExtensionsTest.java index df56810f5f..ea8a3db3c4 100644 --- a/navigation-formats/src/test/java/slash/navigation/gpx/Gpx11ExtensionsTest.java +++ b/navigation-formats/src/test/java/slash/navigation/gpx/Gpx11ExtensionsTest.java @@ -41,10 +41,10 @@ import static slash.navigation.gpx.GpxUtil.toXml; public class Gpx11ExtensionsTest { - private slash.navigation.gpx.binding11.ObjectFactory gpx11Factory = new slash.navigation.gpx.binding11.ObjectFactory(); - private slash.navigation.gpx.garmin3.ObjectFactory garmin3Factory = new slash.navigation.gpx.garmin3.ObjectFactory(); - private slash.navigation.gpx.trackpoint1.ObjectFactory trackpoint1Factory = new slash.navigation.gpx.trackpoint1.ObjectFactory(); - private slash.navigation.gpx.trackpoint2.ObjectFactory trackpoint2Factory = new slash.navigation.gpx.trackpoint2.ObjectFactory(); + private final slash.navigation.gpx.binding11.ObjectFactory gpx11Factory = new slash.navigation.gpx.binding11.ObjectFactory(); + private final slash.navigation.gpx.garmin3.ObjectFactory garmin3Factory = new slash.navigation.gpx.garmin3.ObjectFactory(); + private final slash.navigation.gpx.trackpoint1.ObjectFactory trackpoint1Factory = new slash.navigation.gpx.trackpoint1.ObjectFactory(); + private final slash.navigation.gpx.trackpoint2.ObjectFactory trackpoint2Factory = new slash.navigation.gpx.trackpoint2.ObjectFactory(); private WptType createWptType() { WptType trkptType = gpx11Factory.createWptType(); @@ -79,7 +79,7 @@ private List readGpx(String source) throws Exception { private String writeGpx(List routes) throws Exception { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); new Gpx11Format().write(routes, outputStream); - return new String(outputStream.toByteArray(), StandardCharsets.UTF_8); + return outputStream.toString(StandardCharsets.UTF_8); } @@ -105,7 +105,7 @@ public void testWriteHeading() throws Exception { @Test public void testWriteTrackpoint2Heading() throws Exception { slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPointExtensionT = trackpoint2Factory.createTrackPointExtensionT(); - trackPointExtensionT.setCourse(new BigDecimal(168.4)); + trackPointExtensionT.setCourse(new BigDecimal("168.4")); ExtensionsType extensionsType = gpx11Factory.createExtensionsType(); extensionsType.getAny().add(trackpoint2Factory.createTrackPointExtension(trackPointExtensionT)); @@ -142,8 +142,8 @@ public void testWriteTrackpoint2Heading() throws Exception { @Test public void testWriteTrackpoint2HeadingAndBearing() throws Exception { slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPointExtensionT = trackpoint2Factory.createTrackPointExtensionT(); - trackPointExtensionT.setCourse(new BigDecimal(168.4)); - trackPointExtensionT.setBearing(new BigDecimal(2.2)); + trackPointExtensionT.setCourse(new BigDecimal("168.4")); + trackPointExtensionT.setBearing(new BigDecimal("2.2")); ExtensionsType extensionsType = gpx11Factory.createExtensionsType(); extensionsType.getAny().add(trackpoint2Factory.createTrackPointExtension(trackPointExtensionT)); @@ -273,8 +273,8 @@ public void testWriteTrackpoint2Speed() throws Exception { @Test public void testWriteTrackpoint2SpeedAndBearing() throws Exception { slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPointExtensionT = trackpoint2Factory.createTrackPointExtensionT(); - trackPointExtensionT.setCourse(new BigDecimal(168.4)); - trackPointExtensionT.setBearing(new BigDecimal(2.2)); + trackPointExtensionT.setCourse(new BigDecimal("168.4")); + trackPointExtensionT.setBearing(new BigDecimal("2.2")); ExtensionsType extensionsType = gpx11Factory.createExtensionsType(); extensionsType.getAny().add(trackpoint2Factory.createTrackPointExtension(trackPointExtensionT)); diff --git a/navigation-formats/src/test/java/slash/navigation/itn/TomTomRouteFormatIT.java b/navigation-formats/src/test/java/slash/navigation/itn/TomTomRouteFormatIT.java index 84e9e2b5f4..0e5007bcfc 100644 --- a/navigation-formats/src/test/java/slash/navigation/itn/TomTomRouteFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/itn/TomTomRouteFormatIT.java @@ -35,7 +35,7 @@ import static slash.navigation.base.RouteCharacteristics.Track; public class TomTomRouteFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); @Test public void testIsPlainRouteRouteCharacteristics() throws IOException { @@ -126,4 +126,4 @@ public void testUrbanRinder() throws IOException { BaseRoute route = result.getTheRoute(); checkPlaceNamesWithUmlauts(route); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/itn/TomTomRouteFormatTest.java b/navigation-formats/src/test/java/slash/navigation/itn/TomTomRouteFormatTest.java index 0e2a48c7f9..a63e90d521 100644 --- a/navigation-formats/src/test/java/slash/navigation/itn/TomTomRouteFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/itn/TomTomRouteFormatTest.java @@ -29,7 +29,7 @@ import static slash.navigation.base.RouteComments.parseDescription; public class TomTomRouteFormatTest { - private TomTomRouteFormat format = new TomTom5RouteFormat(); + private final TomTomRouteFormat format = new TomTom5RouteFormat(); @Test public void testIsPosition() { diff --git a/navigation-formats/src/test/java/slash/navigation/kml/Bt747Test.java b/navigation-formats/src/test/java/slash/navigation/kml/Bt747Test.java index 026791e9e4..9c6a8ee321 100644 --- a/navigation-formats/src/test/java/slash/navigation/kml/Bt747Test.java +++ b/navigation-formats/src/test/java/slash/navigation/kml/Bt747Test.java @@ -30,7 +30,7 @@ import static slash.common.TestCase.calendar; public class Bt747Test { - private Kml20Format format = new Kml20Format(); + private final Kml20Format format = new Kml20Format(); private static final String BT747_NAME = "TIME: 10:11:56; <table width=400><tr><td>Index:</td><td>7643</td></tr><tr><td>Zeit:</td><td>05-September-10 10:11:56</td></tr><tr><td>Geographische Breite:</td><td>49.385769 N</td></tr><tr><td>Geografische L&auml;nge:</td><td>8.572565 E</td></tr><tr><td>H&ouml;he:</td><td>102.109 m</td></tr></table>".replaceAll(">", ">").replaceAll("<", "<"); @Test diff --git a/navigation-formats/src/test/java/slash/navigation/kml/Navigon6310Test.java b/navigation-formats/src/test/java/slash/navigation/kml/Navigon6310Test.java index 2740aa4c0d..0b13e4abbc 100644 --- a/navigation-formats/src/test/java/slash/navigation/kml/Navigon6310Test.java +++ b/navigation-formats/src/test/java/slash/navigation/kml/Navigon6310Test.java @@ -30,7 +30,7 @@ import static slash.common.TestCase.calendar; public class Navigon6310Test { - private Kml20Format format = new Kml20Format(); + private final Kml20Format format = new Kml20Format(); private static final String NAVIGON6310_NAME = " 10:08:18, 509.49 meter "; @Test diff --git a/navigation-formats/src/test/java/slash/navigation/kml/QstarzTest.java b/navigation-formats/src/test/java/slash/navigation/kml/QstarzTest.java index c16af368ce..1b4277b164 100644 --- a/navigation-formats/src/test/java/slash/navigation/kml/QstarzTest.java +++ b/navigation-formats/src/test/java/slash/navigation/kml/QstarzTest.java @@ -30,7 +30,7 @@ import static slash.common.TestCase.calendar; public class QstarzTest { - private Kml20Format format = new Kml20Format(); + private final Kml20Format format = new Kml20Format(); private static final String QSTARZ_DESCRIPTION = "\n" + " Time: 23:01:39
Latitude: 49.126387 N
Longitude: 8.613990 E
Speed: 0.561 km/h
DISTANCE: 0.66 m
]]>\n" + "
"; diff --git a/navigation-formats/src/test/java/slash/navigation/kml/TavellogTest.java b/navigation-formats/src/test/java/slash/navigation/kml/TavellogTest.java index 641855de85..06b9b26ccc 100644 --- a/navigation-formats/src/test/java/slash/navigation/kml/TavellogTest.java +++ b/navigation-formats/src/test/java/slash/navigation/kml/TavellogTest.java @@ -30,7 +30,7 @@ import static slash.common.TestCase.calendar; public class TavellogTest { - private Kml20Format format = new Kml20Format(); + private final Kml20Format format = new Kml20Format(); private static final String TAVELLOG_DESCRIPTION = "Time: 2009/02/07 21:45:55
Altitude: 62.20
Speed: 15.37
]]>
"; @Test diff --git a/navigation-formats/src/test/java/slash/navigation/kml/Wbt201LogTest.java b/navigation-formats/src/test/java/slash/navigation/kml/Wbt201LogTest.java index 55bfd1d3f6..3a644246be 100644 --- a/navigation-formats/src/test/java/slash/navigation/kml/Wbt201LogTest.java +++ b/navigation-formats/src/test/java/slash/navigation/kml/Wbt201LogTest.java @@ -23,7 +23,7 @@ import slash.navigation.base.NavigationTestCase; public class Wbt201LogTest extends NavigationTestCase { - private Kml20Format format = new Kml20Format(); + private final Kml20Format format = new Kml20Format(); private static final String WBT201LOG_DESCRIPTION = "Lat.=7.5878249°

Long.=51.1295766°

Alt.=390m (1279ft)

Speed=4Km/h (2Mile/h)

Course=270°

Elapsed Time: +00:00:11

Total distance: 0.02Km (0.01Mile)
\n" + "\t\t\t\t]]>
"; @@ -33,4 +33,4 @@ public void testParseSpeed() { assertEquals(4.0, format.parseSpeed(WBT201LOG_DESCRIPTION)); assertEquals(4.0, format.parseSpeed(WBT201LOG_DESCRIPTION2)); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/nmea/MagellanExploristFormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmea/MagellanExploristFormatTest.java index 4dc01f4fc3..0593fc614c 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmea/MagellanExploristFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmea/MagellanExploristFormatTest.java @@ -35,7 +35,7 @@ import static slash.common.io.Transfer.ISO_LATIN1_ENCODING; public class MagellanExploristFormatTest { - private MagellanExploristFormat format = new MagellanExploristFormat(); + private final MagellanExploristFormat format = new MagellanExploristFormat(); @Test public void testIsValidLine() { @@ -131,4 +131,4 @@ public void testWritePMGNTRK() throws IOException { "$PMGNCMD,END*3D" + eol; assertEquals(expectedLines, writer.getBuffer().toString()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/nmea/MagellanRouteFormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmea/MagellanRouteFormatTest.java index 099af962f5..fdfe410eae 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmea/MagellanRouteFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmea/MagellanRouteFormatTest.java @@ -32,7 +32,7 @@ import static slash.common.io.Transfer.ISO_LATIN1_ENCODING; public class MagellanRouteFormatTest { - private MagellanRouteFormat format = new MagellanRouteFormat(); + private final MagellanRouteFormat format = new MagellanRouteFormat(); @Test public void testIsValidLine() { @@ -132,4 +132,4 @@ public void testRTECreation() throws IOException { "$PMGNCMD,END*3D" + eol; assertEquals(expectedLines, writer.getBuffer().toString()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/nmea/NmeaFormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmea/NmeaFormatTest.java index e29f1cd609..40676a5f3d 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmea/NmeaFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmea/NmeaFormatTest.java @@ -466,7 +466,7 @@ public void testMerging2() throws IOException { assertEquals(1, routes.size()); SimpleRoute route = routes.get(0); assertEquals(1, route.getPositionCount()); - NmeaPosition position = (NmeaPosition) route.getPositions().get(0); + NmeaPosition position = route.getPositions().get(0); assertDoubleEquals(9.8037979667, position.getLongitude()); assertDoubleEquals(43.01497215, position.getLatitude()); assertDoubleEquals(19.3175, position.getSpeed()); diff --git a/navigation-formats/src/test/java/slash/navigation/nmn/NavigatingPoiWarnerFormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmn/NavigatingPoiWarnerFormatTest.java index c18fe8c98a..0fd13b7f6b 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmn/NavigatingPoiWarnerFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmn/NavigatingPoiWarnerFormatTest.java @@ -27,7 +27,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class NavigatingPoiWarnerFormatTest { - private NavigatingPoiWarnerFormat format = new NavigatingPoiWarnerFormat(); + private final NavigatingPoiWarnerFormat format = new NavigatingPoiWarnerFormat(); @Test public void testIsValidLine() { diff --git a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn4FormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn4FormatTest.java index 27fe9c6d5a..73fe467c08 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn4FormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn4FormatTest.java @@ -27,7 +27,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class Nmn4FormatTest { - private Nmn4Format format = new Nmn4Format(); + private final Nmn4Format format = new Nmn4Format(); @Test public void testIsPosition() { @@ -96,4 +96,4 @@ public void testParseMN42Position() { assertNull(position.getNumber()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn5FormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn5FormatTest.java index 66d1ea6c03..7937184eb4 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn5FormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn5FormatTest.java @@ -26,7 +26,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class Nmn5FormatTest { - private Nmn5Format format = new Nmn5Format(); + private final Nmn5Format format = new Nmn5Format(); @Test public void testIsPosition() { diff --git a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FavoritesFormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FavoritesFormatTest.java index f544af83c0..eecdf0abb3 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FavoritesFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FavoritesFormatTest.java @@ -27,7 +27,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class Nmn6FavoritesFormatTest { - private Nmn6FavoritesFormat format = new Nmn6FavoritesFormat(); + private final Nmn6FavoritesFormat format = new Nmn6FavoritesFormat(); @Test public void testIsPosition() { diff --git a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FormatIT.java b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FormatIT.java index 0e7b01da02..f35adcb7e9 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FormatIT.java @@ -33,7 +33,7 @@ import static slash.navigation.base.NavigationTestCase.SAMPLE_PATH; public class Nmn6FormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); @Test public void testIsNmn6FavoritesWithValidPositionsOnly() throws IOException { @@ -50,4 +50,4 @@ public void testIsNmn6WithFirstValidLineButNotPosition() throws IOException { assertNotNull(result); assertEquals(Nmn6Format.class, result.getFormat().getClass()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FormatTest.java index a88b580b41..0966c77221 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmn/Nmn6FormatTest.java @@ -27,7 +27,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class Nmn6FormatTest { - private Nmn6Format format = new Nmn6Format(); + private final Nmn6Format format = new Nmn6Format(); @Test public void testIsPosition() { diff --git a/navigation-formats/src/test/java/slash/navigation/nmn/NmnUrlFormatTest.java b/navigation-formats/src/test/java/slash/navigation/nmn/NmnUrlFormatTest.java index 239413e889..8005b432e3 100644 --- a/navigation-formats/src/test/java/slash/navigation/nmn/NmnUrlFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/nmn/NmnUrlFormatTest.java @@ -46,7 +46,7 @@ public class NmnUrlFormatTest { private static final String USA_URL = "navigonUSA-CA://route/?target=address//USA-CA/CA%2092120/SAN%20DIEGO/ALVARADO%20CANYON%20RD/4620/-117.09521/32.78042&target=address//USA-NV/NV%2089101/LAS%20VEGAS///-115.13997/36.17191"; private static final String NO_MAP_URL = "Unterm Kolm 11, 44797 Bochum ? Martin-Schmeisser-Weg 8, 44227 Dorstfeld, Dortmund"; - private NmnUrlFormat format = new NmnUrlFormat(); + private final NmnUrlFormat format = new NmnUrlFormat(); @Test public void testFindURL() { diff --git a/navigation-formats/src/test/java/slash/navigation/photo/PhotoFormatIT.java b/navigation-formats/src/test/java/slash/navigation/photo/PhotoFormatIT.java index 36fc5b9b0f..bb666ee1b1 100644 --- a/navigation-formats/src/test/java/slash/navigation/photo/PhotoFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/photo/PhotoFormatIT.java @@ -39,7 +39,7 @@ import static slash.navigation.base.NavigationTestCase.TEST_PATH; public class PhotoFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); public static void assertRationalNumberEquals(RationalNumber expected, RationalNumber was) { assertEquals(expected.numerator, was.numerator); diff --git a/navigation-formats/src/test/java/slash/navigation/simple/ApeMapFormatTest.java b/navigation-formats/src/test/java/slash/navigation/simple/ApeMapFormatTest.java index b01c77f7bf..b64e61630b 100644 --- a/navigation-formats/src/test/java/slash/navigation/simple/ApeMapFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/simple/ApeMapFormatTest.java @@ -31,7 +31,7 @@ import static slash.common.TestCase.utcCalendar; public class ApeMapFormatTest { - private ApeMapFormat format = new ApeMapFormat(); + private final ApeMapFormat format = new ApeMapFormat(); @Test public void testGetExtension() { diff --git a/navigation-formats/src/test/java/slash/navigation/simple/GoRiderGpsFormatTest.java b/navigation-formats/src/test/java/slash/navigation/simple/GoRiderGpsFormatTest.java index 38a06bb79b..1f7b0fd933 100644 --- a/navigation-formats/src/test/java/slash/navigation/simple/GoRiderGpsFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/simple/GoRiderGpsFormatTest.java @@ -27,7 +27,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class GoRiderGpsFormatTest { - private GoRiderGpsFormat format = new GoRiderGpsFormat(); + private final GoRiderGpsFormat format = new GoRiderGpsFormat(); @Test public void testIsValidLine() { @@ -60,4 +60,4 @@ public void testParsePosition() { assertEquals("Tjardaweg", position.getDescription()); assertNull(position.getElevation()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/simple/Iblue747FormatTest.java b/navigation-formats/src/test/java/slash/navigation/simple/Iblue747FormatTest.java index 21fa35f9df..22582122b5 100644 --- a/navigation-formats/src/test/java/slash/navigation/simple/Iblue747FormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/simple/Iblue747FormatTest.java @@ -31,7 +31,7 @@ import static slash.common.TestCase.calendar; public class Iblue747FormatTest { - private Iblue747Format format = new Iblue747Format(); + private final Iblue747Format format = new Iblue747Format(); @Test public void testIsValidLine() { @@ -62,4 +62,4 @@ public void testParsePosition() { assertEquals(expected, actual); assertEquals(expectedCal, position.getTime()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/simple/KienzleGpsFormatTest.java b/navigation-formats/src/test/java/slash/navigation/simple/KienzleGpsFormatTest.java index 09e078d612..85aaf76a75 100644 --- a/navigation-formats/src/test/java/slash/navigation/simple/KienzleGpsFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/simple/KienzleGpsFormatTest.java @@ -32,7 +32,7 @@ import static slash.common.TestCase.calendar; public class KienzleGpsFormatTest { - private KienzleGpsFormat format = new KienzleGpsFormat(); + private final KienzleGpsFormat format = new KienzleGpsFormat(); @Test public void testIsValidLine() { @@ -69,4 +69,4 @@ public void testParseNegativePosition() { assertDoubleEquals(-7.0475000000, position.getLongitude()); assertDoubleEquals(-50.7500000000, position.getLatitude()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/simple/KompassFormatTest.java b/navigation-formats/src/test/java/slash/navigation/simple/KompassFormatTest.java index f75de2d75d..14fa5e7772 100644 --- a/navigation-formats/src/test/java/slash/navigation/simple/KompassFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/simple/KompassFormatTest.java @@ -26,7 +26,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class KompassFormatTest { - private KompassFormat format = new KompassFormat(); + private final KompassFormat format = new KompassFormat(); @Test public void testIsPosition() { @@ -60,4 +60,4 @@ public void testParsePositionWithoutElevation() { assertNull(position.getElevation()); assertNull(position.getDescription()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/simple/QstarzQ1000FormatTest.java b/navigation-formats/src/test/java/slash/navigation/simple/QstarzQ1000FormatTest.java index da6e5db62c..cad5986d2a 100644 --- a/navigation-formats/src/test/java/slash/navigation/simple/QstarzQ1000FormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/simple/QstarzQ1000FormatTest.java @@ -31,7 +31,7 @@ import static slash.common.TestCase.calendar; public class QstarzQ1000FormatTest { - private QstarzQ1000Format format = new QstarzQ1000Format(); + private final QstarzQ1000Format format = new QstarzQ1000Format(); @Test public void testIsValidLine() { @@ -63,4 +63,4 @@ public void testParsePosition() { assertEquals(expected, actual); assertEquals(expectedCal, position.getTime()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/tcx/TcxFormatTest.java b/navigation-formats/src/test/java/slash/navigation/tcx/TcxFormatTest.java index e9886021ee..7f8a59c5e9 100644 --- a/navigation-formats/src/test/java/slash/navigation/tcx/TcxFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/tcx/TcxFormatTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.assertEquals; public class TcxFormatTest { - private TcxFormat format = new Tcx2Format(); + private final TcxFormat format = new Tcx2Format(); @Test public void testCreateUniqueRouteName() { diff --git a/navigation-formats/src/test/java/slash/navigation/tour/TourFormatIT.java b/navigation-formats/src/test/java/slash/navigation/tour/TourFormatIT.java index 5315294f09..5231294b71 100644 --- a/navigation-formats/src/test/java/slash/navigation/tour/TourFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/tour/TourFormatIT.java @@ -31,7 +31,7 @@ import static slash.navigation.base.NavigationTestCase.TEST_PATH; public class TourFormatIT { - private TourFormat format = new TourFormat(); + private final TourFormat format = new TourFormat(); @Test public void testPositionInListOrder() throws Exception { @@ -44,4 +44,4 @@ public void testPositionInListOrder() throws Exception { assertEquals("10117 Berlin/Mitte, Platz Vor Dem Brandenburger Tor 1, Home", route.getPosition(1).getDescription()); assertEquals("10789 Berlin, Breitscheidplatz, Kaiser-Wilhelm-Ged\u00e4chtniskirche", route.getPosition(2).getDescription()); } -} \ No newline at end of file +} diff --git a/navigation-formats/src/test/java/slash/navigation/tour/TourFormatTest.java b/navigation-formats/src/test/java/slash/navigation/tour/TourFormatTest.java index 69cdddb47e..432a822c76 100644 --- a/navigation-formats/src/test/java/slash/navigation/tour/TourFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/tour/TourFormatTest.java @@ -29,7 +29,7 @@ import static slash.common.TestCase.assertDoubleEquals; public class TourFormatTest { - private TourFormat format = new TourFormat(); + private final TourFormat format = new TourFormat(); @Test public void testIsSectionTitle() { diff --git a/navigation-formats/src/test/java/slash/navigation/url/GoogleMapsUrlFormatTest.java b/navigation-formats/src/test/java/slash/navigation/url/GoogleMapsUrlFormatTest.java index a8ff3c099d..11acb31bab 100644 --- a/navigation-formats/src/test/java/slash/navigation/url/GoogleMapsUrlFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/url/GoogleMapsUrlFormatTest.java @@ -264,10 +264,10 @@ public void testParseEncodedGeocodePositionsFromInput7() { Wgs84Position position2 = positions.get(2); assertDoubleEquals(10.419159, position2.getLongitude()); assertDoubleEquals(53.588429, position2.getLatitude()); - assertEquals(null, position2.getDescription()); + assertNull(position2.getDescription()); Wgs84Position position3 = positions.get(3); - assertEquals(null, position3.getLongitude()); - assertEquals(null, position3.getLatitude()); + assertNull(position3.getLongitude()); + assertNull(position3.getLatitude()); assertEquals("Breitenfelde/Neuenlande", position3.getDescription()); } diff --git a/navigation-formats/src/test/java/slash/navigation/url/MotoPlanerUrlFormatTest.java b/navigation-formats/src/test/java/slash/navigation/url/MotoPlanerUrlFormatTest.java index 6d16ce167e..bd9860cd18 100644 --- a/navigation-formats/src/test/java/slash/navigation/url/MotoPlanerUrlFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/url/MotoPlanerUrlFormatTest.java @@ -33,7 +33,7 @@ public class MotoPlanerUrlFormatTest { private static final String INPUT1 = "http://www.motoplaner.de/#32.64013,-16.85148;1,32.70498,-16.8338;1,32.70624,-16.88255;1,32.66431,-16.86777;1,32.68353,-16.90509;1,32.67702,-16.94549;1,32.65959,-16.96608;1,32.74285,-17.02466;1,32.72115,-17.11077;1,32.72183,-17.15622;1,32.78202,-17.17759;1,32.86656,-17.17075;1,32.774,-16.87225;1,32.76274,-16.86161;1,32.74713,-16.82939;1,32.69222,-16.78324;1,32.64031,-16.85144;1&&1"; - private MotoPlanerUrlFormat format = new MotoPlanerUrlFormat(); + private final MotoPlanerUrlFormat format = new MotoPlanerUrlFormat(); @Test public void testFindURL() { diff --git a/navigation-formats/src/test/java/slash/navigation/url/UrlFormatIT.java b/navigation-formats/src/test/java/slash/navigation/url/UrlFormatIT.java index cd67e03874..5e4525c84f 100644 --- a/navigation-formats/src/test/java/slash/navigation/url/UrlFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/url/UrlFormatIT.java @@ -14,7 +14,7 @@ import static slash.navigation.base.NavigationTestCase.TEST_PATH; public class UrlFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); @Test public void readRouteCatalogUrl() throws IOException { diff --git a/navigation-formats/src/test/java/slash/navigation/url/UrlFormatTest.java b/navigation-formats/src/test/java/slash/navigation/url/UrlFormatTest.java index 0115899ac6..a2b8f7cdb7 100644 --- a/navigation-formats/src/test/java/slash/navigation/url/UrlFormatTest.java +++ b/navigation-formats/src/test/java/slash/navigation/url/UrlFormatTest.java @@ -43,7 +43,7 @@ public class UrlFormatTest { private static final String FILE = "file:///CWD/../RouteSamples/trunk/test/from11.gpx"; - private UrlFormat format = new UrlFormat(); + private final UrlFormat format = new UrlFormat(); @Test public void testFindGoogleMapsURLFromEmail() { diff --git a/navigation-formats/src/test/java/slash/navigation/zip/ZipFormatIT.java b/navigation-formats/src/test/java/slash/navigation/zip/ZipFormatIT.java index 061e2ea1f8..0e039ce728 100644 --- a/navigation-formats/src/test/java/slash/navigation/zip/ZipFormatIT.java +++ b/navigation-formats/src/test/java/slash/navigation/zip/ZipFormatIT.java @@ -14,7 +14,7 @@ import static slash.navigation.base.NavigationTestCase.TEST_PATH; public class ZipFormatIT { - private NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); + private final NavigationFormatParser parser = new NavigationFormatParser(new AllNavigationFormatRegistry()); @Test public void readGPX11Archive() throws IOException { diff --git a/nominatim/src/main/java/slash/navigation/nominatim/NominatimService.java b/nominatim/src/main/java/slash/navigation/nominatim/NominatimService.java index 00b3b0c0d1..0cfc7123ae 100644 --- a/nominatim/src/main/java/slash/navigation/nominatim/NominatimService.java +++ b/nominatim/src/main/java/slash/navigation/nominatim/NominatimService.java @@ -125,7 +125,7 @@ public String getAddressFor(NavigationPosition position) throws IOException { String result = (parts.getRoad() != null ? parts.getRoad() : parts.getSuburb() != null ? parts.getSuburb() : "") + (parts.getHouseNumber() != null ? " " + parts.getHouseNumber() : ""); - if (result.length() > 0) + if (!result.isEmpty()) result += ", "; result += (parts.getPostcode() != null ? parts.getPostcode() : "") + " " + (parts.getCity() != null ? parts.getCity() + ", " : diff --git a/nominatim/src/test/java/slash/navigation/nominatim/NominatimServiceIT.java b/nominatim/src/test/java/slash/navigation/nominatim/NominatimServiceIT.java index 9d923ac321..9370e06e83 100644 --- a/nominatim/src/test/java/slash/navigation/nominatim/NominatimServiceIT.java +++ b/nominatim/src/test/java/slash/navigation/nominatim/NominatimServiceIT.java @@ -30,7 +30,7 @@ import static org.junit.Assert.*; public class NominatimServiceIT { - private NominatimService service = new NominatimService(); + private final NominatimService service = new NominatimService(); @Test public void getPositionsFor() throws IOException { diff --git a/photon/src/main/java/slash/navigation/photon/PhotonService.java b/photon/src/main/java/slash/navigation/photon/PhotonService.java index bb8efbb4c1..c2e02926a7 100644 --- a/photon/src/main/java/slash/navigation/photon/PhotonService.java +++ b/photon/src/main/java/slash/navigation/photon/PhotonService.java @@ -88,10 +88,9 @@ private List extractPositions(List features) { List result = new ArrayList<>(features.size()); for (Feature feature : features) { GeoJsonObject geometry = feature.getGeometry(); - if (!(geometry instanceof Point)) + if (!(geometry instanceof Point point)) continue; - Point point = (Point) geometry; LngLatAlt lngLatAlt = point.getCoordinates(); String type = feature.getProperty("osm_key"); result.add(new SimpleNavigationPosition(lngLatAlt.getLongitude(), lngLatAlt.getLatitude(), null, @@ -112,7 +111,7 @@ public String getAddressFor(NavigationPosition position) throws IOException { if (collection == null) return null; List features = collection.getFeatures(); - if (features.size() == 0) + if (features.isEmpty()) return null; Feature feature = features.get(0); GeoJsonObject geometry = feature.getGeometry(); @@ -129,19 +128,19 @@ private String getProperty(Feature feature, String propertyName) { private String getDisplayName(Feature feature) { String result = getProperty(feature, "name"); - if(result.length() > 0) + if(!result.isEmpty()) result += ", "; String postcode = getProperty(feature, "postcode"); - if(postcode.length() > 0) + if(!postcode.isEmpty()) result += postcode; String city = getProperty(feature, "city"); - if(city.length() > 0) + if(!city.isEmpty()) result += " " + city; String state = getProperty(feature, "state"); - if(state.length() > 0) + if(!state.isEmpty()) result += ", " + state; String country = getProperty(feature, "country"); - if(country.length() > 0) + if(!country.isEmpty()) result += ", " + country; result = result.replaceAll(" {2}", " "); diff --git a/photon/src/test/java/slash/navigation/photon/PhotonServiceIT.java b/photon/src/test/java/slash/navigation/photon/PhotonServiceIT.java index d61328c965..317ef6f778 100644 --- a/photon/src/test/java/slash/navigation/photon/PhotonServiceIT.java +++ b/photon/src/test/java/slash/navigation/photon/PhotonServiceIT.java @@ -30,7 +30,7 @@ import static org.junit.Assert.*; public class PhotonServiceIT { - private PhotonService service = new PhotonService(); + private final PhotonService service = new PhotonService(); @Test public void getPositionsFor() throws IOException { diff --git a/profileview/src/main/java/slash/navigation/converter/gui/models/ProfileModeModel.java b/profileview/src/main/java/slash/navigation/converter/gui/models/ProfileModeModel.java index b1a2a0c8ed..41e7640730 100644 --- a/profileview/src/main/java/slash/navigation/converter/gui/models/ProfileModeModel.java +++ b/profileview/src/main/java/slash/navigation/converter/gui/models/ProfileModeModel.java @@ -40,7 +40,7 @@ public class ProfileModeModel { private static final String X_AXIS_MODE_PREFERENCE = "xAxis"; private static final String Y_AXIS_MODE_PREFERENCE = "yAxis"; - private EventListenerList listenerList = new EventListenerList(); + private final EventListenerList listenerList = new EventListenerList(); public XAxisMode getXAxisMode() { try { diff --git a/profileview/src/main/java/slash/navigation/converter/gui/profileview/XAxisModeMenu.java b/profileview/src/main/java/slash/navigation/converter/gui/profileview/XAxisModeMenu.java index eefeb4b1b3..783eb0b9f6 100644 --- a/profileview/src/main/java/slash/navigation/converter/gui/profileview/XAxisModeMenu.java +++ b/profileview/src/main/java/slash/navigation/converter/gui/profileview/XAxisModeMenu.java @@ -54,8 +54,8 @@ private void initializeMenu() { } private class XAxisModeListener implements ChangeListener { - private JRadioButtonMenuItem menuItem; - private XAxisMode mode; + private final JRadioButtonMenuItem menuItem; + private final XAxisMode mode; private XAxisModeListener(JRadioButtonMenuItem menuItem, XAxisMode mode) { this.menuItem = menuItem; diff --git a/profileview/src/main/java/slash/navigation/converter/gui/profileview/YAxisModeMenu.java b/profileview/src/main/java/slash/navigation/converter/gui/profileview/YAxisModeMenu.java index 64c586619a..c71b2c0b74 100644 --- a/profileview/src/main/java/slash/navigation/converter/gui/profileview/YAxisModeMenu.java +++ b/profileview/src/main/java/slash/navigation/converter/gui/profileview/YAxisModeMenu.java @@ -55,8 +55,8 @@ private void initializeMenu() { } private class YAxisModeListener implements ChangeListener { - private JRadioButtonMenuItem menuItem; - private YAxisMode mode; + private final JRadioButtonMenuItem menuItem; + private final YAxisMode mode; private YAxisModeListener(JRadioButtonMenuItem menuItem, YAxisMode mode) { this.menuItem = menuItem; diff --git a/proxy-tools/src/main/java/slash/navigation/rest/tools/CheckProxy.java b/proxy-tools/src/main/java/slash/navigation/rest/tools/CheckProxy.java index a278320272..a806392b5e 100644 --- a/proxy-tools/src/main/java/slash/navigation/rest/tools/CheckProxy.java +++ b/proxy-tools/src/main/java/slash/navigation/rest/tools/CheckProxy.java @@ -132,8 +132,7 @@ private void apacheCommonsHttpRequest(URI uri, Proxy proxy, String userName, Str SocketAddress address = proxy.address(); log.info("SocketAddress " + address); - if (address instanceof InetSocketAddress) { - InetSocketAddress inetSocketAddress = (InetSocketAddress) address; + if (address instanceof InetSocketAddress inetSocketAddress) { HttpHost host = new HttpHost(inetSocketAddress.getHostName(), inetSocketAddress.getPort()); requestConfigBuilder.setProxy(host); diff --git a/rest/src/main/java/slash/navigation/rest/exception/ServiceUnavailableException.java b/rest/src/main/java/slash/navigation/rest/exception/ServiceUnavailableException.java index 6722fe289c..eaf51d8153 100644 --- a/rest/src/main/java/slash/navigation/rest/exception/ServiceUnavailableException.java +++ b/rest/src/main/java/slash/navigation/rest/exception/ServiceUnavailableException.java @@ -28,7 +28,8 @@ */ public class ServiceUnavailableException extends IOException { - private String serviceName, serviceUrl; + private final String serviceName; + private final String serviceUrl; public ServiceUnavailableException(String serviceName, String serviceUrl, String result) { super("Service " + serviceName + " is unavailable, overloaded or beyond usage quota\n" + diff --git a/route-catalog/src/main/java/slash/navigation/routes/impl/CategoryTreeNodeImpl.java b/route-catalog/src/main/java/slash/navigation/routes/impl/CategoryTreeNodeImpl.java index 2d468eeb17..0f3b3071f2 100644 --- a/route-catalog/src/main/java/slash/navigation/routes/impl/CategoryTreeNodeImpl.java +++ b/route-catalog/src/main/java/slash/navigation/routes/impl/CategoryTreeNodeImpl.java @@ -42,7 +42,8 @@ public class CategoryTreeNodeImpl extends DefaultMutableTreeNode implements Cate private static final Logger log = Logger.getLogger(CategoryTreeNodeImpl.class.getName()); private static final CategoryComparator categoryComparator = new CategoryComparator(); - private boolean localRoot, remoteRoot; + private final boolean localRoot; + private final boolean remoteRoot; public CategoryTreeNodeImpl(Category category) { this(category, false, false); diff --git a/route-converter-cmdline/src/main/java/slash/navigation/converter/cmdline/RouteConverterCmdLine.java b/route-converter-cmdline/src/main/java/slash/navigation/converter/cmdline/RouteConverterCmdLine.java index 95f5e70bbe..ab1570a807 100644 --- a/route-converter-cmdline/src/main/java/slash/navigation/converter/cmdline/RouteConverterCmdLine.java +++ b/route-converter-cmdline/src/main/java/slash/navigation/converter/cmdline/RouteConverterCmdLine.java @@ -44,7 +44,7 @@ public class RouteConverterCmdLine { private static final Logger log = Logger.getLogger(RouteConverterCmdLine.class.getName()); - private NavigationFormatRegistry registry = new CmdLineNavigationFormatRegistry(); + private final NavigationFormatRegistry registry = new CmdLineNavigationFormatRegistry(); private void initializeLogging() { try (InputStream inputStream = RouteConverterCmdLine.class.getResourceAsStream("cmdline.properties")) { diff --git a/route-converter-opensource/src/main/java/slash/navigation/converter/gui/actions/DownloadMapsAction.java b/route-converter-opensource/src/main/java/slash/navigation/converter/gui/actions/DownloadMapsAction.java index 6902806a07..53fcd88676 100644 --- a/route-converter-opensource/src/main/java/slash/navigation/converter/gui/actions/DownloadMapsAction.java +++ b/route-converter-opensource/src/main/java/slash/navigation/converter/gui/actions/DownloadMapsAction.java @@ -51,7 +51,7 @@ public class DownloadMapsAction extends DialogAction { private static final Logger log = Logger.getLogger(DownloadMapsAction.class.getName()); - private static ExecutorService executor = newCachedThreadPool(); + private static final ExecutorService executor = newCachedThreadPool(); private final JTable table; private final MapsforgeMapManager mapManager; diff --git a/route-converter-opensource/src/main/java/slash/navigation/converter/gui/actions/DownloadThemesAction.java b/route-converter-opensource/src/main/java/slash/navigation/converter/gui/actions/DownloadThemesAction.java index e9243340c3..e3aa7944cc 100644 --- a/route-converter-opensource/src/main/java/slash/navigation/converter/gui/actions/DownloadThemesAction.java +++ b/route-converter-opensource/src/main/java/slash/navigation/converter/gui/actions/DownloadThemesAction.java @@ -49,7 +49,7 @@ public class DownloadThemesAction extends DialogAction { private static final Logger log = Logger.getLogger(DownloadThemesAction.class.getName()); - private static ExecutorService executor = newCachedThreadPool(); + private static final ExecutorService executor = newCachedThreadPool(); private final JTable table; private final MapsforgeMapManager mapManager; diff --git a/route-converter-opensource/src/main/java/slash/navigation/converter/gui/helpers/OverlaysMenu.java b/route-converter-opensource/src/main/java/slash/navigation/converter/gui/helpers/OverlaysMenu.java index 3741779a84..daa4d5cc01 100644 --- a/route-converter-opensource/src/main/java/slash/navigation/converter/gui/helpers/OverlaysMenu.java +++ b/route-converter-opensource/src/main/java/slash/navigation/converter/gui/helpers/OverlaysMenu.java @@ -62,7 +62,7 @@ private void addMenuEntry(int row) { item.setToolTipText(tileServer.getDescription()); menu.add(item); - menu.setEnabled(tileServers.size() > 0); + menu.setEnabled(!tileServers.isEmpty()); } private void enableMenuEntries() { diff --git a/route-converter-tools/src/main/java/slash/navigation/converter/tools/OrderedProperties.java b/route-converter-tools/src/main/java/slash/navigation/converter/tools/OrderedProperties.java index 7ccfb53ef2..9fc29c4806 100644 --- a/route-converter-tools/src/main/java/slash/navigation/converter/tools/OrderedProperties.java +++ b/route-converter-tools/src/main/java/slash/navigation/converter/tools/OrderedProperties.java @@ -28,7 +28,7 @@ */ public class OrderedProperties extends Properties { - private Map properties = new LinkedHashMap<>(); + private final Map properties = new LinkedHashMap<>(); public synchronized Object put(Object key, Object value) { return properties.put(key.toString(), value); diff --git a/route-converter-tools/src/main/java/slash/navigation/converter/tools/OrderedResourceBundle.java b/route-converter-tools/src/main/java/slash/navigation/converter/tools/OrderedResourceBundle.java index fe6d63f285..c45f222af8 100644 --- a/route-converter-tools/src/main/java/slash/navigation/converter/tools/OrderedResourceBundle.java +++ b/route-converter-tools/src/main/java/slash/navigation/converter/tools/OrderedResourceBundle.java @@ -20,6 +20,7 @@ package slash.navigation.converter.tools; import java.io.*; +import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.ResourceBundle; import java.util.Set; @@ -31,7 +32,7 @@ */ public class OrderedResourceBundle extends ResourceBundle { - private OrderedProperties properties; + private final OrderedProperties properties; public OrderedResourceBundle(InputStream stream) throws IOException { properties = new OrderedProperties(); @@ -55,7 +56,7 @@ public Object handleRemoteObject(String key) { } public void store(OutputStream stream) throws IOException { - PrintWriter writer = new PrintWriter(new OutputStreamWriter(stream, "8859_1")); + PrintWriter writer = new PrintWriter(new OutputStreamWriter(stream, StandardCharsets.ISO_8859_1)); for (String key : getOrderedKeys()) { String value = saveConvert(handleGetObject(key).toString()); writer.println(key + "=" + value); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/RouteConverter.java b/route-converter/src/main/java/slash/navigation/converter/gui/RouteConverter.java index ccec392a80..34ad7a7872 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/RouteConverter.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/RouteConverter.java @@ -172,25 +172,25 @@ protected String getProduct() { private static final String SHOWED_MISSING_TRANSLATOR_PREFERENCE = "showedMissingTranslator-2.33"; // versioned preference public static final String AUTOMATIC_UPDATE_CHECK_PREFERENCE = "automaticUpdateCheck-2.33"; - private NavigationFormatRegistry navigationFormatRegistry = new NavigationFormatRegistry(); + private final NavigationFormatRegistry navigationFormatRegistry = new NavigationFormatRegistry(); private RouteServiceOperator routeServiceOperator; private UpdateChecker updateChecker; private DataSourceManager dataSourceManager; - private ElevationServiceFacade elevationServiceFacade = new ElevationServiceFacade(); - private GeocodingServiceFacade geocodingServiceFacade = new GeocodingServiceFacade(); - private InsertPositionFacade insertPositionFacade = new InsertPositionFacade(); - private BooleanModel showAllPositionsAfterLoading = new BooleanModel(SHOW_ALL_POSITIONS_AFTER_LOADING_PREFERENCE, true); - private BooleanModel recenterAfterZooming = new BooleanModel(RECENTER_AFTER_ZOOMING_PREFERENCE, true); - private TimeZoneModel timeZoneModel = new TimeZoneModel(TIME_ZONE_PREFERENCE, TimeZone.getDefault()); - private TimeZoneModel photoTimeZoneModel = new TimeZoneModel(PHOTO_TIMEZONE_PREFERENCE, timeZoneModel.getTimeZone()); + private final ElevationServiceFacade elevationServiceFacade = new ElevationServiceFacade(); + private final GeocodingServiceFacade geocodingServiceFacade = new GeocodingServiceFacade(); + private final InsertPositionFacade insertPositionFacade = new InsertPositionFacade(); + private final BooleanModel showAllPositionsAfterLoading = new BooleanModel(SHOW_ALL_POSITIONS_AFTER_LOADING_PREFERENCE, true); + private final BooleanModel recenterAfterZooming = new BooleanModel(RECENTER_AFTER_ZOOMING_PREFERENCE, true); + private final TimeZoneModel timeZoneModel = new TimeZoneModel(TIME_ZONE_PREFERENCE, TimeZone.getDefault()); + private final TimeZoneModel photoTimeZoneModel = new TimeZoneModel(PHOTO_TIMEZONE_PREFERENCE, timeZoneModel.getTimeZone()); private final UnitSystemModel unitSystemModel = new UnitSystemModel(); private final CharacteristicsModel characteristicsModel = new CharacteristicsModel(); private final RoutingServiceFacade routingServiceFacade = new RoutingServiceFacade(); private final MapPreferencesModel mapPreferencesModel = new MapPreferencesModel(getRoutingServiceFacade().getRoutingPreferencesModel(), getCharacteristicsModel(), getUnitSystemModel()); - private GoogleMapsServerModel googleMapsServerModel = new GoogleMapsServerModel(); - private ProfileModeModel profileModeModel = new ProfileModeModel(); + private final GoogleMapsServerModel googleMapsServerModel = new GoogleMapsServerModel(); + private final ProfileModeModel profileModeModel = new ProfileModeModel(); private TileServerMapManager tileServerMapManager; - private DistanceAndTimeAggregator distanceAndTimeAggregator = new DistanceAndTimeAggregator(); + private final DistanceAndTimeAggregator distanceAndTimeAggregator = new DistanceAndTimeAggregator(); protected JPanel contentPane; private JSplitPane mapSplitPane, profileSplitPane; @@ -996,8 +996,8 @@ public BrowsePanel getBrowsePanel() { } private class LazyTabInitializer implements ChangeListener { - private Map lazyInitializers = new HashMap<>(); - private Map initialized = new HashMap<>(); + private final Map lazyInitializers = new HashMap<>(); + private final Map initialized = new HashMap<>(); LazyTabInitializer() { lazyInitializers.put(convertPanel, () -> { @@ -1150,7 +1150,7 @@ private void dividerChanged(int oldValue, int newValue) { getMapView().resize(); } preferences.putInt(PROFILE_DIVIDER_LOCATION_PREFERENCE, newValue); - double newRatio = new Integer(newValue).doubleValue() / contentPane.getHeight(); + double newRatio = Integer.valueOf(newValue).doubleValue() / contentPane.getHeight(); preferences.putDouble(PROFILE_DIVIDER_RATIO_PREFERENCE, newRatio); log.fine("Changed profile divider to " + newValue + " and ratio " + newRatio); enableActions(); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/AddAudioAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/AddAudioAction.java index 37142287c4..966d046069 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/AddAudioAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/AddAudioAction.java @@ -68,9 +68,8 @@ public void run() { int[] selectedRows = table.getSelectedRows(); for (final int selectedRow : selectedRows) { NavigationPosition position = positionsModel.getPosition(selectedRow); - if (!(position instanceof Wgs84Position)) + if (!(position instanceof Wgs84Position wgs84Position)) continue; - Wgs84Position wgs84Position = (Wgs84Position) position; if (!(wgs84Position.getWaypointType().equals(Voice))) continue; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/AddPositionAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/AddPositionAction.java index 0252d43495..fc82f69453 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/AddPositionAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/AddPositionAction.java @@ -108,7 +108,7 @@ public void run() { insertedPositions.add(insertRow(insertRow, center)); } - if (insertedPositions.size() > 0) { + if (!insertedPositions.isEmpty()) { List insertedRows = new ArrayList<>(); for (NavigationPosition position : insertedPositions) { int index = positionsModel.getIndex(position); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeleteCategoriesAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeleteCategoriesAction.java index 0cd5b94360..9922d105be 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeleteCategoriesAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeleteCategoriesAction.java @@ -49,7 +49,7 @@ public DeleteCategoriesAction(JTree tree, CatalogModel catalogModel) { public void run() { List categories = getSelectedCategoryTreeNodes(tree); - if (categories.size() == 0) + if (categories.isEmpty()) return; StringBuilder categoryNames = new StringBuilder(); @@ -84,4 +84,4 @@ public void run() { } }); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeletePositionListAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeletePositionListAction.java index b045a5afaa..7db9352bdd 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeletePositionListAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeletePositionListAction.java @@ -33,7 +33,7 @@ */ public class DeletePositionListAction extends FrameAction { - private FormatAndRoutesModel formatAndRoutesModel; + private final FormatAndRoutesModel formatAndRoutesModel; public DeletePositionListAction(FormatAndRoutesModel formatAndRoutesModel) { this.formatAndRoutesModel = formatAndRoutesModel; @@ -44,4 +44,4 @@ public void run() { if (selectedRoute != null) formatAndRoutesModel.removePositionList(selectedRoute); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeleteRoutesAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeleteRoutesAction.java index af293c2786..c54054591a 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeleteRoutesAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/DeleteRoutesAction.java @@ -48,7 +48,7 @@ public DeleteRoutesAction(JTable table, CatalogModel catalogModel) { public void run() { List routes = getSelectedRouteModels(table); - if(routes.size() == 0) + if(routes.isEmpty()) return; int[] selectedRows = table.getSelectedRows(); @@ -65,4 +65,4 @@ public void run() { }); } } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/ImportPositionListAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/ImportPositionListAction.java index fd082c23c0..9eae1b0882 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/ImportPositionListAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/ImportPositionListAction.java @@ -32,7 +32,7 @@ */ public class ImportPositionListAction extends FrameAction { - private ConvertPanel convertPanel; + private final ConvertPanel convertPanel; public ImportPositionListAction(ConvertPanel convertPanel) { this.convertPanel = convertPanel; @@ -41,4 +41,4 @@ public ImportPositionListAction(ConvertPanel convertPanel) { public void run() { convertPanel.importPositionList(); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/MoveSplitPaneDividerAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/MoveSplitPaneDividerAction.java index 974368abac..b408ebc627 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/MoveSplitPaneDividerAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/MoveSplitPaneDividerAction.java @@ -31,8 +31,8 @@ */ public class MoveSplitPaneDividerAction extends FrameAction { - private JSplitPane splitPane; - private int dividerLocation; + private final JSplitPane splitPane; + private final int dividerLocation; public MoveSplitPaneDividerAction(JSplitPane splitPane, int dividerLocation) { this.splitPane = splitPane; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/MoveSplitPaneDividersAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/MoveSplitPaneDividersAction.java index b5c2a9729a..611963cca1 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/MoveSplitPaneDividersAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/MoveSplitPaneDividersAction.java @@ -29,8 +29,8 @@ */ public class MoveSplitPaneDividersAction extends MoveSplitPaneDividerAction { - private JSplitPane secondPane; - private int secondDividerLocation; + private final JSplitPane secondPane; + private final int secondDividerLocation; public MoveSplitPaneDividersAction(JSplitPane firstPane, int firstDividerLocation, JSplitPane secondPane, int secondDividerLocation) { @@ -43,4 +43,4 @@ public void run() { super.run(); secondPane.setDividerLocation(secondDividerLocation); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/NewFileAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/NewFileAction.java index d2d03726e7..65bb36c4ce 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/NewFileAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/NewFileAction.java @@ -32,7 +32,7 @@ */ public class NewFileAction extends FrameAction { - private ConvertPanel convertPanel; + private final ConvertPanel convertPanel; public NewFileAction(ConvertPanel convertPanel) { this.convertPanel = convertPanel; @@ -41,4 +41,4 @@ public NewFileAction(ConvertPanel convertPanel) { public void run() { convertPanel.newFile(); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/OpenAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/OpenAction.java index 5f16441546..85370e67b5 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/OpenAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/OpenAction.java @@ -32,7 +32,7 @@ */ public class OpenAction extends FrameAction { - private ConvertPanel convertPanel; + private final ConvertPanel convertPanel; public OpenAction(ConvertPanel convertPanel) { this.convertPanel = convertPanel; @@ -41,4 +41,4 @@ public OpenAction(ConvertPanel convertPanel) { public void run() { convertPanel.openFile(); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/RemoveDownloadsAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/RemoveDownloadsAction.java index b1064b1733..6f20fdefcd 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/RemoveDownloadsAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/RemoveDownloadsAction.java @@ -50,7 +50,7 @@ public RemoveDownloadsAction(JDialog dialog, JTable table, DownloadManager downl public void run() { List downloads = getSelectedDownloads(table); - if(downloads.size() == 0) + if(downloads.isEmpty()) return; downloadManager.removeDownloads(downloads); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/RenamePositionListAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/RenamePositionListAction.java index a878414afb..1ba5d343b1 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/RenamePositionListAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/RenamePositionListAction.java @@ -33,7 +33,7 @@ */ public class RenamePositionListAction extends FrameAction { - private FormatAndRoutesModel formatAndRoutesModel; + private final FormatAndRoutesModel formatAndRoutesModel; public RenamePositionListAction(FormatAndRoutesModel formatAndRoutesModel) { this.formatAndRoutesModel = formatAndRoutesModel; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/RenameRoutesAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/RenameRoutesAction.java index 83fb9b8e43..de131a0e7b 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/RenameRoutesAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/RenameRoutesAction.java @@ -55,7 +55,7 @@ public RenameRoutesAction(JTable table, CatalogModel catalogModel) { public void run() { List routes = getSelectedRouteModels(table); - if (routes.size() == 0) + if (routes.isEmpty()) return; for (final RouteModel route : routes) { @@ -74,4 +74,4 @@ public void run() { }); } } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/ReopenAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/ReopenAction.java index ea076442e5..8153db7585 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/ReopenAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/ReopenAction.java @@ -35,7 +35,7 @@ */ public class ReopenAction extends FrameAction { - private URL url; + private final URL url; public ReopenAction(URL url) { this.url = url; @@ -44,4 +44,4 @@ public ReopenAction(URL url) { public void run() { RouteConverter.getInstance().openPositionList(singletonList(url), true); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/RestartDownloadsAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/RestartDownloadsAction.java index ad18cd23f3..bbbd76ab88 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/RestartDownloadsAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/RestartDownloadsAction.java @@ -50,7 +50,7 @@ public RestartDownloadsAction(JDialog dialog, JTable table, DownloadManager down public void run() { List downloads = getSelectedDownloads(table); - if(downloads.size() == 0) + if(downloads.isEmpty()) return; int[] selectedRows = table.getSelectedRows(); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/SaveAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/SaveAction.java index c9ed9b5200..7c80c9cf52 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/SaveAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/SaveAction.java @@ -32,7 +32,7 @@ */ public class SaveAction extends FrameAction { - private ConvertPanel convertPanel; + private final ConvertPanel convertPanel; public SaveAction(ConvertPanel convertPanel) { this.convertPanel = convertPanel; @@ -41,4 +41,4 @@ public SaveAction(ConvertPanel convertPanel) { public void run() { convertPanel.saveFile(); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/SaveAsAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/SaveAsAction.java index fa6f73508f..62d633bea0 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/SaveAsAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/SaveAsAction.java @@ -32,7 +32,7 @@ */ public class SaveAsAction extends FrameAction { - private ConvertPanel convertPanel; + private final ConvertPanel convertPanel; public SaveAsAction(ConvertPanel convertPanel) { this.convertPanel = convertPanel; @@ -41,4 +41,4 @@ public SaveAsAction(ConvertPanel convertPanel) { public void run() { convertPanel.saveAsFile(); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/actions/StopDownloadsAction.java b/route-converter/src/main/java/slash/navigation/converter/gui/actions/StopDownloadsAction.java index 0ee695df2e..0292304216 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/actions/StopDownloadsAction.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/actions/StopDownloadsAction.java @@ -50,7 +50,7 @@ public StopDownloadsAction(JDialog dialog, JTable table, DownloadManager downloa public void run() { List downloads = getSelectedDownloads(table); - if(downloads.size() == 0) + if(downloads.isEmpty()) return; int[] selectedRows = table.getSelectedRows(); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/CompleteFlightPlanDialog.java b/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/CompleteFlightPlanDialog.java index 192a0b7de6..a06e5045e9 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/CompleteFlightPlanDialog.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/CompleteFlightPlanDialog.java @@ -71,7 +71,7 @@ public class CompleteFlightPlanDialog extends SimpleDialog { private JButton buttonPrevious; private JButton buttonNextOrFinish; - private GarminFlightPlanRoute route; + private final GarminFlightPlanRoute route; private int index; public CompleteFlightPlanDialog(GarminFlightPlanRoute routeToComplete) { @@ -188,9 +188,7 @@ private void validateModel() { comboBoxWaypointType.setBorder(validWaypointType ? VALID_BORDER : INVALID_BORDER); boolean validCountryCode = Airport.equals(comboBoxWaypointType.getSelectedItem()) ? !CountryCode.None.equals(comboBoxCountryCode.getSelectedItem()) : - UserWaypoint.equals(comboBoxWaypointType.getSelectedItem()) ? - CountryCode.None.equals(comboBoxCountryCode.getSelectedItem()) : - !CountryCode.None.equals(comboBoxCountryCode.getSelectedItem()); + UserWaypoint.equals(comboBoxWaypointType.getSelectedItem()) == CountryCode.None.equals(comboBoxCountryCode.getSelectedItem()); comboBoxCountryCode.setBorder(validCountryCode ? VALID_BORDER : INVALID_BORDER); buttonPrevious.setEnabled(index > 0); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/DeletePositionsDialog.java b/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/DeletePositionsDialog.java index e4671d75b7..c29c4d622c 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/DeletePositionsDialog.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/DeletePositionsDialog.java @@ -72,9 +72,9 @@ public class DeletePositionsDialog extends SimpleDialog { private JButton buttonDeletePositions; private JButton buttonClearSelection; private JLabel labelDouglasPeucker; - private DoubleDocument distance; - private IntegerDocument order; - private DoubleDocument threshold; + private final DoubleDocument distance; + private final IntegerDocument order; + private final DoubleDocument threshold; public DeletePositionsDialog() { super(RouteConverter.getInstance().getFrame(), "delete-positions"); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/OptionsDialog.java b/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/OptionsDialog.java index 01a5496be2..00aad014d7 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/OptionsDialog.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/OptionsDialog.java @@ -717,7 +717,7 @@ private void chooseMapPath() { } File selected = chooser.getSelectedFile(); - if (selected == null || selected.getName().length() == 0) { + if (selected == null || selected.getName().isEmpty()) { return; } @@ -737,7 +737,7 @@ private void chooseThemePath() { } File selected = chooser.getSelectedFile(); - if (selected == null || selected.getName().length() == 0) { + if (selected == null || selected.getName().isEmpty()) { return; } @@ -756,7 +756,7 @@ private void chooseBabelPath() { } File selected = chooser.getSelectedFile(); - if (selected == null || selected.getName().length() == 0) { + if (selected == null || selected.getName().isEmpty()) { return; } @@ -776,7 +776,7 @@ private void chooseRoutingServicePath() { } File selected = chooser.getSelectedFile(); - if (selected == null || selected.getName().length() == 0) { + if (selected == null || selected.getName().isEmpty()) { return; } @@ -796,7 +796,7 @@ private void chooseElevationServicePath() { } File selected = chooser.getSelectedFile(); - if (selected == null || selected.getName().length() == 0) { + if (selected == null || selected.getName().isEmpty()) { return; } diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/SendErrorReportDialog.java b/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/SendErrorReportDialog.java index 3a7f0e7fcc..06905c1b9e 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/SendErrorReportDialog.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/dialogs/SendErrorReportDialog.java @@ -121,7 +121,7 @@ private void chooseFilePath() { return; File selected = chooser.getSelectedFile(); - if (selected == null || selected.getName().length() == 0) + if (selected == null || selected.getName().isEmpty()) return; textFieldFilePath.setText(selected.getAbsolutePath()); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/BrowserDisplayer.java b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/BrowserDisplayer.java index 6ae05e5e0a..2525adb96e 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/BrowserDisplayer.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/BrowserDisplayer.java @@ -106,7 +106,7 @@ public class BrowserDisplayer extends JButton implements ActionListener, ViewAwa private SimpleAttributeSet textAttribs; private HTMLDocument doc; - private Cursor origCursor; + private final Cursor origCursor; private String content = ""; @@ -324,4 +324,4 @@ private Font getAttributeSetFont(AttributeSet attr) { public void actionPerformed(ActionEvent e) { ExternalPrograms.startBrowser(null, content); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/GeoTagger.java b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/GeoTagger.java index 373a4b9e64..b0612ed3c3 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/GeoTagger.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/GeoTagger.java @@ -345,8 +345,7 @@ private void updateMetaData(PhotoPosition position, NavigationPosition closestPo position.setTagState(Tagged); - if (closestPositionForTagging instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) closestPositionForTagging; + if (closestPositionForTagging instanceof Wgs84Position wgs84Position) { wgs84Position.setDescription(source.getAbsolutePath()); wgs84Position.setWaypointType(Photo); wgs84Position.setOrigin(source); @@ -375,10 +374,9 @@ public String getName() { } public boolean run(int index, NavigationPosition navigationPosition) { - if (!(navigationPosition instanceof PhotoPosition)) + if (!(navigationPosition instanceof PhotoPosition position)) return false; - PhotoPosition position = (PhotoPosition) navigationPosition; if (position.getTagState().equals(Tagged)) return false; @@ -403,10 +401,9 @@ public String getName() { } public boolean run(int index, NavigationPosition navigationPosition) throws Exception { - if (!(navigationPosition instanceof PhotoPosition)) + if (!(navigationPosition instanceof PhotoPosition position)) return false; - PhotoPosition position = (PhotoPosition) navigationPosition; if (!position.getTagState().equals(Taggable)) return false; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/GeocodingServiceFacade.java b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/GeocodingServiceFacade.java index 41aa9907dd..f7c2f72d9e 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/GeocodingServiceFacade.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/GeocodingServiceFacade.java @@ -101,6 +101,6 @@ public String getAddressFor(NavigationPosition position) throws IOException, Ser public NavigationPosition getPositionFor(String address) throws IOException, ServiceUnavailableException { List positions = getPositionsFor(address); - return positions != null && positions.size() > 0 ? positions.get(0) : null; + return positions != null && !positions.isEmpty() ? positions.get(0) : null; } } diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/InsertPositionFacade.java b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/InsertPositionFacade.java index e1cfa8ae9c..80aeb937b4 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/InsertPositionFacade.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/InsertPositionFacade.java @@ -114,7 +114,7 @@ private void doInsertWithRoutingService(RoutingService routingService, int[] sel TravelMode travelMode = r.getRoutingServiceFacade().getRoutingPreferencesModel().getTravelMode(); List positions = insertPositions(routingService, future, travelMode, selectedPositions); - if (positions.size() > 0) + if (!positions.isEmpty()) invokeLater(() -> r.getPositionAugmenter().addData(toArray(positions), false, true, true, false, false)); } diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/PositionHelper.java b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/PositionHelper.java index 57c5069290..f846881712 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/PositionHelper.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/PositionHelper.java @@ -251,14 +251,11 @@ public static String formatSize(Long size) { } public static File extractFile(NavigationPosition position) { - if (position instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) position; + if (position instanceof Wgs84Position wgs84Position) { WaypointType waypointType = wgs84Position.getWaypointType(); if (waypointType != null && (waypointType.equals(Photo) || waypointType.equals(Voice))) { File file = wgs84Position.getOrigin(File.class); - if (file != null) { - return file; - } + return file; } } return null; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/ReopenMenu.java b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/ReopenMenu.java index 399ad2bb00..1f69d48378 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/helpers/ReopenMenu.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/helpers/ReopenMenu.java @@ -75,6 +75,6 @@ private void populateMenu() { menuItem.setToolTipText(text); menu.add(menuItem); } - menu.setEnabled(urls.size() > 0); + menu.setEnabled(!urls.isEmpty()); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/models/DoubleDocument.java b/route-converter/src/main/java/slash/navigation/converter/gui/models/DoubleDocument.java index 80189eecf6..12473696f0 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/models/DoubleDocument.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/models/DoubleDocument.java @@ -53,7 +53,7 @@ public double getDouble() { } private boolean isValidNumberString(String str) { - if (str.length() == 0) + if (str.isEmpty()) return true; try { diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/models/IntegerDocument.java b/route-converter/src/main/java/slash/navigation/converter/gui/models/IntegerDocument.java index 90b1f03068..55f4936206 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/models/IntegerDocument.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/models/IntegerDocument.java @@ -51,7 +51,7 @@ public int getInt() { } private boolean isValidNumberString(String str) { - if (str.length() == 0) + if (str.isEmpty()) return true; try { diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/models/OverlayPositionsModel.java b/route-converter/src/main/java/slash/navigation/converter/gui/models/OverlayPositionsModel.java index 78d213c7a4..fbde0615f5 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/models/OverlayPositionsModel.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/models/OverlayPositionsModel.java @@ -337,8 +337,7 @@ private ImageAndFile getImageAndFile(int rowIndex) { ImageAndFile imageAndFile = indexToImageAndFile.get(rowIndex); if (imageAndFile == null) { NavigationPosition position = getPosition(rowIndex); - if (position instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) position; + if (position instanceof Wgs84Position wgs84Position) { File file = wgs84Position.getOrigin(File.class); if (file != null && file.exists()) { BufferedImage resize = resize(file, IMAGE_HEIGHT_FOR_IMAGE_COLUMN); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/models/PhotoTagStateToJLabelAdapter.java b/route-converter/src/main/java/slash/navigation/converter/gui/models/PhotoTagStateToJLabelAdapter.java index 1257e30f7b..77ba63b13d 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/models/PhotoTagStateToJLabelAdapter.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/models/PhotoTagStateToJLabelAdapter.java @@ -66,8 +66,8 @@ protected void updateAdapterFromDelegate(TableModelEvent event) { count(Taggable), count(NotTaggable) ); - if(text.length() == 0) + if(text.isEmpty()) text = "-"; label.setText(text); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/models/RecentFormatsModel.java b/route-converter/src/main/java/slash/navigation/converter/gui/models/RecentFormatsModel.java index da4536a8e3..a3a8203040 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/models/RecentFormatsModel.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/models/RecentFormatsModel.java @@ -42,7 +42,7 @@ public class RecentFormatsModel { private static final String MAXIMUM_RECENT_FORMAT_COUNT_PREFERENCE = "maximumRecentFormatCount"; private static final char FIRST_CHAR = 'a'; - private NavigationFormatRegistry navigationFormatRegistry; + private final NavigationFormatRegistry navigationFormatRegistry; public RecentFormatsModel(NavigationFormatRegistry navigationFormatRegistry) { this.navigationFormatRegistry = navigationFormatRegistry; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/models/TimeZoneModel.java b/route-converter/src/main/java/slash/navigation/converter/gui/models/TimeZoneModel.java index 784e0bda4e..b2672dff74 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/models/TimeZoneModel.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/models/TimeZoneModel.java @@ -39,7 +39,7 @@ public class TimeZoneModel { private final String preferencesName; private final TimeZone defaultValue; - private EventListenerList listenerList = new EventListenerList(); + private final EventListenerList listenerList = new EventListenerList(); public TimeZoneModel(String preferencesName, TimeZone defaultValue) { this.preferencesName = preferencesName; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/panels/BrowsePanel.java b/route-converter/src/main/java/slash/navigation/converter/gui/panels/BrowsePanel.java index 17ee830c84..c331b9fafc 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/panels/BrowsePanel.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/panels/BrowsePanel.java @@ -299,11 +299,10 @@ private void selectTreePath(TreePath treePath, boolean selectCategoryTreePath) { startWaitCursor(r.getFrame().getRootPane()); try { Object selectedObject = treePath.getLastPathComponent(); - if (!(selectedObject instanceof CategoryTreeNode)) + if (!(selectedObject instanceof CategoryTreeNode selectedCategoryTreeNode)) return; if (selectCategoryTreePath) selectCategoryTreePath(treeCategories, treePath); - CategoryTreeNode selectedCategoryTreeNode = (CategoryTreeNode) selectedObject; catalogModel.setCurrentCategory(selectedCategoryTreeNode); RouteConverter.getInstance().setCategoryPreference(TreePathStringConversion.toString(treePath)); } finally { diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/panels/ConvertPanel.java b/route-converter/src/main/java/slash/navigation/converter/gui/panels/ConvertPanel.java index c522b501c8..1c8fc34be1 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/panels/ConvertPanel.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/panels/ConvertPanel.java @@ -448,7 +448,7 @@ public void openUrls(List urls) { } // start with a non-existent file - if (copy.size() == 0) { + if (copy.isEmpty()) { newFile(); } else { openPositionList(copy); @@ -672,7 +672,7 @@ public void exportPositionList() { return; File selected = chooser.getSelectedFile(); - if (selected == null || selected.getName().length() == 0) + if (selected == null || selected.getName().isEmpty()) return; NavigationFormat selectedFormat = getSelectedFormat(chooser.getFileFilter()); @@ -828,7 +828,7 @@ public void saveAsFile() { return; File selected = chooser.getSelectedFile(); - if (selected == null || selected.getName().length() == 0) + if (selected == null || selected.getName().isEmpty()) return; NavigationFormat selectedFormat = getSelectedFormat(chooser.getFileFilter()); @@ -1046,7 +1046,7 @@ private void logFormatUsage() { if (reads > 0 || writes > 0) builder.append(format("%n%s, reads: %d, writes: %d", format.getName(), reads, writes)); } - log.info("Format usage:" + builder.toString()); + log.info("Format usage:" + builder); } private void countRead(NavigationFormat format) { @@ -1358,7 +1358,7 @@ public Dimension getPreferredSize() { } private class TableDragAndDropHandler extends TransferHandler { - private TransferHandler delegate; + private final TransferHandler delegate; TableDragAndDropHandler(TransferHandler delegate) { this.delegate = delegate; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/panels/PhotoPanel.java b/route-converter/src/main/java/slash/navigation/converter/gui/panels/PhotoPanel.java index ee45320d48..688803b300 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/panels/PhotoPanel.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/panels/PhotoPanel.java @@ -110,7 +110,7 @@ public class PhotoPanel implements PanelInTab { new TagStatePhotoPredicate(NotTaggable), }); - private PositionsModel photosModel = new OverlayPositionsModel(new PositionsModelImpl()); + private final PositionsModel photosModel = new OverlayPositionsModel(new PositionsModelImpl()); private FilteringPositionsModel filteredPhotosModel; public PhotoPanel() { diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/predicates/PointOfInterestPositionPredicate.java b/route-converter/src/main/java/slash/navigation/converter/gui/predicates/PointOfInterestPositionPredicate.java index 9d083571f8..68b1d94993 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/predicates/PointOfInterestPositionPredicate.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/predicates/PointOfInterestPositionPredicate.java @@ -42,9 +42,8 @@ public String getName() { } public boolean shouldInclude(NavigationPosition position) { - if (!(position instanceof Wgs84Position)) + if (!(position instanceof Wgs84Position poiPosition)) return false; - Wgs84Position poiPosition = (Wgs84Position) position; return POINTS_OF_INTEREST_WAYPOINT_TYPES.contains(poiPosition.getWaypointType()); } } diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/predicates/TagStatePhotoPredicate.java b/route-converter/src/main/java/slash/navigation/converter/gui/predicates/TagStatePhotoPredicate.java index 7d6fb2c29f..f58879bc94 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/predicates/TagStatePhotoPredicate.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/predicates/TagStatePhotoPredicate.java @@ -30,7 +30,7 @@ * @author Christian Pesch */ public class TagStatePhotoPredicate implements FilterPredicate { - private TagState tagState; + private final TagState tagState; public TagStatePhotoPredicate(TagState tagState) { this.tagState = tagState; @@ -41,9 +41,8 @@ public String getName() { } public boolean shouldInclude(NavigationPosition position) { - if (!(position instanceof PhotoPosition)) + if (!(position instanceof PhotoPosition photoPosition)) return false; - PhotoPosition photoPosition = (PhotoPosition) position; return photoPosition.getTagState().equals(tagState); } } diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/predicates/TautologyPredicate.java b/route-converter/src/main/java/slash/navigation/converter/gui/predicates/TautologyPredicate.java index 858e8e56f4..96a6e1cb46 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/predicates/TautologyPredicate.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/predicates/TautologyPredicate.java @@ -28,7 +28,7 @@ * @author Christian Pesch */ public class TautologyPredicate implements FilterPredicate { - private String name; + private final String name; public TautologyPredicate(String name) { this.name = name; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/CategoryTreeCellRenderer.java b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/CategoryTreeCellRenderer.java index 813f9b9bf7..85ec9d781a 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/CategoryTreeCellRenderer.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/CategoryTreeCellRenderer.java @@ -47,8 +47,7 @@ public CategoryTreeCellRenderer() { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); - if (value instanceof CategoryTreeNode) { - CategoryTreeNode categoryTreeNode = (CategoryTreeNode) value; + if (value instanceof CategoryTreeNode categoryTreeNode) { String name = categoryTreeNode.getName(); if (name == null) name = RouteConverter.getBundle().getString("no-name"); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/ExifColumnTableCellRenderer.java b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/ExifColumnTableCellRenderer.java index 66a1395514..b91fb9ace9 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/ExifColumnTableCellRenderer.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/ExifColumnTableCellRenderer.java @@ -45,7 +45,7 @@ public class ExifColumnTableCellRenderer extends AlternatingColorTableCellRenderer { private static final String COMMA = ", "; public static final String UTC_TIMEZONE_ID = UTC.getID(); - private static Map EXIF_FLASH_CONSTANTS = new HashMap<>(); + private static final Map EXIF_FLASH_CONSTANTS = new HashMap<>(); static { for(Field field : ExifTagConstants.class.getFields()) { diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/PositionsTableCellEditor.java b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/PositionsTableCellEditor.java index e3510d0a13..8e770bdcf6 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/PositionsTableCellEditor.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/PositionsTableCellEditor.java @@ -49,8 +49,7 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole } protected void formatLabel(JLabel label, Object value, boolean firstRow, boolean lastRow) { - if(value instanceof NavigationPosition) { - NavigationPosition position = (NavigationPosition) value; + if(value instanceof NavigationPosition position) { formatCell(label, position); } else label.setText(""); @@ -92,8 +91,7 @@ public void removeCellEditorListener(CellEditorListener l) { } public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof NavigationPosition) { - NavigationPosition position = (NavigationPosition) value; + if (value instanceof NavigationPosition position) { Object editedValue = extractValue(position); return editor.getTableCellEditorComponent(table, editedValue, isSelected, row, column); } else diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/TimeColumnTableCellEditor.java b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/TimeColumnTableCellEditor.java index fa2ee59ef1..3880529eaa 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/TimeColumnTableCellEditor.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/TimeColumnTableCellEditor.java @@ -48,11 +48,9 @@ protected String extractValue(NavigationPosition position) { } protected void formatLabel(JLabel label, Object value, boolean firstRow, boolean lastRow) { - if(value instanceof CompactCalendar) { - CompactCalendar time = (CompactCalendar) value; + if(value instanceof CompactCalendar time) { label.setText(formatTime(time, "UTC")); - } else if(value instanceof NavigationPosition) { - NavigationPosition position = (NavigationPosition) value; + } else if(value instanceof NavigationPosition position) { formatCell(label, position); } else label.setText(""); diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/WaypointTypeColumnTableCellEditor.java b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/WaypointTypeColumnTableCellEditor.java index d80e9d8f7e..4ae0306cd8 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/renderer/WaypointTypeColumnTableCellEditor.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/renderer/WaypointTypeColumnTableCellEditor.java @@ -44,8 +44,7 @@ public WaypointTypeColumnTableCellEditor() { } protected void formatLabel(JLabel label, Object value, boolean firstRow, boolean lastRow) { - if(value instanceof NavigationPosition) { - NavigationPosition position = (NavigationPosition) value; + if(value instanceof NavigationPosition position) { String key = null; if (lastRow) key = "end"; @@ -84,8 +83,7 @@ protected String extractValue(NavigationPosition position) { } private WaypointType getWaypointType(NavigationPosition position) { - if (position instanceof Wgs84Position) { - Wgs84Position wgs84Position = (Wgs84Position) position; + if (position instanceof Wgs84Position wgs84Position) { return wgs84Position.getWaypointType(); } return null; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/AddPositionList.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/AddPositionList.java index 464968dbb9..a0be97f8f1 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/AddPositionList.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/AddPositionList.java @@ -34,9 +34,9 @@ */ class AddPositionList extends AbstractUndoableEdit { - private UndoFormatAndRoutesModel formatAndRoutesModel; - private int index; - private BaseRoute route; + private final UndoFormatAndRoutesModel formatAndRoutesModel; + private final int index; + private final BaseRoute route; public AddPositionList(UndoFormatAndRoutesModel formatAndRoutesModel, int index, BaseRoute route) { this.formatAndRoutesModel = formatAndRoutesModel; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/AddPositions.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/AddPositions.java index 046043725d..20f121cf1f 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/AddPositions.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/AddPositions.java @@ -36,9 +36,9 @@ */ class AddPositions extends AbstractUndoableEdit { - private UndoPositionsModel positionsModel; - private int row; - private List positions; + private final UndoPositionsModel positionsModel; + private final int row; + private final List positions; public AddPositions(UndoPositionsModel positionsModel, int row, List positions) { this.positionsModel = positionsModel; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/BottomPositions.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/BottomPositions.java index 206bc35168..0eddac37f8 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/BottomPositions.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/BottomPositions.java @@ -35,8 +35,8 @@ */ class BottomPositions extends AbstractUndoableEdit { - private UndoPositionsModel positionsModel; - private int[] rows; + private final UndoPositionsModel positionsModel; + private final int[] rows; public BottomPositions(UndoPositionsModel positionsModel, int[] rows) { this.positionsModel = positionsModel; @@ -60,4 +60,4 @@ public void redo() throws CannotRedoException { super.redo(); positionsModel.bottom(rows, false); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/ChangeRoute.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/ChangeRoute.java index a464823807..58a49bac09 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/ChangeRoute.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/ChangeRoute.java @@ -34,8 +34,9 @@ */ class ChangeRoute extends AbstractUndoableEdit { - private UndoFormatAndRoutesModel formatAndRoutesModel; - private BaseRoute previousRoute, nextRoute; + private final UndoFormatAndRoutesModel formatAndRoutesModel; + private final BaseRoute previousRoute; + private final BaseRoute nextRoute; public ChangeRoute(UndoFormatAndRoutesModel formatAndRoutesModel, BaseRoute previousRoute, BaseRoute nextRoute) { this.formatAndRoutesModel = formatAndRoutesModel; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/DownPositions.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/DownPositions.java index 5ed71e5898..d4b3926df0 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/DownPositions.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/DownPositions.java @@ -35,9 +35,9 @@ */ class DownPositions extends AbstractUndoableEdit { - private UndoPositionsModel positionsModel; - private int[] rows; - private int delta; + private final UndoPositionsModel positionsModel; + private final int[] rows; + private final int delta; public DownPositions(UndoPositionsModel positionsModel, int[] rows, int delta) { this.positionsModel = positionsModel; @@ -62,4 +62,4 @@ public void redo() throws CannotRedoException { super.redo(); positionsModel.down(rows, delta, false); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RemovePositions.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RemovePositions.java index 4b40747d07..a4205ce8cd 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RemovePositions.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RemovePositions.java @@ -37,9 +37,9 @@ */ class RemovePositions extends AbstractUndoableEdit { - private UndoPositionsModel positionsModel; - private List rowList = new ArrayList<>(); - private List> positionsList = new ArrayList<>(); + private final UndoPositionsModel positionsModel; + private final List rowList = new ArrayList<>(); + private final List> positionsList = new ArrayList<>(); public RemovePositions(UndoPositionsModel positionsModel) { this.positionsModel = positionsModel; @@ -75,4 +75,4 @@ public void redo() throws CannotRedoException { positionsModel.remove(row, row + positions.size(), true, false); } } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenameCategory.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenameCategory.java index a0f1063c1d..5182cb4e0d 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenameCategory.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenameCategory.java @@ -34,9 +34,10 @@ */ class RenameCategory extends AbstractUndoableEdit { - private UndoCatalogModel catalogModel; - private CategoryTreeNode category; - private String oldName, newName; + private final UndoCatalogModel catalogModel; + private final CategoryTreeNode category; + private final String oldName; + private final String newName; public RenameCategory(UndoCatalogModel catalogModel, CategoryTreeNode category, String oldName, String newName) { this.catalogModel = catalogModel; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenamePositionList.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenamePositionList.java index f0e7158cf4..16fbf75570 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenamePositionList.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenamePositionList.java @@ -32,8 +32,9 @@ */ class RenamePositionList extends AbstractUndoableEdit { - private UndoFormatAndRoutesModel formatAndRoutesModel; - private String previousName, nextName; + private final UndoFormatAndRoutesModel formatAndRoutesModel; + private final String previousName; + private final String nextName; public RenamePositionList(UndoFormatAndRoutesModel formatAndRoutesModel, String previousName, String nextName) { this.formatAndRoutesModel = formatAndRoutesModel; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenameRoute.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenameRoute.java index d4b2898098..e888ea472a 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenameRoute.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RenameRoute.java @@ -34,9 +34,10 @@ */ class RenameRoute extends AbstractUndoableEdit { - private UndoCatalogModel catalogModel; - private RouteModel route; - private String oldName, newName; + private final UndoCatalogModel catalogModel; + private final RouteModel route; + private final String oldName; + private final String newName; public RenameRoute(UndoCatalogModel catalogModel, RouteModel route, String oldName, String newName) { this.catalogModel = catalogModel; diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RevertPositions.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RevertPositions.java index ec4b2bda03..600a397b2a 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/RevertPositions.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/RevertPositions.java @@ -34,7 +34,7 @@ */ class RevertPositions extends AbstractUndoableEdit { - private UndoPositionsModel positionsModel; + private final UndoPositionsModel positionsModel; public RevertPositions(UndoPositionsModel positionsModel) { this.positionsModel = positionsModel; @@ -57,4 +57,4 @@ public void redo() throws CannotRedoException { super.redo(); positionsModel.revert(false); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/SortPositions.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/SortPositions.java index bf970596ac..6be956053e 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/SortPositions.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/SortPositions.java @@ -37,9 +37,9 @@ */ class SortPositions extends AbstractUndoableEdit { - private UndoPositionsModel positionsModel; - private Comparator comparator; - private List positions; + private final UndoPositionsModel positionsModel; + private final Comparator comparator; + private final List positions; public SortPositions(UndoPositionsModel positionsModel, Comparator comparator, List positions) { this.positionsModel = positionsModel; @@ -64,4 +64,4 @@ public void redo() throws CannotRedoException { super.redo(); positionsModel.sort(comparator, false); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/TopPositions.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/TopPositions.java index c958168a67..d70cae3363 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/TopPositions.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/TopPositions.java @@ -34,8 +34,8 @@ */ class TopPositions extends AbstractUndoableEdit { - private UndoPositionsModel positionsModel; - private int[] rows; + private final UndoPositionsModel positionsModel; + private final int[] rows; public TopPositions(UndoPositionsModel positionsModel, int[] rows) { this.positionsModel = positionsModel; @@ -59,4 +59,4 @@ public void redo() throws CannotRedoException { super.redo(); positionsModel.top(rows, false); } -} \ No newline at end of file +} diff --git a/route-converter/src/main/java/slash/navigation/converter/gui/undo/UpPositions.java b/route-converter/src/main/java/slash/navigation/converter/gui/undo/UpPositions.java index 3a56a2d336..ceb08e886d 100644 --- a/route-converter/src/main/java/slash/navigation/converter/gui/undo/UpPositions.java +++ b/route-converter/src/main/java/slash/navigation/converter/gui/undo/UpPositions.java @@ -35,9 +35,9 @@ */ class UpPositions extends AbstractUndoableEdit { - private UndoPositionsModel positionsModel; - private int[] rows; - private int delta; + private final UndoPositionsModel positionsModel; + private final int[] rows; + private final int delta; public UpPositions(UndoPositionsModel positionsModel, int[] rows, int delta) { this.positionsModel = positionsModel; @@ -62,4 +62,4 @@ public void redo() throws CannotRedoException { super.redo(); positionsModel.up(rows, delta, false); } -} \ No newline at end of file +} diff --git a/route-converter/src/test/java/slash/navigation/converter/gui/ResourceBundleTest.java b/route-converter/src/test/java/slash/navigation/converter/gui/ResourceBundleTest.java index 9d6100c24a..c03dbf585c 100644 --- a/route-converter/src/test/java/slash/navigation/converter/gui/ResourceBundleTest.java +++ b/route-converter/src/test/java/slash/navigation/converter/gui/ResourceBundleTest.java @@ -33,7 +33,7 @@ public class ResourceBundleTest { private static final Logger log = Logger.getLogger(ResourceBundleTest.class.getName()); - private List LOCALES = asList(ARABIA, BRAZIL, CATALAN, CHINA, CROATIA, CZECH, DENMARK, FRANCE, + private final List LOCALES = asList(ARABIA, BRAZIL, CATALAN, CHINA, CROATIA, CZECH, DENMARK, FRANCE, GERMANY, ITALY, JAPAN, KOREA, HUNGARY, NEDERLANDS, NORWAY_BOKMAL, POLAND, PORTUGAL, RUSSIA, SERBIA, SLOVAKIA, SPAIN, UKRAINE, US); private static final ResourceBundle.Control NO_FALLBACK_CONTROL = new ResourceBundle.Control() { diff --git a/route-converter/src/test/java/slash/navigation/converter/gui/helpers/PositionAugmenterTest.java b/route-converter/src/test/java/slash/navigation/converter/gui/helpers/PositionAugmenterTest.java index 8341860769..cd91e685f7 100644 --- a/route-converter/src/test/java/slash/navigation/converter/gui/helpers/PositionAugmenterTest.java +++ b/route-converter/src/test/java/slash/navigation/converter/gui/helpers/PositionAugmenterTest.java @@ -33,14 +33,14 @@ import static slash.common.TestCase.calendar; public class PositionAugmenterTest { - private PositionAugmenter augmenter = new PositionAugmenter(null, null, null, null, null); - private GpxPosition a = new GpxPosition(null, null, null, null, null, null); - private GpxPosition b = new GpxPosition(null, null, null, null, null, null); - private GpxPosition c = new GpxPosition(null, null, null, null, null, null); - private GpxPosition d = new GpxPosition(null, null, null, null, null, null); - private GpxPosition e = new GpxPosition(null, null, null, null, null, null); - private BaseRoute route = new GpxRoute(new Gpx11Format(), null, null, null, asList(a, b, c, d, e)); - private PositionsModelImpl model = new PositionsModelImpl(); + private final PositionAugmenter augmenter = new PositionAugmenter(null, null, null, null, null); + private final GpxPosition a = new GpxPosition(null, null, null, null, null, null); + private final GpxPosition b = new GpxPosition(null, null, null, null, null, null); + private final GpxPosition c = new GpxPosition(null, null, null, null, null, null); + private final GpxPosition d = new GpxPosition(null, null, null, null, null, null); + private final GpxPosition e = new GpxPosition(null, null, null, null, null, null); + private final BaseRoute route = new GpxRoute(new Gpx11Format(), null, null, null, asList(a, b, c, d, e)); + private final PositionsModelImpl model = new PositionsModelImpl(); @Before public void setUp() { diff --git a/route-converter/src/test/java/slash/navigation/converter/gui/models/RecentFormatsModelTest.java b/route-converter/src/test/java/slash/navigation/converter/gui/models/RecentFormatsModelTest.java index 227d9789a5..263f766807 100644 --- a/route-converter/src/test/java/slash/navigation/converter/gui/models/RecentFormatsModelTest.java +++ b/route-converter/src/test/java/slash/navigation/converter/gui/models/RecentFormatsModelTest.java @@ -38,8 +38,8 @@ public class RecentFormatsModelTest { private static final int LIMIT = 5; - private NavigationFormatRegistry registry = new NavigationFormatRegistry(); - private RecentFormatsModel recentFormatsModel = new RecentFormatsModel(registry); + private final NavigationFormatRegistry registry = new NavigationFormatRegistry(); + private final RecentFormatsModel recentFormatsModel = new RecentFormatsModel(registry); @Before public void setUp() { diff --git a/routing-service/src/main/java/slash/navigation/routing/BaseRoutingService.java b/routing-service/src/main/java/slash/navigation/routing/BaseRoutingService.java index 60ceea74f5..791d829eb3 100644 --- a/routing-service/src/main/java/slash/navigation/routing/BaseRoutingService.java +++ b/routing-service/src/main/java/slash/navigation/routing/BaseRoutingService.java @@ -29,7 +29,7 @@ */ public abstract class BaseRoutingService implements RoutingService { - private EventListenerList listenerList = new EventListenerList(); + private final EventListenerList listenerList = new EventListenerList(); protected void fireDownloading() { Object[] listeners = listenerList.getListenerList(); diff --git a/tileserver-maps/src/main/java/slash/navigation/maps/item/ItemModel.java b/tileserver-maps/src/main/java/slash/navigation/maps/item/ItemModel.java index d9a849cbe5..cbc9d04b54 100644 --- a/tileserver-maps/src/main/java/slash/navigation/maps/item/ItemModel.java +++ b/tileserver-maps/src/main/java/slash/navigation/maps/item/ItemModel.java @@ -34,7 +34,7 @@ public abstract class ItemModel { private final String preferenceName; private final String defaultValue; - private EventListenerList listenerList = new EventListenerList(); + private final EventListenerList listenerList = new EventListenerList(); protected ItemModel(String preferenceName, String defaultValue) { this.preferenceName = preferenceName; @@ -50,11 +50,9 @@ public T getItem() { // intentionally left empty } T item = stringToItem(defaultValue); - if(item != null) - return item; + return item; // throwing an exception here means one cannot clear since the default value is not present // throw new IllegalArgumentException(format("Cannot find item for preference %s and default value %s", preferenceName, defaultValue)); - return null; } protected abstract T stringToItem(String value); diff --git a/tileserver-maps/src/main/java/slash/navigation/maps/tileserver/TileServerMapManager.java b/tileserver-maps/src/main/java/slash/navigation/maps/tileserver/TileServerMapManager.java index 60603e50d5..7cd383c379 100644 --- a/tileserver-maps/src/main/java/slash/navigation/maps/tileserver/TileServerMapManager.java +++ b/tileserver-maps/src/main/java/slash/navigation/maps/tileserver/TileServerMapManager.java @@ -44,9 +44,9 @@ public class TileServerMapManager { private static final String APPLIED_OVERLAY_PREFERENCE = "appliedOverlay"; private final TileServerService tileServerService; - private ItemTableModel availableMapsModel = new ItemTableModel<>(1); - private ItemTableModel availableOverlaysModel = new ItemTableModel<>(1); - private ItemTableModel appliedOverlaysModel = new ItemTableModel<>(1); + private final ItemTableModel availableMapsModel = new ItemTableModel<>(1); + private final ItemTableModel availableOverlaysModel = new ItemTableModel<>(1); + private final ItemTableModel appliedOverlaysModel = new ItemTableModel<>(1); private ItemPreferencesMediator itemPreferencesMediator; public TileServerMapManager(File tileServerDirectory) { diff --git a/tileserver-maps/src/main/java/slash/navigation/maps/tileserver/helpers/ItemPreferencesMediator.java b/tileserver-maps/src/main/java/slash/navigation/maps/tileserver/helpers/ItemPreferencesMediator.java index 17dcd424be..0b2ae963a1 100644 --- a/tileserver-maps/src/main/java/slash/navigation/maps/tileserver/helpers/ItemPreferencesMediator.java +++ b/tileserver-maps/src/main/java/slash/navigation/maps/tileserver/helpers/ItemPreferencesMediator.java @@ -118,7 +118,7 @@ private void handleDataRemove(int firstRow, int lastRow) { } } - private List keys = new ArrayList<>(); + private final List keys = new ArrayList<>(); private void handleSelectionAdd(int firstRow, int lastRow) { for (int i = firstRow; i < lastRow + 1; i++) {