public class PropertiesMergeModel extends Observable
OsmPrimitives. In particular, it represents conflicts in the coordinates of Nodes and
the deleted or visible state of OsmPrimitives.
This model is an Observable. It notifies registered Observers whenever the
internal state changes.
This model also emits property changes for RESOLVED_COMPLETELY_PROP. Property change
listeners may register themselves using addPropertyChangeListener(PropertyChangeListener).| Modifier and Type | Field and Description |
|---|---|
private MergeDecisionType |
coordMergeDecision |
static String |
DELETE_PRIMITIVE_PROP |
private MergeDecisionType |
deletedMergeDecision |
private OsmPrimitive |
my |
private LatLon |
myCoords |
private boolean |
myDeletedState |
private List<OsmPrimitive> |
myReferrers |
static String |
RESOLVED_COMPLETELY_PROP |
private Boolean |
resolvedCompletely |
private PropertyChangeSupport |
support |
private LatLon |
theirCoords |
private boolean |
theirDeletedState |
private List<OsmPrimitive> |
theirReferrers |
| Constructor and Description |
|---|
PropertiesMergeModel()
Constructs a new
PropertiesMergeModel. |
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
List<Command> |
buildResolveCommand(Conflict<? extends OsmPrimitive> conflict)
Builds the command(s) to apply the conflict resolutions to my primitive
|
void |
decideCoordsConflict(MergeDecisionType decision)
Decides a conflict between local and server coordinates
|
void |
decideDeletedStateConflict(MergeDecisionType decision)
decides the conflict between two deleted states
|
void |
fireCompletelyResolved() |
LatLon |
getMergedCoords()
replies the coordinates of the merged
OsmPrimitive. |
Boolean |
getMergedDeletedState()
Replies deleted state of combined dataset
|
private boolean |
getMergedDeletedState(MergeDecisionType decision) |
LatLon |
getMyCoords()
replies the coordinates of my
OsmPrimitive. |
Boolean |
getMyDeletedState()
Replies deleted state of local dataset
|
OsmPrimitive |
getMyPrimitive() |
List<OsmPrimitive> |
getMyReferrers()
Returns local referrers
|
LatLon |
getTheirCoords()
replies the coordinates of their
OsmPrimitive. |
Boolean |
getTheirDeletedState()
Replies deleted state of Server dataset
|
List<OsmPrimitive> |
getTheirReferrers()
Returns server referrers
|
boolean |
hasCoordConflict()
replies true if my and their primitive have a conflict between
their coordinate values
|
boolean |
hasDeletedStateConflict()
replies true if my and their primitive have a conflict between
their deleted states
|
boolean |
isCoordMergeDecision(MergeDecisionType decision)
replies true if the current decision for the coordinate conflict is
decision |
boolean |
isDecidedCoord()
replies true if there is a coordinate conflict and if this conflict is resolved
|
boolean |
isDecidedDeletedState()
replies true if there is a conflict in the deleted state and if this conflict is resolved
|
boolean |
isDeletedStateDecision(MergeDecisionType decision)
replies true if the current decision for the deleted state conflict is
decision |
boolean |
isResolvedCompletely()
replies true if all conflict in this model are resolved
|
void |
populate(Conflict<? extends OsmPrimitive> conflict)
Populates the model with the differences between local and server version
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedpublic static final String RESOLVED_COMPLETELY_PROP
public static final String DELETE_PRIMITIVE_PROP
private OsmPrimitive my
private LatLon theirCoords
private MergeDecisionType coordMergeDecision
private boolean myDeletedState
private boolean theirDeletedState
private List<OsmPrimitive> myReferrers
private List<OsmPrimitive> theirReferrers
private MergeDecisionType deletedMergeDecision
private final PropertyChangeSupport support
private Boolean resolvedCompletely
public PropertiesMergeModel()
PropertiesMergeModel.public void addPropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void fireCompletelyResolved()
public boolean isDecidedCoord()
public boolean isDecidedDeletedState()
public boolean isCoordMergeDecision(MergeDecisionType decision)
decisiondecision - conflict resolution decisiondecision;
false, otherwisepublic boolean isDeletedStateDecision(MergeDecisionType decision)
decisiondecision - conflict resolution decisiondecision;
false, otherwisepublic void populate(Conflict<? extends OsmPrimitive> conflict)
conflict - The conflict informationpublic LatLon getMyCoords()
OsmPrimitive. null, if my primitive hasn't
coordinates (i.e. because it is a Way).OsmPrimitive. null, if my primitive hasn't
coordinates (i.e. because it is a Way).public LatLon getTheirCoords()
OsmPrimitive. null, if their primitive hasn't
coordinates (i.e. because it is a Way).OsmPrimitive. null, if my primitive hasn't
coordinates (i.e. because it is a Way).public LatLon getMergedCoords()
OsmPrimitive. null, if the current primitives
have no coordinates or if the conflict is yet MergeDecisionType.UNDECIDEDOsmPrimitive. null, if the current primitives
have no coordinates or if the conflict is yet MergeDecisionType.UNDECIDEDpublic void decideCoordsConflict(MergeDecisionType decision)
decision - the decisionpublic Boolean getMyDeletedState()
public Boolean getTheirDeletedState()
public Boolean getMergedDeletedState()
public List<OsmPrimitive> getMyReferrers()
public List<OsmPrimitive> getTheirReferrers()
private boolean getMergedDeletedState(MergeDecisionType decision)
public void decideDeletedStateConflict(MergeDecisionType decision)
decision - the decision (must not be null)IllegalArgumentException - if decision is nullpublic boolean hasCoordConflict()
public boolean hasDeletedStateConflict()
true if my and their primitive have a conflict between
their deleted statespublic boolean isResolvedCompletely()
true if all conflict in this model are resolved; false otherwisepublic List<Command> buildResolveCommand(Conflict<? extends OsmPrimitive> conflict)
conflict - The conflict informationpublic OsmPrimitive getMyPrimitive()