Changeset 9203 in josm for trunk/src


Ignore:
Timestamp:
2015-12-28T19:15:45+01:00 (8 years ago)
Author:
Don-vip
Message:

add more unit tests, javadoc

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

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

    r8510 r9203  
    44import java.util.Comparator;
    55
     6/**
     7 * Formats a name for a {@link OsmPrimitive}.
     8 * @since 1990
     9 */
    610public interface NameFormatter {
     11
     12    /**
     13     * Formats a name for a {@link Node}.
     14     *
     15     * @param node the node
     16     * @return the name
     17     */
    718    String format(Node node);
    819
     20    /**
     21     * Formats a name for a {@link Way}.
     22     *
     23     * @param way the way
     24     * @return the name
     25     */
    926    String format(Way way);
    1027
     28    /**
     29     * Formats a name for a {@link Relation}.
     30     *
     31     * @param relation the relation
     32     * @return the name
     33     */
    1134    String format(Relation relation);
    1235
     36    /**
     37     * Formats a name for a {@link Changeset}.
     38     *
     39     * @param changeset the changeset
     40     * @return the name
     41     */
    1342    String format(Changeset changeset);
    1443
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNameFormatter.java

    r8510 r9203  
    22package org.openstreetmap.josm.data.osm.history;
    33
     4/**
     5 * Formats a name for a {@link HistoryOsmPrimitive}.
     6 * @since 2686
     7 */
    48public interface HistoryNameFormatter {
     9
     10    /**
     11     * Formats a name for a {@link HistoryNode}.
     12     *
     13     * @param node the node
     14     * @return the name
     15     */
    516    String format(HistoryNode node);
    617
    7     String format(HistoryWay node);
     18    /**
     19     * Formats a name for a {@link HistoryWay}.
     20     *
     21     * @param way the way
     22     * @return the name
     23     */
     24    String format(HistoryWay way);
    825
    9     String format(HistoryRelation node);
     26    /**
     27     * Formats a name for a {@link HistoryRelation}.
     28     *
     29     * @param relation the relation
     30     * @return the name
     31     */
     32    String format(HistoryRelation relation);
    1033}
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r8882 r9203  
    4545
    4646/**
    47  * This is the default implementation of a {@link NameFormatter} for names of {@link OsmPrimitive}s.
    48  *
     47 * This is the default implementation of a {@link NameFormatter} for names of {@link OsmPrimitive}s
     48 * and {@link HistoryOsmPrimitive}s.
     49 * @since 1990
    4950 */
    5051public class DefaultNameFormatter implements NameFormatter, HistoryNameFormatter {
     
    135136    }
    136137
    137     /**
    138      * Formats a name for a node
    139      *
    140      * @param node the node
    141      * @return the name
    142      */
    143138    @Override
    144139    public String format(Node node) {
     
    211206    }
    212207
    213 
    214     /**
    215      * Formats a name for a way
    216      *
    217      * @param way the way
    218      * @return the name
    219      */
    220208    @Override
    221209    public String format(Way way) {
     
    249237                }
    250238                if (n == null) {
    251                     n =     (way.get("highway") != null) ? tr("highway") :
    252                                 (way.get("railway") != null) ? tr("railway") :
    253                                     (way.get("waterway") != null) ? tr("waterway") :
    254                                             (way.get("landuse") != null) ? tr("landuse") : null;
     239                    n = (way.get("highway") != null) ? tr("highway") :
     240                            (way.get("railway") != null) ? tr("railway") :
     241                                (way.get("waterway") != null) ? tr("waterway") :
     242                                        (way.get("landuse") != null) ? tr("landuse") : null;
    255243                }
    256244                if (n == null) {
     
    313301    }
    314302
    315 
    316     /**
    317      * Formats a name for a relation
    318      *
    319      * @param relation the relation
    320      * @return the name
    321      */
    322303    @Override
    323304    public String format(Relation relation) {
     
    488469    }
    489470
    490     /**
    491      * Formats a name for a changeset
    492      *
    493      * @param changeset the changeset
    494      * @return the name
    495      */
    496471    @Override
    497472    public String format(Changeset changeset) {
     
    554529    }
    555530
    556     /**
    557      * Formats a name for a history node
    558      *
    559      * @param node the node
    560      * @return the name
    561      */
    562531    @Override
    563532    public String format(HistoryNode node) {
     
    586555    }
    587556
    588     /**
    589      * Formats a name for a way
    590      *
    591      * @param way the way
    592      * @return the name
    593      */
    594557    @Override
    595558    public String format(HistoryWay way) {
     
    628591    }
    629592
    630     /**
    631      * Formats a name for a {@link HistoryRelation})
    632      *
    633      * @param relation the relation
    634      * @return the name
    635      */
    636593    @Override
    637594    public String format(HistoryRelation relation) {
     
    684641    }
    685642
     643    /**
     644     * Formats the given collection of primitives as an HTML unordered list.
     645     * @param primitives collection of primitives to format
     646     * @return HTML unordered list
     647     */
    686648    public String formatAsHtmlUnorderedList(Collection<? extends OsmPrimitive> primitives) {
    687649        return Utils.joinAsHtmlUnorderedList(Utils.transform(primitives, new Function<OsmPrimitive, String>() {
     
    694656    }
    695657
     658    /**
     659     * Formats the given primitive(s) as an HTML unordered list.
     660     * @param primitives primitive(s) to format
     661     * @return HTML unordered list
     662     */
    696663    public String formatAsHtmlUnorderedList(OsmPrimitive... primitives) {
    697664        return formatAsHtmlUnorderedList(Arrays.asList(primitives));
Note: See TracChangeset for help on using the changeset viewer.