Changeset 6804 in josm for trunk/src


Ignore:
Timestamp:
2014-02-02T23:35:42+01:00 (6 years ago)
Author:
simon04
Message:

fix #9668 - Sort entries in validation results naturally

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

Legend:

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

    r6538 r6804  
    2525import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
    2626import org.openstreetmap.josm.data.validation.util.MultipleNameVisitor;
     27import org.openstreetmap.josm.tools.AlphanumComparator;
    2728
    2829/**
     
    300301        v1.visit(getPrimitives());
    301302        v2.visit(o.getPrimitives());
    302         return v1.toString().compareToIgnoreCase(v2.toString());
     303        return AlphanumComparator.getInstance().compare(v1.toString(), v2.toString());
    303304    }
    304305
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r6367 r6804  
    356356
    357357    private final Comparator<Relation> relationComparator = new Comparator<Relation>() {
    358         private final AlphanumComparator ALPHANUM_COMPARATOR = new AlphanumComparator();
    359358        @Override
    360359        public int compare(Relation r1, Relation r2) {
     
    378377                String type2 = getRelationTypeName(r2);
    379378
    380                 int comp = ALPHANUM_COMPARATOR.compare(type1, type2);
     379                int comp = AlphanumComparator.getInstance().compare(type1, type2);
    381380                if (comp != 0)
    382381                    return comp;
     
    385384                String name2 = getRelationName(r2);
    386385
    387                 comp = ALPHANUM_COMPARATOR.compare(name1, name2);
     386                comp = AlphanumComparator.getInstance().compare(name1, name2);
    388387                if (comp != 0)
    389388                    return comp;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorter.java

    r6461 r6804  
    5454    private static class AssociatedStreetRoleAddressHouseSorter implements AdditionalSorter {
    5555
    56         public static final AlphanumComparator ALPHANUM_COMPARATOR = new AlphanumComparator();
    57 
    5856        @Override
    5957        public boolean acceptsMember(RelationMember m) {
     
    6664                @Override
    6765                public int compare(RelationMember a, RelationMember b) {
    68                     final int houseNumber = ALPHANUM_COMPARATOR.compare(
     66                    final int houseNumber = AlphanumComparator.getInstance().compare(
    6967                            a.getMember().get("addr:housenumber"),
    7068                            b.getMember().get("addr:housenumber"));
     
    7472                    final String aDisplayName = a.getMember().getDisplayName(DefaultNameFormatter.getInstance());
    7573                    final String bDisplayName = b.getMember().getDisplayName(DefaultNameFormatter.getInstance());
    76                     return ALPHANUM_COMPARATOR.compare(aDisplayName, bDisplayName);
     74                    return AlphanumComparator.getInstance().compare(aDisplayName, bDisplayName);
    7775                }
    7876            });
  • trunk/src/org/openstreetmap/josm/tools/AlphanumComparator.java

    r6126 r6804  
    3939 */
    4040public class AlphanumComparator implements Comparator<String> {
     41
     42    private static final AlphanumComparator INSTANCE = new AlphanumComparator();
     43
     44    public static AlphanumComparator getInstance() {
     45        return INSTANCE;
     46    }
     47
     48    /**
     49     * Constructs a new Alphanum Comparator.
     50     * @deprecated use {@link #getInstance()} instead.
     51     */
     52    @Deprecated
     53    public AlphanumComparator() {
     54    }
    4155
    4256    /**
Note: See TracChangeset for help on using the changeset viewer.