|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.data.conflict.ConflictCollection
public class ConflictCollection
This is a collection of 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:
Field Summary | |
---|---|
private java.util.List<Conflict<? extends OsmPrimitive>> |
conflicts
|
private java.util.concurrent.CopyOnWriteArrayList<IConflictListener> |
listeners
|
Constructor Summary | |
---|---|
ConflictCollection()
|
Method Summary | |
---|---|
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)
|
void |
add(OsmPrimitive my,
OsmPrimitive their)
Adds a conflict for the pair of OsmPrimitive s given by my and
their . |
protected void |
addConflict(Conflict<?> conflict)
Adds a conflict to the collection |
void |
addConflictListener(IConflictListener listener)
|
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.Set<OsmPrimitive> |
getTheirConflictParties()
Replies the set of OsmPrimitive which participate in the role
of "their" in the conflicts managed by this collection. |
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 . |
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)
|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final java.util.List<Conflict<? extends OsmPrimitive>> conflicts
private java.util.concurrent.CopyOnWriteArrayList<IConflictListener> listeners
Constructor Detail |
---|
public ConflictCollection()
Method Detail |
---|
public void addConflictListener(IConflictListener listener)
public void removeConflictListener(IConflictListener listener)
protected void fireConflictAdded()
protected void fireConflictRemoved()
protected void addConflict(Conflict<?> conflict) throws java.lang.IllegalStateException
conflict
- the conflict
java.lang.IllegalStateException
- thrown, if this collection already includes a
conflict for conflict.getMy()public void add(Conflict<?> conflict) throws java.lang.IllegalStateException
conflict
- the conflict to add. Must not be null.
java.lang.IllegalArgumentException
- thrown, if conflict is null
java.lang.IllegalStateException
- thrown if this collection already includes a conflict for conflict.getMy()public void add(java.util.Collection<Conflict<?>> otherConflicts)
otherConflicts
to this collection of conflicts
otherConflicts
- the collection of conflicts. Does nothing is conflicts is null.public void add(OsmPrimitive my, OsmPrimitive their)
OsmPrimitive
s given by my
and
their
.
my
- my primitivetheir
- their primitivepublic void remove(Conflict<?> conflict)
conflict
- the conflictpublic void remove(OsmPrimitive my)
OsmPrimitive
my
if any
my
- the primitivepublic Conflict<?> getConflictForMy(OsmPrimitive my)
OsmPrimitive
my
, null
if no such conflict exists.
my
- my primitive
OsmPrimitive
my
, null
if no such conflict exists.public Conflict<?> getConflictForTheir(OsmPrimitive their)
OsmPrimitive
their
, null
if no such conflict exists.
my
- my primitive
OsmPrimitive
their
, null
if no such conflict exists.public boolean hasConflictForMy(OsmPrimitive my)
my
.
my
- my primitive
my
; false, otherwisepublic boolean hasConflict(Conflict<?> c)
c
- the conflict
public boolean hasConflictForTheir(OsmPrimitive their)
their
.
their
- their primitive
their
; 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 index
idx
public java.util.Iterator<Conflict<?>> iterator()
iterator
in interface java.lang.Iterable<Conflict<? extends OsmPrimitive>>
public void add(ConflictCollection other)
public 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |