Last change
on this file since 2198 was 2198, checked in by Gubaer, 15 years ago |
fixed #3249: Resolve conflicts between invisible and deleted primitives automatically
|
File size:
2.0 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.conflict;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * Represents a conflict between two {@see OsmPrimitive}s. It is represented as
|
---|
8 | * a pair of {@see OsmPrimitive}s where one element of the pair has the role <em>my</em>
|
---|
9 | * and the other has the role <em>their</em>.
|
---|
10 | * <ul>
|
---|
11 | * <li><code>my</code> is the {@see OsmPrimitive} in the local dataset</li>
|
---|
12 | * <li><code>their</code> is the {@see OsmPrimitive} which caused the conflict when it
|
---|
13 | * it was tried to merge it onto <code>my</code>. <code>their</code> is usually the
|
---|
14 | * {@see OsmPrimitive} from the dataset in another layer or the one retrieved from the server.</li>
|
---|
15 | * </ul>
|
---|
16 | *
|
---|
17 | *
|
---|
18 | */
|
---|
19 | public class Conflict<T extends OsmPrimitive> {
|
---|
20 | private T my;
|
---|
21 | private T their;
|
---|
22 |
|
---|
23 | public Conflict(T my, T their) {
|
---|
24 | this.my = my;
|
---|
25 | this.their = their;
|
---|
26 | }
|
---|
27 |
|
---|
28 | public T getMy() {
|
---|
29 | return my;
|
---|
30 | }
|
---|
31 |
|
---|
32 | public T getTheir() {
|
---|
33 | return their;
|
---|
34 | }
|
---|
35 |
|
---|
36 | public boolean isMatchingMy(OsmPrimitive my) {
|
---|
37 | return this.my == my;
|
---|
38 | }
|
---|
39 |
|
---|
40 | public boolean isMatchingTheir(OsmPrimitive their) {
|
---|
41 | return this.their == their;
|
---|
42 | }
|
---|
43 |
|
---|
44 | @Override
|
---|
45 | public int hashCode() {
|
---|
46 | final int prime = 31;
|
---|
47 | int result = 1;
|
---|
48 | result = prime * result + ((my == null) ? 0 : my.hashCode());
|
---|
49 | result = prime * result + ((their == null) ? 0 : their.hashCode());
|
---|
50 | return result;
|
---|
51 | }
|
---|
52 |
|
---|
53 | @SuppressWarnings("unchecked")
|
---|
54 | @Override
|
---|
55 | public boolean equals(Object obj) {
|
---|
56 | if (this == obj)
|
---|
57 | return true;
|
---|
58 | if (obj == null)
|
---|
59 | return false;
|
---|
60 | if (getClass() != obj.getClass())
|
---|
61 | return false;
|
---|
62 | Conflict<T> other = (Conflict<T>) obj;
|
---|
63 | if (my != other.my)
|
---|
64 | return false;
|
---|
65 | if(their != other.their)
|
---|
66 | return false;
|
---|
67 | return true;
|
---|
68 | }
|
---|
69 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.