Changeset 12374 in josm for trunk/src/org


Ignore:
Timestamp:
2017-06-09T21:31:39+02:00 (7 years ago)
Author:
michael2402
Message:

Javadoc for the data package.

Location:
trunk/src/org/openstreetmap/josm/data
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/APIDataSet.java

    r11177 r12374  
    182182    }
    183183
     184    /**
     185     * Removes the given primitives from this {@link APIDataSet}
     186     * @param processed The primitives to remove
     187     */
    184188    public void removeProcessed(Collection<IPrimitive> processed) {
    185189        if (processed == null) return;
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r11905 r12374  
    7373    private static final String DELETED_LAYERS_DIR = "autosave/deleted_layers";
    7474
     75    /**
     76     * If autosave is enabled
     77     */
    7578    public static final BooleanProperty PROP_AUTOSAVE_ENABLED = new BooleanProperty("autosave.enabled", true);
     79    /**
     80     * The number of files to store per layer
     81     */
    7682    public static final IntegerProperty PROP_FILES_PER_LAYER = new IntegerProperty("autosave.filesPerLayer", 1);
     83    /**
     84     * How many deleted layers should be stored
     85     */
    7786    public static final IntegerProperty PROP_DELETED_LAYERS = new IntegerProperty("autosave.deletedLayersBackupCount", 5);
     87    /**
     88     * The autosave interval, in seconds
     89     */
    7890    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     */
    7994    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     */
    8198    public static final BooleanProperty PROP_NOTIFICATION = new BooleanProperty("autosave.notification", false);
    8299
  • trunk/src/org/openstreetmap/josm/data/Bounds.java

    r12171 r12374  
    8686    }
    8787
     88    /**
     89     * The method used by the {@link Bounds#Bounds(String, String, ParseMethod)} constructor
     90     */
    8891    public enum ParseMethod {
     92        /**
     93         * Order: minlat, minlon, maxlat, maxlon
     94         */
    8995        MINLAT_MINLON_MAXLAT_MAXLON,
     96        /**
     97         * Order: left, bottom, right, top
     98         */
    9099        LEFT_BOTTOM_RIGHT_TOP
    91100    }
     
    216225    }
    217226
     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     */
    218232    public Bounds(String asString, String separator) {
    219233        this(asString, separator, ParseMethod.MINLAT_MINLON_MAXLAT_MAXLON);
    220234    }
    221235
     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     */
    222242    public Bounds(String asString, String separator, ParseMethod parseMethod) {
    223243        this(asString, separator, parseMethod, true);
    224244    }
    225245
     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     */
    226253    public Bounds(String asString, String separator, ParseMethod parseMethod, boolean roundToOsmPrecision) {
    227254        CheckParameterUtil.ensureParameterNotNull(asString, "asString");
     
    323350    }
    324351
     352    /**
     353     * Converts this bounds to a human readable short string
     354     * @param format The number format to use
     355     * @return The string
     356     */
    325357    public String toShortString(DecimalFormat format) {
    326358        return format.format(minLat) + ' '
     
    386418    }
    387419
     420    /**
     421     * Extends this bounds to enclose an other bounding box
     422     * @param b The other bounds to enclose
     423     */
    388424    public void extend(Bounds b) {
    389425        extend(b.minLat, b.minLon);
     
    474510    }
    475511
     512    /**
     513     * Gets the area of this bounds (in lat/lon space)
     514     * @return The area
     515     */
    476516    public double getArea() {
    477517        double w = getWidth();
     
    479519    }
    480520
     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     */
    481526    public String encodeAsString(String separator) {
    482527        StringBuilder sb = new StringBuilder();
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r12306 r12374  
    481481    }
    482482
     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     */
    483488    public synchronized Map<String, String> getAllPrefix(final String prefix) {
    484489        final Map<String, String> all = new TreeMap<>();
     
    491496    }
    492497
     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     */
    493503    public synchronized List<String> getAllPrefixCollectionKeys(final String prefix) {
    494504        final List<String> all = new LinkedList<>();
     
    501511    }
    502512
     513    /**
     514     * Gets all known colors (preferences starting with the color prefix)
     515     * @return All colors
     516     */
    503517    public synchronized Map<String, String> getAllColors() {
    504518        final Map<String, String> all = new TreeMap<>();
     
    519533    }
    520534
     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     */
    521541    public synchronized boolean getBoolean(final String key) {
    522542        String s = get(key, null);
     
    524544    }
    525545
     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     */
    526553    public synchronized boolean getBoolean(final String key, final boolean def) {
    527554        return Boolean.parseBoolean(get(key, Boolean.toString(def)));
    528555    }
    529556
     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     */
    530564    public synchronized boolean getBoolean(final String key, final String specName, final boolean def) {
    531565        boolean generic = getBoolean(key, def);
     
    564598     * @param value The new value
    565599     * @return {@code true}, if something has changed (i.e. value is different than before)
    566      * @see IntegerProperty
     600     * @see IntegerProperty#put(Integer)
    567601     */
    568602    public boolean putInteger(final String key, final Integer value) {
     
    575609     * @param value The new value
    576610     * @return {@code true}, if something has changed (i.e. value is different than before)
    577      * @see DoubleProperty
     611     * @see DoubleProperty#put(Double)
    578612     */
    579613    public boolean putDouble(final String key, final Double value) {
     
    586620     * @param value The new value
    587621     * @return {@code true}, if something has changed (i.e. value is different than before)
    588      * @see LongProperty
     622     * @see LongProperty#put(Long)
    589623     */
    590624    public boolean putLong(final String key, final Long value) {
     
    600634    }
    601635
     636    /**
     637     * Stores the defaults to the defaults file
     638     * @throws IOException If the file could not be saved
     639     */
    602640    public synchronized void saveDefaults() throws IOException {
    603641        save(getDefaultsCacheFile(), defaultsMap.entrySet().stream(), true);
     
    890928    }
    891929
     930    /**
     931     * Gets the default color that was registered with the preference
     932     * @param colKey The color name
     933     * @return The color
     934     */
    892935    public synchronized Color getDefaultColor(String colKey) {
    893936        StringSetting col = Utils.cast(defaultsMap.get(COLOR_PREFIX+colKey), StringSetting.class);
     
    896939    }
    897940
     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     */
    898948    public synchronized boolean putColor(String colKey, Color val) {
    899949        return put(COLOR_PREFIX+colKey, val != null ? ColorHelper.color2html(val, true) : null);
    900950    }
    901951
     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     */
    902959    public synchronized int getInteger(String key, int def) {
    903960        String v = get(key, Integer.toString(def));
     
    914971    }
    915972
     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     */
    916980    public synchronized int getInteger(String key, String specName, int def) {
    917981        String v = get(key+'.'+specName);
     
    930994    }
    931995
     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     */
    9321003    public synchronized long getLong(String key, long def) {
    9331004        String v = get(key, Long.toString(def));
     
    9441015    }
    9451016
     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     */
    9461024    public synchronized double getDouble(String key, double def) {
    9471025        String v = get(key, Double.toString(def));
     
    9781056    }
    9791057
     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     */
    9801064    public synchronized void removeFromCollection(String key, String value) {
    9811065        List<String> a = new ArrayList<>(getCollection(key, Collections.<String>emptyList()));
     
    10241108    }
    10251109
     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     */
    10261116    public synchronized Setting<?> getSetting(String key, Setting<?> def) {
    10271117        return getSetting(key, def, Setting.class);
     
    11001190    }
    11011191
     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     */
    11021197    public Collection<Collection<String>> getArray(String key) {
    11031198        Collection<Collection<String>> res = getArray(key, null);
     
    11151210    }
    11161211
     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     */
    11171218    public Collection<Map<String, String>> getListOfStructs(String key, Collection<Map<String, String>> def) {
    11181219        return getSetting(key, new MapListSetting(def == null ? null : new ArrayList<>(def)), MapListSetting.class).getValue();
    11191220    }
    11201221
     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     */
    11211229    public boolean putListOfStructs(String key, Collection<Map<String, String>> value) {
    11221230        return putSetting(key, value == null ? null : new MapListSetting(new ArrayList<>(value)));
     
    13961504    }
    13971505
     1506    /**
     1507     * Gets a map of all settings that are currently stored
     1508     * @return The settings
     1509     */
    13981510    public Map<String, Setting<?>> getAllSettings() {
    13991511        return new TreeMap<>(settingsMap);
    14001512    }
    14011513
     1514    /**
     1515     * Gets a map of all currently known defaults
     1516     * @return The map (key->setting)
     1517     */
    14021518    public Map<String, Setting<?>> getAllDefaults() {
    14031519        return new TreeMap<>(defaultsMap);
  • trunk/src/org/openstreetmap/josm/data/ViewportData.java

    r7937 r12374  
    3636    }
    3737
     38    /**
     39     * Create a new {@link ViewportData}
     40     * @param bounds The bounds to zoom to
     41     */
    3842    public ViewportData(ProjectionBounds bounds) {
    3943        CheckParameterUtil.ensureParameterNotNull(bounds);
Note: See TracChangeset for help on using the changeset viewer.