source: josm/src/org/openstreetmap/josm/data/conflict/SegmentConflict.java@ 298

Last change on this file since 298 was 298, checked in by imi, 17 years ago
  • added license description to head of each source file
File size: 1.1 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.data.conflict;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import org.openstreetmap.josm.data.osm.OsmPrimitive;
7import org.openstreetmap.josm.data.osm.Segment;
8import org.openstreetmap.josm.data.osm.Way;
9
10public class SegmentConflict extends ConflictItem {
11
12 @Override public boolean hasConflict(OsmPrimitive key, OsmPrimitive value) {
13 return key instanceof Way && !((Way)key).segments.equals(((Way)value).segments);
14 }
15
16 @Override protected String str(OsmPrimitive osm) {
17 if (!(osm instanceof Way))
18 return null;
19 String s = "";
20 for (Segment ls : ((Way)osm).segments)
21 s += ls.id + ",";
22 return s.equals("") ? "<html><i>&lt;"+tr("none")+"&gt;</i></html>" : s.substring(0, s.length()-1);
23 }
24
25 @Override public String key() {
26 return "way|"+tr("segments");
27 }
28
29 @Override public void apply(OsmPrimitive target, OsmPrimitive other) {
30 if (!(target instanceof Way))
31 return;
32 ((Way)target).segments.clear();
33 ((Way)target).segments.addAll(((Way)other).segments);
34 }
35}
Note: See TracBrowser for help on using the repository browser.