public class ConflictCollection extends java.lang.Object implements java.lang.Iterable<Conflict<? extends OsmPrimitive>>
Conflict
s. This collection is Iterable
, i.e.
it can be used in for
-loops as follows:
ConflictCollection conflictCollection = .... for (Conflict c : conflictCollection) { // do something }This collection emits an event when the content of the collection changes. You can register and unregister for these events using:
Modifier and Type | Field and Description |
---|---|
private java.util.List<Conflict<? extends OsmPrimitive>> |
conflicts |
private java.util.concurrent.CopyOnWriteArrayList<IConflictListener> |
listeners |
Constructor and Description |
---|
ConflictCollection()
Constructs a new
ConflictCollection . |
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Collection<Conflict<?>> otherConflicts)
Add the conflicts in
otherConflicts to this collection of conflicts |
void |
add(Conflict<?> conflict)
Adds a conflict to the collection of conflicts.
|
void |
add(ConflictCollection other)
Adds all conflicts from another collection.
|
void |
add(OsmPrimitive my,
OsmPrimitive their)
|
protected void |
addConflict(Conflict<?> conflict)
Adds a conflict to the collection
|
void |
addConflictListener(IConflictListener listener)
Adds the specified conflict listener, if not already present.
|
boolean |
equals(java.lang.Object obj) |
protected void |
fireConflictAdded() |
protected void |
fireConflictRemoved() |
java.util.List<Conflict<?>> |
get()
Replies the conflicts as list.
|
Conflict<?> |
get(int idx)
Replies the conflict at position
idx |
Conflict<?> |
getConflictForMy(OsmPrimitive my)
Replies the conflict for the
OsmPrimitive my , null
if no such conflict exists. |
Conflict<?> |
getConflictForTheir(OsmPrimitive their)
Replies the conflict for the
OsmPrimitive their , null
if no such conflict exists. |
java.util.Set<OsmPrimitive> |
getMyConflictParties()
Replies the set of
OsmPrimitive which participate in the role
of "my" in the conflicts managed by this collection. |
java.util.Collection<Conflict<? extends OsmPrimitive>> |
getNodeConflicts()
Returns the list of conflicts involving nodes.
|
java.util.Collection<Conflict<? extends OsmPrimitive>> |
getRelationConflicts()
Returns the list of conflicts involving nodes.
|
java.util.Set<OsmPrimitive> |
getTheirConflictParties()
Replies the set of
OsmPrimitive which participate in the role
of "their" in the conflicts managed by this collection. |
java.util.Collection<Conflict<? extends OsmPrimitive>> |
getWayConflicts()
Returns the list of conflicts involving nodes.
|
boolean |
hasConflict(Conflict<?> c)
Replies true, if this collection includes a given conflict
|
boolean |
hasConflictForMy(OsmPrimitive my)
Replies true, if this collection includes a conflict for
my . |
boolean |
hasConflictForTheir(OsmPrimitive their)
Replies true, if this collection includes a conflict for
their . |
int |
hashCode() |
boolean |
isEmpty()
Replies true if this collection is empty
|
java.util.Iterator<Conflict<?>> |
iterator()
Replies the iterator for this collection.
|
void |
remove(Conflict<?> conflict)
removes a conflict from this collection
|
void |
remove(OsmPrimitive my)
removes the conflict registered for
OsmPrimitive my if any |
void |
removeConflictListener(IConflictListener listener)
Removes the specified conflict listener.
|
void |
removeForMy(OsmPrimitive my)
Removes any conflicts for the
OsmPrimitive my . |
void |
removeForTheir(OsmPrimitive their)
Removes any conflicts for the
OsmPrimitive their . |
int |
size()
Replies the size of the collection
|
java.lang.String |
toString() |
private final java.util.List<Conflict<? extends OsmPrimitive>> conflicts
private final java.util.concurrent.CopyOnWriteArrayList<IConflictListener> listeners
public ConflictCollection()
ConflictCollection
.public void addConflictListener(IConflictListener listener)
listener
- The conflict listener to addpublic void removeConflictListener(IConflictListener listener)
listener
- The conflict listener to removeprotected void fireConflictAdded()
protected void fireConflictRemoved()
protected void addConflict(Conflict<?> conflict)
conflict
- the conflictjava.lang.IllegalStateException
- if this collection already includes a conflict for conflict.getMy()public void add(Conflict<?> conflict)
conflict
- the conflict to add. Must not be null.java.lang.IllegalArgumentException
- if conflict is nulljava.lang.IllegalStateException
- if this collection already includes a conflict for conflict.getMy()public void add(java.util.Collection<Conflict<?>> otherConflicts)
otherConflicts
to this collection of conflictsotherConflicts
- the collection of conflicts. Does nothing is conflicts is null.public void add(OsmPrimitive my, OsmPrimitive their)
my
- my primitivetheir
- their primitivepublic void remove(Conflict<?> conflict)
conflict
- the conflictpublic void remove(OsmPrimitive my)
OsmPrimitive
my
if anymy
- the primitivepublic Conflict<?> getConflictForMy(OsmPrimitive my)
OsmPrimitive
my
, null
if no such conflict exists.my
- my primitiveOsmPrimitive
my
, null
if no such conflict exists.public Conflict<?> getConflictForTheir(OsmPrimitive their)
OsmPrimitive
their
, null
if no such conflict exists.their
- their primitiveOsmPrimitive
their
, null
if no such conflict exists.public boolean hasConflictForMy(OsmPrimitive my)
my
.my
- my primitivemy
; false, otherwisepublic boolean hasConflict(Conflict<?> c)
c
- the conflictpublic boolean hasConflictForTheir(OsmPrimitive their)
their
.their
- their primitivetheir
; false, otherwisepublic void removeForMy(OsmPrimitive my)
OsmPrimitive
my
.my
- the primitivepublic void removeForTheir(OsmPrimitive their)
OsmPrimitive
their
.their
- the primitivepublic java.util.List<Conflict<?>> get()
public int size()
public Conflict<?> get(int idx)
idx
idx
- the indexidx
public java.util.Iterator<Conflict<?>> iterator()
iterator
in interface java.lang.Iterable<Conflict<? extends OsmPrimitive>>
public void add(ConflictCollection other)
other
- The other collection of conflicts to addpublic java.util.Set<OsmPrimitive> getMyConflictParties()
OsmPrimitive
which participate in the role
of "my" in the conflicts managed by this collection.OsmPrimitive
which participate in the role
of "my" in the conflicts managed by this collection.public java.util.Set<OsmPrimitive> getTheirConflictParties()
OsmPrimitive
which participate in the role
of "their" in the conflicts managed by this collection.OsmPrimitive
which participate in the role
of "their" in the conflicts managed by this collection.public boolean isEmpty()
public java.lang.String toString()
toString
in class java.lang.Object
public final java.util.Collection<Conflict<? extends OsmPrimitive>> getNodeConflicts()
public final java.util.Collection<Conflict<? extends OsmPrimitive>> getWayConflicts()
public final java.util.Collection<Conflict<? extends OsmPrimitive>> getRelationConflicts()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object