public class ConflictCollection extends Object implements 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 | Class and Description |
---|---|
private static class |
ConflictCollection.FilterPredicate |
Modifier and Type | Field and Description |
---|---|
private List<Conflict<? extends OsmPrimitive>> |
conflicts |
private CopyOnWriteArrayList<IConflictListener> |
listeners |
private static ConflictCollection.FilterPredicate |
NODE_FILTER_PREDICATE |
private static ConflictCollection.FilterPredicate |
RELATION_FILTER_PREDICATE |
private static ConflictCollection.FilterPredicate |
WAY_FILTER_PREDICATE |
Constructor and Description |
---|
ConflictCollection()
Constructs a new
ConflictCollection . |
Modifier and Type | Method and Description |
---|---|
void |
add(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(Object obj) |
protected void |
fireConflictAdded() |
protected void |
fireConflictRemoved() |
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. |
Set<OsmPrimitive> |
getMyConflictParties()
Replies the set of
OsmPrimitive which participate in the role
of "my" in the conflicts managed by this collection. |
Collection<Conflict<? extends OsmPrimitive>> |
getNodeConflicts()
Returns the list of conflicts involving nodes.
|
Collection<Conflict<? extends OsmPrimitive>> |
getRelationConflicts()
Returns the list of conflicts involving nodes.
|
Set<OsmPrimitive> |
getTheirConflictParties()
Replies the set of
OsmPrimitive which participate in the role
of "their" in the conflicts managed by this collection. |
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
|
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
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
private final List<Conflict<? extends OsmPrimitive>> conflicts
private final CopyOnWriteArrayList<IConflictListener> listeners
private static final ConflictCollection.FilterPredicate NODE_FILTER_PREDICATE
private static final ConflictCollection.FilterPredicate WAY_FILTER_PREDICATE
private static final ConflictCollection.FilterPredicate RELATION_FILTER_PREDICATE
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 conflictIllegalStateException
- if this collection already includes a conflict for conflict.getMy()public void add(Conflict<?> conflict)
conflict
- the conflict to add. Must not be null.IllegalArgumentException
- if conflict is nullIllegalStateException
- if this collection already includes a conflict for conflict.getMy()public void add(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 int size()
public Conflict<?> get(int idx)
idx
idx
- the indexidx
public Iterator<Conflict<?>> iterator()
iterator
in interface Iterable<Conflict<? extends OsmPrimitive>>
public void add(ConflictCollection other)
other
- The other collection of conflicts to addpublic 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 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 final Collection<Conflict<? extends OsmPrimitive>> getNodeConflicts()
public final Collection<Conflict<? extends OsmPrimitive>> getWayConflicts()
public final Collection<Conflict<? extends OsmPrimitive>> getRelationConflicts()