Class ConflictCollection
java.lang.Object
org.openstreetmap.josm.data.conflict.ConflictCollection
- All Implemented Interfaces:
Iterable<Conflict<? extends OsmPrimitive>>
public class ConflictCollection
extends Object
implements Iterable<Conflict<? extends OsmPrimitive>>
This is a collection of
Conflicts. 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<Conflict<? extends OsmPrimitive>>private final CopyOnWriteArrayList<IConflictListener> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Collection<Conflict<?>> otherConflicts) Add the conflicts inotherConflictsto this collection of conflictsvoidAdds a conflict to the collection of conflicts.voidadd(ConflictCollection other) Adds all conflicts from another collection.voidadd(OsmPrimitive my, OsmPrimitive their) protected voidaddConflict(Conflict<?> conflict) Adds a conflict to the collectionvoidaddConflictListener(IConflictListener listener) Adds the specified conflict listener, if not already present.booleanprotected voidprotected voidget()Replies the conflicts as list.Conflict<?>get(int idx) Replies the conflict at positionidxConflict<?>Replies the conflict for theOsmPrimitivemy, null if no such conflict exists.Conflict<?>getConflictForTheir(OsmPrimitive their) Replies the conflict for theOsmPrimitivetheir, null if no such conflict exists.Replies the set ofOsmPrimitivewhich participate in the role of "my" in the conflicts managed by this collection.final Collection<Conflict<? extends OsmPrimitive>>Returns the list of conflicts involving nodes.private longgetNumberOfConflicts(Predicate<Conflict<?>> predicate) final longReturns the number of conflicts involving nodes.final longReturns the number of conflicts involving nodes.final longReturns the number of conflicts involving nodes.final Collection<Conflict<? extends OsmPrimitive>>Returns the list of conflicts involving relations.Replies the set ofOsmPrimitivewhich participate in the role of "their" in the conflicts managed by this collection.final Collection<Conflict<? extends OsmPrimitive>>Returns the list of conflicts involving ways.booleanhasConflict(Conflict<?> c) Replies true, if this collection includes a given conflictbooleanReplies true, if this collection includes a conflict formy.booleanhasConflictForTheir(OsmPrimitive their) Replies true, if this collection includes a conflict fortheir.inthashCode()booleanisEmpty()Replies true if this collection is emptyiterator()Replies the iterator for this collection.voidremoves a conflict from this collectionvoidremoveConflictListener(IConflictListener listener) Removes the specified conflict listener.voidRemoves any conflicts for theOsmPrimitivemy.voidremoveForTheir(OsmPrimitive their) Removes any conflicts for theOsmPrimitivetheir.intsize()Replies the size of the collectiontoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
conflicts
-
listeners
-
-
Constructor Details
-
ConflictCollection
public ConflictCollection()Constructs a newConflictCollection.
-
-
Method Details
-
addConflictListener
Adds the specified conflict listener, if not already present.- Parameters:
listener- The conflict listener to add
-
removeConflictListener
Removes the specified conflict listener.- Parameters:
listener- The conflict listener to remove
-
fireConflictAdded
-
fireConflictRemoved
-
addConflict
Adds a conflict to the collection- Parameters:
conflict- the conflict- Throws:
IllegalStateException- if this collection already includes a conflict for conflict.getMy()
-
add
Adds a conflict to the collection of conflicts.- Parameters:
conflict- the conflict to add. Must not be null.- Throws:
IllegalArgumentException- if conflict is nullIllegalStateException- if this collection already includes a conflict for conflict.getMy()
-
add
Add the conflicts inotherConflictsto this collection of conflicts- Parameters:
otherConflicts- the collection of conflicts. Does nothing is conflicts is null.
-
add
- Parameters:
my- my primitivetheir- their primitive
-
remove
removes a conflict from this collection- Parameters:
conflict- the conflict
-
getConflictForMy
Replies the conflict for theOsmPrimitivemy, null if no such conflict exists.- Parameters:
my- my primitive- Returns:
- the conflict for the
OsmPrimitivemy, null if no such conflict exists.
-
getConflictForTheir
Replies the conflict for theOsmPrimitivetheir, null if no such conflict exists.- Parameters:
their- their primitive- Returns:
- the conflict for the
OsmPrimitivetheir, null if no such conflict exists.
-
hasConflictForMy
Replies true, if this collection includes a conflict formy.- Parameters:
my- my primitive- Returns:
- true, if this collection includes a conflict for
my; false, otherwise
-
hasConflict
Replies true, if this collection includes a given conflict- Parameters:
c- the conflict- Returns:
- true, if this collection includes the conflict; false, otherwise
-
hasConflictForTheir
Replies true, if this collection includes a conflict fortheir.- Parameters:
their- their primitive- Returns:
- true, if this collection includes a conflict for
their; false, otherwise
-
removeForMy
Removes any conflicts for theOsmPrimitivemy.- Parameters:
my- the primitive
-
removeForTheir
Removes any conflicts for theOsmPrimitivetheir.- Parameters:
their- the primitive
-
get
Replies the conflicts as list.- Returns:
- the list of conflicts
-
size
Replies the size of the collection- Returns:
- the size of the collection
-
get
Replies the conflict at positionidx- Parameters:
idx- the index- Returns:
- the conflict at position
idx
-
iterator
Replies the iterator for this collection.- Specified by:
iteratorin interfaceIterable<Conflict<? extends OsmPrimitive>>- Returns:
- the iterator
-
add
Adds all conflicts from another collection.- Parameters:
other- The other collection of conflicts to add
-
getMyConflictParties
Replies the set ofOsmPrimitivewhich participate in the role of "my" in the conflicts managed by this collection.- Returns:
- the set of
OsmPrimitivewhich participate in the role of "my" in the conflicts managed by this collection.
-
getTheirConflictParties
Replies the set ofOsmPrimitivewhich participate in the role of "their" in the conflicts managed by this collection.- Returns:
- the set of
OsmPrimitivewhich participate in the role of "their" in the conflicts managed by this collection.
-
isEmpty
Replies true if this collection is empty- Returns:
- true, if this collection is empty; false, otherwise
-
toString
-
getNodeConflicts
Returns the list of conflicts involving nodes.- Returns:
- The list of conflicts involving nodes.
- Since:
- 6555
-
getWayConflicts
Returns the list of conflicts involving ways.- Returns:
- The list of conflicts involving ways.
- Since:
- 6555
-
getRelationConflicts
Returns the list of conflicts involving relations.- Returns:
- The list of conflicts involving relations.
- Since:
- 6555
-
getNumberOfNodeConflicts
Returns the number of conflicts involving nodes.- Returns:
- The number of conflicts involving nodes.
- Since:
- 17524
-
getNumberOfWayConflicts
Returns the number of conflicts involving nodes.- Returns:
- The number of conflicts involving nodes.
- Since:
- 17524
-
getNumberOfRelationConflicts
Returns the number of conflicts involving nodes.- Returns:
- The number of conflicts involving nodes.
- Since:
- 17524
-
getNumberOfConflicts
-
hashCode
-
equals
-