Changeset 12374 in josm for trunk/src/org
- Timestamp:
- 2017-06-09T21:31:39+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/APIDataSet.java
r11177 r12374 182 182 } 183 183 184 /** 185 * Removes the given primitives from this {@link APIDataSet} 186 * @param processed The primitives to remove 187 */ 184 188 public void removeProcessed(Collection<IPrimitive> processed) { 185 189 if (processed == null) return; -
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r11905 r12374 73 73 private static final String DELETED_LAYERS_DIR = "autosave/deleted_layers"; 74 74 75 /** 76 * If autosave is enabled 77 */ 75 78 public static final BooleanProperty PROP_AUTOSAVE_ENABLED = new BooleanProperty("autosave.enabled", true); 79 /** 80 * The number of files to store per layer 81 */ 76 82 public static final IntegerProperty PROP_FILES_PER_LAYER = new IntegerProperty("autosave.filesPerLayer", 1); 83 /** 84 * How many deleted layers should be stored 85 */ 77 86 public static final IntegerProperty PROP_DELETED_LAYERS = new IntegerProperty("autosave.deletedLayersBackupCount", 5); 87 /** 88 * The autosave interval, in seconds 89 */ 78 90 public static final IntegerProperty PROP_INTERVAL = new IntegerProperty("autosave.interval", (int) TimeUnit.MINUTES.toSeconds(5)); 91 /** 92 * The maximum number of autosave files to store 93 */ 79 94 public static final IntegerProperty PROP_INDEX_LIMIT = new IntegerProperty("autosave.index-limit", 1000); 80 /** Defines if a notification should be displayed after each autosave */ 95 /** 96 * Defines if a notification should be displayed after each autosave 97 */ 81 98 public static final BooleanProperty PROP_NOTIFICATION = new BooleanProperty("autosave.notification", false); 82 99 -
trunk/src/org/openstreetmap/josm/data/Bounds.java
r12171 r12374 86 86 } 87 87 88 /** 89 * The method used by the {@link Bounds#Bounds(String, String, ParseMethod)} constructor 90 */ 88 91 public enum ParseMethod { 92 /** 93 * Order: minlat, minlon, maxlat, maxlon 94 */ 89 95 MINLAT_MINLON_MAXLAT_MAXLON, 96 /** 97 * Order: left, bottom, right, top 98 */ 90 99 LEFT_BOTTOM_RIGHT_TOP 91 100 } … … 216 225 } 217 226 227 /** 228 * Parse the bounds in order {@link ParseMethod#MINLAT_MINLON_MAXLAT_MAXLON} 229 * @param asString The string 230 * @param separator The separation regex 231 */ 218 232 public Bounds(String asString, String separator) { 219 233 this(asString, separator, ParseMethod.MINLAT_MINLON_MAXLAT_MAXLON); 220 234 } 221 235 236 /** 237 * Parse the bounds from a given string and round to OSM precision 238 * @param asString The string 239 * @param separator The separation regex 240 * @param parseMethod The order of the numbers 241 */ 222 242 public Bounds(String asString, String separator, ParseMethod parseMethod) { 223 243 this(asString, separator, parseMethod, true); 224 244 } 225 245 246 /** 247 * Parse the bounds from a given string 248 * @param asString The string 249 * @param separator The separation regex 250 * @param parseMethod The order of the numbers 251 * @param roundToOsmPrecision Whether to round to OSM precision 252 */ 226 253 public Bounds(String asString, String separator, ParseMethod parseMethod, boolean roundToOsmPrecision) { 227 254 CheckParameterUtil.ensureParameterNotNull(asString, "asString"); … … 323 350 } 324 351 352 /** 353 * Converts this bounds to a human readable short string 354 * @param format The number format to use 355 * @return The string 356 */ 325 357 public String toShortString(DecimalFormat format) { 326 358 return format.format(minLat) + ' ' … … 386 418 } 387 419 420 /** 421 * Extends this bounds to enclose an other bounding box 422 * @param b The other bounds to enclose 423 */ 388 424 public void extend(Bounds b) { 389 425 extend(b.minLat, b.minLon); … … 474 510 } 475 511 512 /** 513 * Gets the area of this bounds (in lat/lon space) 514 * @return The area 515 */ 476 516 public double getArea() { 477 517 double w = getWidth(); … … 479 519 } 480 520 521 /** 522 * Encodes this as a string so that it may be parsed using the {@link ParseMethod#MINLAT_MINLON_MAXLAT_MAXLON} order 523 * @param separator The separator 524 * @return The string encoded bounds 525 */ 481 526 public String encodeAsString(String separator) { 482 527 StringBuilder sb = new StringBuilder(); -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r12306 r12374 481 481 } 482 482 483 /** 484 * Gets all normal (string) settings that have a key starting with the prefix 485 * @param prefix The start of the key 486 * @return The key names of the settings 487 */ 483 488 public synchronized Map<String, String> getAllPrefix(final String prefix) { 484 489 final Map<String, String> all = new TreeMap<>(); … … 491 496 } 492 497 498 /** 499 * Gets all list settings that have a key starting with the prefix 500 * @param prefix The start of the key 501 * @return The key names of the list settings 502 */ 493 503 public synchronized List<String> getAllPrefixCollectionKeys(final String prefix) { 494 504 final List<String> all = new LinkedList<>(); … … 501 511 } 502 512 513 /** 514 * Gets all known colors (preferences starting with the color prefix) 515 * @return All colors 516 */ 503 517 public synchronized Map<String, String> getAllColors() { 504 518 final Map<String, String> all = new TreeMap<>(); … … 519 533 } 520 534 535 /** 536 * Gets a boolean preference 537 * @param key The preference key 538 * @return The boolean or <code>false</code> if it could not be parsed 539 * @see IntegerProperty#get() 540 */ 521 541 public synchronized boolean getBoolean(final String key) { 522 542 String s = get(key, null); … … 524 544 } 525 545 546 /** 547 * Gets a boolean preference 548 * @param key The preference key 549 * @param def The default value to use 550 * @return The boolean, <code>false</code> if it could not be parsed, the default value if it is unset 551 * @see IntegerProperty#get() 552 */ 526 553 public synchronized boolean getBoolean(final String key, final boolean def) { 527 554 return Boolean.parseBoolean(get(key, Boolean.toString(def))); 528 555 } 529 556 557 /** 558 * Gets an boolean that may be specialized 559 * @param key The basic key 560 * @param specName The sub-key to append to the key 561 * @param def The default value 562 * @return The boolean value or the default value if it could not be parsed 563 */ 530 564 public synchronized boolean getBoolean(final String key, final String specName, final boolean def) { 531 565 boolean generic = getBoolean(key, def); … … 564 598 * @param value The new value 565 599 * @return {@code true}, if something has changed (i.e. value is different than before) 566 * @see IntegerProperty 600 * @see IntegerProperty#put(Integer) 567 601 */ 568 602 public boolean putInteger(final String key, final Integer value) { … … 575 609 * @param value The new value 576 610 * @return {@code true}, if something has changed (i.e. value is different than before) 577 * @see DoubleProperty 611 * @see DoubleProperty#put(Double) 578 612 */ 579 613 public boolean putDouble(final String key, final Double value) { … … 586 620 * @param value The new value 587 621 * @return {@code true}, if something has changed (i.e. value is different than before) 588 * @see LongProperty 622 * @see LongProperty#put(Long) 589 623 */ 590 624 public boolean putLong(final String key, final Long value) { … … 600 634 } 601 635 636 /** 637 * Stores the defaults to the defaults file 638 * @throws IOException If the file could not be saved 639 */ 602 640 public synchronized void saveDefaults() throws IOException { 603 641 save(getDefaultsCacheFile(), defaultsMap.entrySet().stream(), true); … … 890 928 } 891 929 930 /** 931 * Gets the default color that was registered with the preference 932 * @param colKey The color name 933 * @return The color 934 */ 892 935 public synchronized Color getDefaultColor(String colKey) { 893 936 StringSetting col = Utils.cast(defaultsMap.get(COLOR_PREFIX+colKey), StringSetting.class); … … 896 939 } 897 940 941 /** 942 * Stores a color 943 * @param colKey The color name 944 * @param val The color 945 * @return true if the setting was modified 946 * @see ColorProperty#put(Color) 947 */ 898 948 public synchronized boolean putColor(String colKey, Color val) { 899 949 return put(COLOR_PREFIX+colKey, val != null ? ColorHelper.color2html(val, true) : null); 900 950 } 901 951 952 /** 953 * Gets an integer preference 954 * @param key The preference key 955 * @param def The default value to use 956 * @return The integer 957 * @see IntegerProperty#get() 958 */ 902 959 public synchronized int getInteger(String key, int def) { 903 960 String v = get(key, Integer.toString(def)); … … 914 971 } 915 972 973 /** 974 * Gets an integer that may be specialized 975 * @param key The basic key 976 * @param specName The sub-key to append to the key 977 * @param def The default value 978 * @return The integer value or the default value if it could not be parsed 979 */ 916 980 public synchronized int getInteger(String key, String specName, int def) { 917 981 String v = get(key+'.'+specName); … … 930 994 } 931 995 996 /** 997 * Gets a long preference 998 * @param key The preference key 999 * @param def The default value to use 1000 * @return The long value or the default value if it could not be parsed 1001 * @see LongProperty#get() 1002 */ 932 1003 public synchronized long getLong(String key, long def) { 933 1004 String v = get(key, Long.toString(def)); … … 944 1015 } 945 1016 1017 /** 1018 * Gets a double preference 1019 * @param key The preference key 1020 * @param def The default value to use 1021 * @return The double value or the default value if it could not be parsed 1022 * @see LongProperty#get() 1023 */ 946 1024 public synchronized double getDouble(String key, double def) { 947 1025 String v = get(key, Double.toString(def)); … … 978 1056 } 979 1057 1058 /** 1059 * Removes a value from a given String collection 1060 * @param key The preference key the collection is stored with 1061 * @param value The value that should be removed in the collection 1062 * @see #getCollection(String) 1063 */ 980 1064 public synchronized void removeFromCollection(String key, String value) { 981 1065 List<String> a = new ArrayList<>(getCollection(key, Collections.<String>emptyList())); … … 1024 1108 } 1025 1109 1110 /** 1111 * Get a setting of any type 1112 * @param key The key for the setting 1113 * @param def The default value to use if it was not found 1114 * @return The setting 1115 */ 1026 1116 public synchronized Setting<?> getSetting(String key, Setting<?> def) { 1027 1117 return getSetting(key, def, Setting.class); … … 1100 1190 } 1101 1191 1192 /** 1193 * Gets a collection of string collections for the given key 1194 * @param key The key 1195 * @return The collection of string collections or an empty collection as default 1196 */ 1102 1197 public Collection<Collection<String>> getArray(String key) { 1103 1198 Collection<Collection<String>> res = getArray(key, null); … … 1115 1210 } 1116 1211 1212 /** 1213 * Gets a collection of key->value maps. 1214 * @param key The key to search at 1215 * @param def The default value to use 1216 * @return The stored value or the default one if it could not be parsed 1217 */ 1117 1218 public Collection<Map<String, String>> getListOfStructs(String key, Collection<Map<String, String>> def) { 1118 1219 return getSetting(key, new MapListSetting(def == null ? null : new ArrayList<>(def)), MapListSetting.class).getValue(); 1119 1220 } 1120 1221 1222 /** 1223 * Stores a list of structs 1224 * @param key The key to store the list in 1225 * @param value A list of key->value maps 1226 * @return <code>true</code> if the value was changed 1227 * @see #getListOfStructs(String, Collection) 1228 */ 1121 1229 public boolean putListOfStructs(String key, Collection<Map<String, String>> value) { 1122 1230 return putSetting(key, value == null ? null : new MapListSetting(new ArrayList<>(value))); … … 1396 1504 } 1397 1505 1506 /** 1507 * Gets a map of all settings that are currently stored 1508 * @return The settings 1509 */ 1398 1510 public Map<String, Setting<?>> getAllSettings() { 1399 1511 return new TreeMap<>(settingsMap); 1400 1512 } 1401 1513 1514 /** 1515 * Gets a map of all currently known defaults 1516 * @return The map (key->setting) 1517 */ 1402 1518 public Map<String, Setting<?>> getAllDefaults() { 1403 1519 return new TreeMap<>(defaultsMap); -
trunk/src/org/openstreetmap/josm/data/ViewportData.java
r7937 r12374 36 36 } 37 37 38 /** 39 * Create a new {@link ViewportData} 40 * @param bounds The bounds to zoom to 41 */ 38 42 public ViewportData(ProjectionBounds bounds) { 39 43 CheckParameterUtil.ensureParameterNotNull(bounds);
Note:
See TracChangeset
for help on using the changeset viewer.