- Timestamp:
- 2014-05-09T06:03:50+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r7026 r7083 27 27 import java.util.List; 28 28 import java.util.Map; 29 import java.util.Objects; 29 30 import java.util.StringTokenizer; 30 31 import java.util.concurrent.Callable; … … 181 182 * The commands undo/redo handler. 182 183 */ 183 public UndoRedoHandler undoRedo = new UndoRedoHandler();184 public final UndoRedoHandler undoRedo = new UndoRedoHandler(); 184 185 185 186 /** … … 580 581 toolbar.control.updateUI(); 581 582 contentPanePrivate.updateUI(); 582 583 583 } 584 584 … … 1123 1123 final String EXIT = tr("Exit JOSM"); 1124 1124 final String CONTINUE = tr("Continue, try anyway"); 1125 int ret = JOptionPane.showOptionDialog(null, panel, tr("Error"), JOptionPane.YES_NO_OPTION, 1125 int ret = JOptionPane.showOptionDialog(null, panel, tr("Error"), JOptionPane.YES_NO_OPTION, 1126 1126 JOptionPane.ERROR_MESSAGE, null, new String[] {EXIT, CONTINUE}, EXIT); 1127 1127 if (ret == 0) { … … 1178 1178 private static void fireProjectionChanged(Projection oldValue, Projection newValue, Bounds oldBounds) { 1179 1179 if (newValue == null ^ oldValue == null 1180 || (newValue != null && oldValue != null && ! Utils.equal(newValue.toCode(), oldValue.toCode()))) {1180 || (newValue != null && oldValue != null && !Objects.equals(newValue.toCode(), oldValue.toCode()))) { 1181 1181 1182 1182 synchronized(Main.class) { -
trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java
r6429 r7083 4 4 import static org.openstreetmap.josm.tools.I18n.marktr; 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 import static org.openstreetmap.josm.tools.Utils.equal;7 6 8 7 import java.io.IOException; … … 10 9 import java.util.Arrays; 11 10 import java.util.List; 11 import java.util.Objects; 12 12 13 13 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError; … … 207 207 public boolean readIfEqual(Token token) { 208 208 Token nextTok = nextToken(); 209 if ( equal(nextTok, token))209 if (Objects.equals(nextTok, token)) 210 210 return true; 211 211 currentToken = nextTok; -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r7082 r7083 29 29 import java.util.Map; 30 30 import java.util.Map.Entry; 31 import java.util.Objects; 31 32 import java.util.ResourceBundle; 32 33 import java.util.SortedMap; … … 239 240 String aStr = itA.next(); 240 241 String bStr = itB.next(); 241 if (! Utils.equal(aStr,bStr)) return false;242 if (!Objects.equals(aStr,bStr)) return false; 242 243 } 243 244 return true; … … 375 376 if (a.size() != b.size()) return false; 376 377 for (Entry<String, String> e : a.entrySet()) { 377 if (! Utils.equal(e.getValue(), b.get(e.getKey()))) return false;378 if (!Objects.equals(e.getValue(), b.get(e.getKey()))) return false; 378 379 } 379 380 return true; … … 1210 1211 Object defaultFieldValue = f.get(structPrototype); 1211 1212 if (fieldValue != null) { 1212 if (f.getAnnotation(writeExplicitly.class) != null || ! Utils.equal(fieldValue, defaultFieldValue)) {1213 if (f.getAnnotation(writeExplicitly.class) != null || !Objects.equals(fieldValue, defaultFieldValue)) { 1213 1214 hash.put(f.getName().replace("_", "-"), fieldValue.toString()); 1214 1215 } -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r7037 r7083 8 8 import java.util.Collections; 9 9 import java.util.List; 10 import java.util.Objects; 10 11 11 12 import org.openstreetmap.josm.Main; … … 13 14 import org.openstreetmap.josm.io.MirroredInputStream; 14 15 import org.openstreetmap.josm.io.imagery.ImageryReader; 15 import org.openstreetmap.josm.tools.Utils;16 16 import org.xml.sax.SAXException; 17 17 … … 122 122 // some additional checks to respect extended URLs in preferences (legacy workaround) 123 123 private boolean isSimilar(String a, String b) { 124 return Utils.equal(a, b) || (a != null && b != null && !a.isEmpty() && !b.isEmpty() && (a.contains(b) || b.contains(a)));124 return Objects.equals(a, b) || (a != null && b != null && !a.isEmpty() && !b.isEmpty() && (a.contains(b) || b.contains(a))); 125 125 } 126 126 -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r7005 r7083 14 14 import java.util.Map; 15 15 import java.util.Map.Entry; 16 import java.util.Objects; 16 17 import java.util.Set; 17 18 import java.util.concurrent.atomic.AtomicLong; 18 19 import org.openstreetmap.josm.tools.Utils;20 19 21 20 /** … … 730 729 */ 731 730 public boolean hasTag(String key, String value) { 732 return Utils.equal(value, get(key));731 return Objects.equals(value, get(key)); 733 732 } 734 733 -
trunk/src/org/openstreetmap/josm/data/osm/Filter.java
r6289 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import org.openstreetmap.josm.actions.search.SearchAction.SearchMode; … … 26 24 super("", SearchMode.add, false, false, false); 27 25 } 28 26 29 27 public Filter(String text, SearchMode mode, boolean caseSensitive, 30 28 boolean regexSearch, boolean allElements) { … … 34 32 public Filter(FilterPreferenceEntry e) { 35 33 super(e.text, SearchMode.add, false, false, false); 36 if ( equal(e.mode, "replace")) {34 if ("replace".equals(e.mode)) { 37 35 mode = SearchMode.replace; 38 } else if ( equal(e.mode, "add")) {36 } else if ("add".equals(e.mode)) { 39 37 mode = SearchMode.add; 40 } else if ( equal(e.mode, "remove")) {38 } else if ("remove".equals(e.mode)) { 41 39 mode = SearchMode.remove; 42 } else if ( equal(e.mode, "in_selection")) {40 } else if ("in_selection".equals(e.mode)) { 43 41 mode = SearchMode.in_selection; 44 42 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r7005 r7083 11 11 import java.util.List; 12 12 import java.util.Map; 13 import java.util.Objects; 13 14 import java.util.Set; 14 15 … … 25 26 import org.openstreetmap.josm.data.validation.util.ValUtil; 26 27 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 27 import org.openstreetmap.josm.tools.Utils;28 28 29 29 /** … … 71 71 @Override 72 72 boolean ignoreWaySegmentCombination(Way w1, Way w2) { 73 if (! Utils.equal(getLayer(w1), getLayer(w2))) {74 return true; 75 } 76 if (w1.hasKey(HIGHWAY) && w2.hasKey(HIGHWAY) && ! Utils.equal(w1.get("level"), w2.get("level"))) {73 if (!Objects.equals(getLayer(w1), getLayer(w2))) { 74 return true; 75 } 76 if (w1.hasKey(HIGHWAY) && w2.hasKey(HIGHWAY) && !Objects.equals(w1.get("level"), w2.get("level"))) { 77 77 return true; 78 78 } … … 129 129 @Override 130 130 boolean ignoreWaySegmentCombination(Way w1, Way w2) { 131 return ! Utils.equal(w1.get("boundary"), w2.get("boundary"));131 return !Objects.equals(w1.get("boundary"), w2.get("boundary")); 132 132 } 133 133 -
trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java
r6889 r7083 18 18 import java.awt.event.WindowAdapter; 19 19 import java.awt.event.WindowEvent; 20 import java.util.Objects; 20 21 21 22 import javax.swing.AbstractAction; … … 38 39 import org.openstreetmap.josm.io.OsmApi; 39 40 import org.openstreetmap.josm.tools.ImageProvider; 40 import org.openstreetmap.josm.tools.Utils;41 41 import org.openstreetmap.josm.tools.WindowGeometry; 42 42 … … 45 45 public static CredentialDialog getOsmApiCredentialDialog(String username, String password, String host, String saveUsernameAndPasswordCheckboxText) { 46 46 CredentialDialog dialog = new CredentialDialog(saveUsernameAndPasswordCheckboxText); 47 if ( Utils.equal(OsmApi.getOsmApi().getHost(), host)) {47 if (Objects.equals(OsmApi.getOsmApi().getHost(), host)) { 48 48 dialog.prepareForOsmApiCredentials(username, password); 49 49 } else { -
trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
r6883 r7083 2 2 package org.openstreetmap.josm.gui.mappaint; 3 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 6 4 import java.awt.Color; 5 import java.util.Objects; 7 6 8 7 import org.openstreetmap.josm.Main; … … 11 10 import org.openstreetmap.josm.data.osm.Way; 12 11 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; 12 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 13 13 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 14 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;15 14 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 16 15 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 67 66 TextElement text = null; 68 67 Keyword textPos = c.get(TEXT_POSITION, null, Keyword.class); 69 if (textPos == null || Utils.equal(textPos.val, "center")) {68 if (textPos == null || "center".equals(textPos.val)) { 70 69 text = TextElement.create(c, PaintColors.AREA_TEXT.get(), true); 71 70 } … … 102 101 AreaElemStyle other = (AreaElemStyle) obj; 103 102 // we should get the same image object due to caching 104 if (! equal(fillImage, other.fillImage))103 if (!Objects.equals(fillImage, other.fillImage)) 105 104 return false; 106 if (! equal(color, other.color))105 if (!Objects.equals(color, other.color)) 107 106 return false; 108 if (! equal(text, other.text))107 if (!Objects.equals(text, other.text)) 109 108 return false; 110 109 return true; -
trunk/src/org/openstreetmap/josm/gui/mappaint/BoxTextElemStyle.java
r6889 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import java.awt.Color; … … 10 8 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 9 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; 10 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 12 11 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 13 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;14 12 import org.openstreetmap.josm.tools.CheckParameterUtil; 15 13 … … 115 113 TextElement text = TextElement.create(c, DEFAULT_TEXT_COLOR, false); 116 114 if (text == null) return null; 117 // Skip any prim tives that don't have text to draw. (Styles are recreated for any tag change.)115 // Skip any primitives that don't have text to draw. (Styles are recreated for any tag change.) 118 116 // The concrete text to render is not cached in this object, but computed for each 119 117 // repaint. This way, one BoxTextElemStyle object can be used by multiple primitives (to save memory). … … 122 120 HorizontalTextAlignment hAlign = HorizontalTextAlignment.RIGHT; 123 121 Keyword hAlignKW = c.get("text-anchor-horizontal", Keyword.RIGHT, Keyword.class); 124 if ( equal(hAlignKW.val, "left")) {122 if ("left".equals(hAlignKW.val)) { 125 123 hAlign = HorizontalTextAlignment.LEFT; 126 } else if ( equal(hAlignKW.val, "center")) {124 } else if ("center".equals(hAlignKW.val)) { 127 125 hAlign = HorizontalTextAlignment.CENTER; 128 } else if ( equal(hAlignKW.val, "right")) {126 } else if ("right".equals(hAlignKW.val)) { 129 127 hAlign = HorizontalTextAlignment.RIGHT; 130 128 } 131 129 VerticalTextAlignment vAlign = VerticalTextAlignment.BOTTOM; 132 130 String vAlignStr = c.get("text-anchor-vertical", Keyword.BOTTOM, Keyword.class).val; 133 if ( equal(vAlignStr, "above")) {131 if ("above".equals(vAlignStr)) { 134 132 vAlign = VerticalTextAlignment.ABOVE; 135 } else if ( equal(vAlignStr, "top")) {133 } else if ("top".equals(vAlignStr)) { 136 134 vAlign = VerticalTextAlignment.TOP; 137 } else if ( equal(vAlignStr, "center")) {135 } else if ("center".equals(vAlignStr)) { 138 136 vAlign = VerticalTextAlignment.CENTER; 139 } else if ( equal(vAlignStr, "bottom")) {137 } else if ("bottom".equals(vAlignStr)) { 140 138 vAlign = VerticalTextAlignment.BOTTOM; 141 } else if ( equal(vAlignStr, "below")) {139 } else if ("below".equals(vAlignStr)) { 142 140 vAlign = VerticalTextAlignment.BELOW; 143 141 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java
r7029 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import java.awt.Color; … … 133 131 if (o instanceof Keyword) { 134 132 String s = ((Keyword) o).val; 135 if ( equal(s, "true") || equal(s, "yes"))133 if ("true".equals(s) || "yes".equals(s)) 136 134 return true; 137 if ( equal(s, "false") || equal(s, "no"))135 if ("false".equals(s) || "no".equals(s)) 138 136 return false; 139 137 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java
r7059 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import java.awt.Font; … … 67 65 } else { 68 66 Keyword widthKW = c.get(key, null, Keyword.class, true); 69 if ( equal(widthKW, Keyword.THINNEST))67 if (Keyword.THINNEST.equals(widthKW)) 70 68 return 0f; 71 if ( equal(widthKW, Keyword.DEFAULT))69 if (Keyword.DEFAULT.equals(widthKW)) 72 70 return (float) MapPaintSettings.INSTANCE.getDefaultSegmentWidth(); 73 71 if (relativeTo != null) { … … 93 91 private static volatile Float DEFAULT_FONT_SIZE = null; 94 92 private static final Object lock = new Object(); 95 93 96 94 // thread save access (double-checked locking) 97 95 private static Float getDefaultFontSize() { -
trunk/src/org/openstreetmap/josm/gui/mappaint/Keyword.java
r6889 r7083 2 2 package org.openstreetmap.josm.gui.mappaint; 3 3 4 import org.openstreetmap.josm.tools.Utils;4 import java.util.Objects; 5 5 6 6 public class Keyword { … … 20 20 if (obj == null || getClass() != obj.getClass()) 21 21 return false; 22 return Utils.equal(val, ((Keyword) obj).val);22 return Objects.equals(val, ((Keyword) obj).val); 23 23 } 24 24 -
trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
r7045 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import java.awt.BasicStroke; 7 5 import java.awt.Color; 8 6 import java.util.Arrays; 7 import java.util.Objects; 9 8 10 9 import org.openstreetmap.josm.Main; … … 215 214 Keyword capKW = c.get(type.prefix + "linecap", null, Keyword.class); 216 215 if (capKW != null) { 217 if ( equal(capKW.val, "none")) {216 if ("none".equals(capKW.val)) { 218 217 cap = BasicStroke.CAP_BUTT; 219 } else if ( equal(capKW.val, "round")) {218 } else if ("round".equals(capKW.val)) { 220 219 cap = BasicStroke.CAP_ROUND; 221 } else if ( equal(capKW.val, "square")) {220 } else if ("square".equals(capKW.val)) { 222 221 cap = BasicStroke.CAP_SQUARE; 223 222 } … … 230 229 Keyword joinKW = c.get(type.prefix + "linejoin", null, Keyword.class); 231 230 if (joinKW != null) { 232 if ( equal(joinKW.val, "round")) {231 if ("round".equals(joinKW.val)) { 233 232 join = BasicStroke.JOIN_ROUND; 234 } else if ( equal(joinKW.val, "miter")) {233 } else if ("miter".equals(joinKW.val)) { 235 234 join = BasicStroke.JOIN_MITER; 236 } else if ( equal(joinKW.val, "bevel")) {235 } else if ("bevel".equals(joinKW.val)) { 237 236 join = BasicStroke.JOIN_BEVEL; 238 237 } … … 329 328 return false; 330 329 final LineElemStyle other = (LineElemStyle) obj; 331 return equal(line, other.line) &&332 equal(color, other.color) &&333 equal(dashesLine, other.dashesLine) &&334 equal(dashesBackground, other.dashesBackground) &&330 return Objects.equals(line, other.line) && 331 Objects.equals(color, other.color) && 332 Objects.equals(dashesLine, other.dashesLine) && 333 Objects.equals(dashesBackground, other.dashesBackground) && 335 334 offset == other.offset && 336 335 realWidth == other.realWidth; -
trunk/src/org/openstreetmap/josm/gui/mappaint/LineTextElemStyle.java
r5571 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import java.util.Objects; 3 5 4 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; 5 7 import org.openstreetmap.josm.data.osm.Way; 6 8 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; 9 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 7 10 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 8 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;9 import org.openstreetmap.josm.tools.Utils;10 11 11 12 public class LineTextElemStyle extends ElemStyle { … … 21 22 22 23 Keyword textPos = c.get(TEXT_POSITION, null, Keyword.class); 23 if (textPos != null && ! Utils.equal(textPos.val, "line"))24 if (textPos != null && !"line".equals(textPos.val)) 24 25 return null; 25 26 … … 43 44 return false; 44 45 final LineTextElemStyle other = (LineTextElemStyle) obj; 45 return Utils.equal(text, other.text);46 return Objects.equals(text, other.text); 46 47 } 47 48 … … 55 56 return "LineTextElemStyle{" + super.toString() + "text=" + text + "}"; 56 57 } 57 58 58 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapImage.java
r6711 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import java.awt.Image; 7 5 import java.awt.Rectangle; 8 6 import java.awt.image.BufferedImage; 7 import java.util.Objects; 9 8 10 9 import javax.swing.ImageIcon; … … 19 18 20 19 public class MapImage { 21 20 22 21 private static final int MAX_SIZE = 48; 23 22 24 23 /** 25 24 * ImageIcon can change while the image is loading. … … 158 157 return new MapImageBoxProvider(); 159 158 } 160 159 161 160 /** 162 161 * Returns the really displayed node icon for this {@code MapImage}. … … 174 173 } 175 174 } 176 175 177 176 private boolean mustRescale(Image image) { 178 return ((width == -1 && image.getWidth(null) > MAX_SIZE) 177 return ((width == -1 && image.getWidth(null) > MAX_SIZE) 179 178 && (height == -1 && image.getHeight(null) > MAX_SIZE)); 180 179 } … … 187 186 // img changes when image is fully loaded and can't be used for equality check. 188 187 return alpha == other.alpha && 189 equal(name, other.name) &&190 equal(source, other.source) &&188 Objects.equals(name, other.name) && 189 Objects.equals(source, other.source) && 191 190 width == other.width && 192 191 height == other.height; -
trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
r6280 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import java.awt.BasicStroke; … … 9 7 import java.awt.Rectangle; 10 8 import java.awt.Stroke; 9 import java.util.Objects; 11 10 12 11 import org.openstreetmap.josm.Main; … … 28 27 public final MapImage mapImage; 29 28 public final Symbol symbol; 30 29 31 30 private Image enabledNodeIcon; 32 31 private Image disabledNodeIcon; … … 63 62 return symbol == other.symbol && 64 63 size == other.size && 65 equal(stroke, other.stroke) &&66 equal(strokeColor, other.strokeColor) &&67 equal(fillColor, other.fillColor);64 Objects.equals(stroke, other.stroke) && 65 Objects.equals(strokeColor, other.strokeColor) && 66 Objects.equals(fillColor, other.fillColor); 68 67 } 69 68 … … 170 169 if (shapeKW == null) 171 170 return null; 172 if ( equal(shapeKW.val, "square")) {171 if ("square".equals(shapeKW.val)) { 173 172 shape = SymbolShape.SQUARE; 174 } else if ( equal(shapeKW.val, "circle")) {173 } else if ("circle".equals(shapeKW.val)) { 175 174 shape = SymbolShape.CIRCLE; 176 } else if ( equal(shapeKW.val, "triangle")) {175 } else if ("triangle".equals(shapeKW.val)) { 177 176 shape = SymbolShape.TRIANGLE; 178 } else if ( equal(shapeKW.val, "pentagon")) {177 } else if ("pentagon".equals(shapeKW.val)) { 179 178 shape = SymbolShape.PENTAGON; 180 } else if ( equal(shapeKW.val, "hexagon")) {179 } else if ("hexagon".equals(shapeKW.val)) { 181 180 shape = SymbolShape.HEXAGON; 182 } else if ( equal(shapeKW.val, "heptagon")) {181 } else if ("heptagon".equals(shapeKW.val)) { 183 182 shape = SymbolShape.HEPTAGON; 184 } else if ( equal(shapeKW.val, "octagon")) {183 } else if ("octagon".equals(shapeKW.val)) { 185 184 shape = SymbolShape.OCTAGON; 186 } else if ( equal(shapeKW.val, "nonagon")) {185 } else if ("nonagon".equals(shapeKW.val)) { 187 186 shape = SymbolShape.NONAGON; 188 } else if ( equal(shapeKW.val, "decagon")) {187 } else if ("decagon".equals(shapeKW.val)) { 189 188 shape = SymbolShape.DECAGON; 190 189 } else … … 356 355 final NodeElemStyle other = (NodeElemStyle) obj; 357 356 // we should get the same image object due to caching 358 if (! equal(mapImage, other.mapImage))357 if (!Objects.equals(mapImage, other.mapImage)) 359 358 return false; 360 if (! equal(symbol, other.symbol))359 if (!Objects.equals(symbol, other.symbol)) 361 360 return false; 362 361 return true; -
trunk/src/org/openstreetmap/josm/gui/mappaint/RepeatImageElemStyle.java
r5812 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 42 40 LineImageAlignment align = LineImageAlignment.CENTER; 43 41 Keyword alignKW = c.get(REPEAT_IMAGE_ALIGN, Keyword.CENTER, Keyword.class); 44 if ( equal(alignKW.val, "top")) {42 if ("top".equals(alignKW.val)) { 45 43 align = LineImageAlignment.TOP; 46 } else if ( equal(alignKW.val, "bottom")) {44 } else if ("bottom".equals(alignKW.val)) { 47 45 align = LineImageAlignment.BOTTOM; 48 46 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
r7005 r7083 7 7 import java.util.Iterator; 8 8 import java.util.List; 9 import java.util.Objects; 9 10 10 11 import org.openstreetmap.josm.data.osm.Storage; 11 12 import org.openstreetmap.josm.tools.Pair; 12 import org.openstreetmap.josm.tools.Utils;13 13 14 14 /** … … 91 91 return false; 92 92 final StyleList other = (StyleList) obj; 93 return Utils.equal(lst, other.lst);93 return Objects.equals(lst, other.lst); 94 94 } 95 95 -
trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java
r6889 r7083 2 2 package org.openstreetmap.josm.gui.mappaint; 3 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 6 4 import java.awt.Color; 7 5 import java.awt.Font; 6 import java.util.Objects; 8 7 9 8 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 90 89 91 90 /* 92 * Check whether the label composition strategy is given by 93 * a keyword 91 * Check whether the label composition strategy is given by a keyword 94 92 */ 95 93 Keyword keyword = c.get(TEXT, null, Keyword.class, true); 96 if ( equal(keyword, Keyword.AUTO))94 if (Keyword.AUTO.equals(keyword)) 97 95 return AUTO_LABEL_COMPOSITION_STRATEGY; 98 96 … … 212 210 return false; 213 211 final TextElement other = (TextElement) obj; 214 return equal(labelCompositionStrategy, other.labelCompositionStrategy) &&215 equal(font, other.font) &&212 return Objects.equals(labelCompositionStrategy, other.labelCompositionStrategy) && 213 Objects.equals(font, other.font) && 216 214 xOffset == other.xOffset && 217 215 yOffset == other.yOffset && 218 equal(color, other.color) &&219 equal(haloRadius, other.haloRadius) &&220 equal(haloColor, other.haloColor);216 Objects.equals(color, other.color) && 217 Objects.equals(haloRadius, other.haloRadius) && 218 Objects.equals(haloColor, other.haloColor); 221 219 } 222 220 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r7081 r7083 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 6 4 import java.text.MessageFormat; 7 5 import java.util.EnumSet; 6 import java.util.Objects; 8 7 import java.util.Set; 9 8 import java.util.regex.Pattern; … … 88 87 switch (this) { 89 88 case EQ: 90 return equal(testString, prototypeString);89 return Objects.equals(testString, prototypeString); 91 90 case NEQ: 92 return ! equal(testString, prototypeString);91 return !Objects.equals(testString, prototypeString); 93 92 case REGEX: 94 93 case NREGEX: … … 98 97 String[] parts = testString.split(";"); 99 98 for (String part : parts) { 100 if ( equal(prototypeString, part.trim()))99 if (Objects.equals(prototypeString, part.trim())) 101 100 return true; 102 101 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r7082 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint.mapcss; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import java.awt.Color; … … 594 592 */ 595 593 public static Expression createFunctionExpression(String name, List<Expression> args) { 596 if ( equal(name, "cond") && args.size() == 3)594 if ("cond".equals(name) && args.size() == 3) 597 595 return new CondOperator(args.get(0), args.get(1), args.get(2)); 598 else if ( equal(name, "and"))596 else if ("and".equals(name)) 599 597 return new AndOperator(args); 600 else if ( equal(name, "or"))598 else if ("or".equals(name)) 601 599 return new OrOperator(args); 602 else if ( equal(name, "length") && args.size() == 1)600 else if ("length".equals(name) && args.size() == 1) 603 601 return new LengthFunction(args.get(0)); 604 602 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r7082 r7083 276 276 for (Entry<String, Cascade> entry : mc.getLayers()) { 277 277 env.layer = entry.getKey(); 278 if ( Utils.equal(env.layer, "*")) {278 if ("*".equals(env.layer)) { 279 279 continue; 280 280 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r7082 r7083 14 14 import java.util.List; 15 15 import java.util.Map; 16 import java.util.Objects; 16 17 17 18 import org.openstreetmap.josm.Main; … … 369 370 WayPrototypesRecord p2 = new WayPrototypesRecord(); 370 371 get(multipolyOuterWay, true, p2, (useMinMaxScale ? scale : null), mc); 371 if ( Utils.equal(p.area, p2.area)) {372 if (Objects.equals(p.area, p2.area)) { 372 373 p.area = null; 373 374 } -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r7082 r7083 4 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 import static org.openstreetmap.josm.tools.Utils.equal;7 6 8 7 import java.awt.Component; … … 38 37 import java.util.List; 39 38 import java.util.Map; 39 import java.util.Objects; 40 40 import java.util.Set; 41 41 import java.util.concurrent.CopyOnWriteArrayList; … … 417 417 SourceEntry pe = p.next(); 418 418 SourceEntry ce = c.next(); 419 if (! equal(pe.url, ce.url) || !equal(pe.name, ce.name) || pe.active != ce.active)419 if (!Objects.equals(pe.url, ce.url) || !Objects.equals(pe.name, ce.name) || pe.active != ce.active) 420 420 return true; 421 421 } … … 916 916 editEntryDialog.showDialog(); 917 917 if (editEntryDialog.getValue() == 1) { 918 if (e.title != null || ! equal(editEntryDialog.getTitle(), "")) {918 if (e.title != null || !"".equals(editEntryDialog.getTitle())) { 919 919 e.title = editEntryDialog.getTitle(); 920 if ( equal(e.title, "")) {920 if ("".equals(e.title)) { 921 921 e.title = null; 922 922 } -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
r6920 r7083 2 2 package org.openstreetmap.josm.gui.preferences; 3 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 6 4 import java.io.File; 5 import java.util.Objects; 7 6 import java.util.regex.Matcher; 8 7 import java.util.regex.Pattern; … … 57 56 this.url = url; 58 57 this.isZip = isZip; 59 this.zipEntryPath = equal(zipEntryPath, "") ? null : zipEntryPath;60 this.name = equal(name, "") ? null : name;61 this.title = equal(title, "") ? null : title;58 this.zipEntryPath = "".equals(zipEntryPath) ? null : zipEntryPath; 59 this.name = "".equals(name) ? null : name; 60 this.title = "".equals(title) ? null : title; 62 61 this.active = active; 63 62 } … … 81 80 return false; 82 81 final SourceEntry other = (SourceEntry) obj; 83 return equal(other.url, url) &&82 return Objects.equals(other.url, url) && 84 83 other.isZip == isZip && 85 equal(other.zipEntryPath, zipEntryPath) &&86 equal(other.name, name) &&87 equal(other.title, title) &&84 Objects.equals(other.zipEntryPath, zipEntryPath) && 85 Objects.equals(other.name, name) && 86 Objects.equals(other.title, title) && 88 87 other.active == active; 89 88 } -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java
r7027 r7083 14 14 import java.util.List; 15 15 import java.util.Map; 16 import java.util.Objects; 16 17 17 18 import javax.swing.ButtonGroup; … … 35 36 import org.openstreetmap.josm.gui.widgets.JosmTextField; 36 37 import org.openstreetmap.josm.tools.GBC; 37 import org.openstreetmap.josm.tools.Utils;38 38 39 39 /** … … 192 192 if (sEditor.getValue() == 1) { 193 193 String data = sEditor.getData(); 194 if (! Utils.equal(sSetting.getValue(), data)) {194 if (!Objects.equals(sSetting.getValue(), data)) { 195 195 pe.setValue(new StringSetting(data)); 196 196 ok = true; -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r7041 r7083 12 12 import java.util.List; 13 13 import java.util.Map; 14 import java.util.Objects; 14 15 import java.util.TreeSet; 15 16 … … 214 215 private boolean insertNewDefaults(List<SourceEntry> list) { 215 216 boolean changed = false; 216 217 217 218 boolean addedMapcssStyle = false; // Migration code can be removed ~ Nov. 2014 218 219 … … 226 227 @Override 227 228 public boolean evaluate(SourceEntry se) { 228 return Utils.equal(def.url, se.url);229 return Objects.equals(def.url, se.url); 229 230 } 230 231 }); … … 234 235 changed = true; 235 236 /* Migration code can be removed ~ Nov. 2014 */ 236 if ( Utils.equal(def.url, "resource://styles/standard/elemstyles.mapcss")) {237 if ("resource://styles/standard/elemstyles.mapcss".equals(def.url)) { 237 238 addedMapcssStyle = true; 238 239 } … … 257 258 @Override 258 259 public boolean evaluate(SourceEntry se) { 259 return Utils.equal(se.url, "resource://styles/standard/elemstyles.xml");260 return "resource://styles/standard/elemstyles.xml".equals(se.url); 260 261 } 261 262 }); … … 266 267 } 267 268 } 268 269 269 270 return changed; 270 271 } -
trunk/src/org/openstreetmap/josm/gui/widgets/AbstractTextComponentValidator.java
r6990 r7083 9 9 import java.beans.PropertyChangeEvent; 10 10 import java.beans.PropertyChangeListener; 11 import java.util.Objects; 11 12 12 13 import javax.swing.BorderFactory; … … 18 19 19 20 import org.openstreetmap.josm.tools.CheckParameterUtil; 20 import org.openstreetmap.josm.tools.Utils;21 21 22 22 /** … … 45 45 46 46 protected void feedbackInvalid(String msg) { 47 if (valid == null || valid || ! Utils.equal(msg, this.msg)) {47 if (valid == null || valid || !Objects.equals(msg, this.msg)) { 48 48 // only provide feedback if the validity has changed. This avoids 49 49 // unnecessary UI updates. … … 61 61 62 62 protected void feedbackValid(String msg) { 63 if (valid == null || !valid || ! Utils.equal(msg, this.msg)) {63 if (valid == null || !valid || !Objects.equals(msg, this.msg)) { 64 64 // only provide feedback if the validity has changed. This avoids 65 65 // unnecessary UI updates. -
trunk/src/org/openstreetmap/josm/io/auth/CredentialsManager.java
r6883 r7083 5 5 import java.net.Authenticator.RequestorType; 6 6 import java.net.PasswordAuthentication; 7 import java.util.Objects; 7 8 8 9 import org.openstreetmap.josm.data.oauth.OAuthToken; … … 10 11 import org.openstreetmap.josm.io.OsmApi; 11 12 import org.openstreetmap.josm.tools.CheckParameterUtil; 12 import org.openstreetmap.josm.tools.Utils;13 13 14 14 /** … … 72 72 this.delegate = delegate; 73 73 } 74 74 75 75 /** 76 76 * Returns type of credentials agent backing this credentials manager. … … 106 106 if (username == null) return null; 107 107 username = username.trim(); 108 return Utils.equal(username, "") ? null : username;108 return username.isEmpty() ? null : username; 109 109 } 110 110 … … 116 116 @Override 117 117 public void store(RequestorType requestorType, String host, PasswordAuthentication credentials) throws CredentialsAgentException { 118 if (requestorType == RequestorType.SERVER && Utils.equal(OsmApi.getOsmApi().getHost(), host)) {118 if (requestorType == RequestorType.SERVER && Objects.equals(OsmApi.getOsmApi().getHost(), host)) { 119 119 String username = credentials.getUserName(); 120 120 if(username != null && !username.trim().isEmpty()) { -
trunk/src/org/openstreetmap/josm/io/auth/JosmPreferencesCredentialAgent.java
r6070 r7083 5 5 6 6 import java.awt.Component; 7 import java.net.Authenticator.RequestorType; 7 8 import java.net.PasswordAuthentication; 8 import java. net.Authenticator.RequestorType;9 import java.util.Objects; 9 10 10 11 import javax.swing.text.html.HTMLEditorKit; … … 15 16 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 16 17 import org.openstreetmap.josm.io.OsmApi; 17 import org.openstreetmap.josm.tools.Utils;18 18 19 19 /** … … 35 35 switch(requestorType) { 36 36 case SERVER: 37 if ( Utils.equal(OsmApi.getOsmApi().getHost(), host)) {37 if (Objects.equals(OsmApi.getOsmApi().getHost(), host)) { 38 38 user = Main.pref.get("osm-server.username", null); 39 39 password = Main.pref.get("osm-server.password", null); … … 67 67 switch(requestorType) { 68 68 case SERVER: 69 if ( Utils.equal(OsmApi.getOsmApi().getHost(), host)) {69 if (Objects.equals(OsmApi.getOsmApi().getHost(), host)) { 70 70 Main.pref.put("osm-server.username", credentials.getUserName()); 71 71 if (credentials.getPassword() == null) { -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r7033 r7083 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.io.imagery; 3 4 import static org.openstreetmap.josm.tools.Utils.equal;5 3 6 4 import java.io.IOException; … … 9 7 import java.util.Arrays; 10 8 import java.util.List; 9 import java.util.Objects; 11 10 import java.util.Stack; 12 11 … … 176 175 } 177 176 states.push(newState); 178 if (newState == State.UNKNOWN && equal(atts.getValue("mandatory"), "true")) {177 if (newState == State.UNKNOWN && "true".equals(atts.getValue("mandatory"))) { 179 178 skipEntry = true; 180 179 } … … 208 207 boolean found = false; 209 208 for (ImageryType type : ImageryType.values()) { 210 if ( equal(accumulator.toString(), type.getTypeString())) {209 if (Objects.equals(accumulator.toString(), type.getTypeString())) { 211 210 entry.setImageryType(type); 212 211 found = true; -
trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
r7033 r7083 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.Utils.equal;6 5 7 6 import java.io.BufferedInputStream; … … 292 291 private void parseJos(Document doc, ProgressMonitor progressMonitor) throws IllegalDataException { 293 292 Element root = doc.getDocumentElement(); 294 if (! equal(root.getTagName(), "josm-session")) {293 if (!"josm-session".equals(root.getTagName())) { 295 294 error(tr("Unexpected root element ''{0}'' in session file", root.getTagName())); 296 295 } … … 355 354 if (node.getNodeType() == Node.ELEMENT_NODE) { 356 355 Element e = (Element) node; 357 if (equal(e.getTagName(), "layer")) { 358 356 if ("layer".equals(e.getTagName())) { 359 357 if (!e.hasAttribute("index")) { 360 358 error(tr("missing mandatory attribute ''index'' for element ''layer''")); -
trunk/src/org/openstreetmap/josm/tools/Predicates.java
r6870 r7083 1 1 package org.openstreetmap.josm.tools; 2 2 3 import java.util.Collection; 4 import java.util.Objects; 5 import java.util.regex.Pattern; 6 3 7 import org.openstreetmap.josm.data.osm.OsmPrimitive; 4 5 import java.util.Collection;6 import java.util.regex.Pattern;7 8 8 9 /** … … 33 34 @Override 34 35 public boolean evaluate(T obj) { 35 return Utils.equal(obj, ref);36 return Objects.equals(obj, ref); 36 37 } 37 38 }; -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r7082 r7083 174 174 } 175 175 176 /**177 * for convenience: test whether 2 objects are either both null or a.equals(b)178 */179 public static <T> boolean equal(T a, T b) {180 if (a == b)181 return true;182 return (a != null && a.equals(b));183 }184 185 176 public static void ensure(boolean condition, String message, Object...data) { 186 177 if (!condition)
Note:
See TracChangeset
for help on using the changeset viewer.