1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm;
|
---|
3 |
|
---|
4 | import java.util.Comparator;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * Comparators for comparing {@link OsmPrimitive}.
|
---|
8 | * @since 4113
|
---|
9 | */
|
---|
10 | public final class OsmPrimitiveComparator {
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Returns a comparator comparing primitives by their name using {@link DefaultNameFormatter}.
|
---|
14 | *
|
---|
15 | * {@linkplain DefaultNameFormatter#format(IPrimitive) Formatted names} are cached.
|
---|
16 | *
|
---|
17 | * @return a comparator comparing primitives by their name using {@link DefaultNameFormatter}
|
---|
18 | */
|
---|
19 | public static Comparator<OsmPrimitive> comparingNames() {
|
---|
20 | return PrimitiveComparator.doComparingNames();
|
---|
21 | }
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Returns a comparator comparing primitives by their {@linkplain OsmPrimitive#getUniqueId unique id}.
|
---|
25 | *
|
---|
26 | * @return a comparator comparing primitives by their {@linkplain OsmPrimitive#getUniqueId unique id}.
|
---|
27 | */
|
---|
28 | public static Comparator<OsmPrimitive> comparingUniqueId() {
|
---|
29 | return PrimitiveComparator.doComparingUniqueId();
|
---|
30 | }
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Returns a comparator ordering the primitives by type in the order NODE, WAY, RELATION
|
---|
34 | *
|
---|
35 | * @return a comparator ordering the primitives by type in the order NODE, WAY, RELATION
|
---|
36 | */
|
---|
37 | public static Comparator<OsmPrimitive> orderingNodesWaysRelations() {
|
---|
38 | return PrimitiveComparator.doOrderingNodesWaysRelations();
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Returns a comparator ordering the primitives by type in the order WAY, RELATION, NODE
|
---|
43 | *
|
---|
44 | * @return a comparator ordering the primitives by type in the order WAY, RELATION, NODE
|
---|
45 | */
|
---|
46 | public static Comparator<OsmPrimitive> orderingWaysRelationsNodes() {
|
---|
47 | return PrimitiveComparator.doOrderingWaysRelationsNodes();
|
---|
48 | }
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Returns a comparator ordering the primitives by type in the order RELATION, WAY, NODE
|
---|
52 | *
|
---|
53 | * @return a comparator ordering the primitives by type in the order RELATION, WAY, NODE
|
---|
54 | * @since 11679
|
---|
55 | */
|
---|
56 | public static Comparator<OsmPrimitive> orderingRelationsWaysNodes() {
|
---|
57 | return PrimitiveComparator.doOrderingRelationsWaysNodes();
|
---|
58 | }
|
---|
59 |
|
---|
60 | private OsmPrimitiveComparator() {
|
---|
61 | }
|
---|
62 | }
|
---|