Last change
on this file since 1857 was 1750, checked in by Gubaer, 15 years ago |
new: replaced global conflict list by conflict list per layer, similar to datasets
|
File size:
1.9 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 if {@see OsmPrimitive} 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 | @Override
|
---|
54 | public boolean equals(Object obj) {
|
---|
55 | if (this == obj)
|
---|
56 | return true;
|
---|
57 | if (obj == null)
|
---|
58 | return false;
|
---|
59 | if (getClass() != obj.getClass())
|
---|
60 | return false;
|
---|
61 | Conflict<T> other = (Conflict) obj;
|
---|
62 | if (my != other.my)
|
---|
63 | return false;
|
---|
64 | if(their != other.their)
|
---|
65 | return false;
|
---|
66 | return true;
|
---|
67 | }
|
---|
68 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.