Class PropertiesMergeModel
- java.lang.Object
-
- org.openstreetmap.josm.gui.util.ChangeNotifier
-
- org.openstreetmap.josm.gui.conflict.pair.properties.PropertiesMergeModel
-
public class PropertiesMergeModel extends ChangeNotifier
This is the model for resolving conflicts in the properties of theOsmPrimitive
s. In particular, it represents conflicts in the coordinates ofNode
s and the deleted or visible state ofOsmPrimitive
s. This model is aChangeNotifier
. It notifies registeredChangeListener
s whenever the internal state changes. This model also emits property changes forRESOLVED_COMPLETELY_PROP
. Property change listeners may register themselves usingaddPropertyChangeListener(PropertyChangeListener)
.
-
-
Field Summary
Fields Modifier and Type Field Description private MergeDecisionType
coordMergeDecision
static java.lang.String
DELETE_PRIMITIVE_PROP
private MergeDecisionType
deletedMergeDecision
private OsmPrimitive
my
private LatLon
myCoords
private boolean
myDeletedState
private java.util.List<OsmPrimitive>
myReferrers
static java.lang.String
RESOLVED_COMPLETELY_PROP
private java.lang.Boolean
resolvedCompletely
private java.beans.PropertyChangeSupport
support
private LatLon
theirCoords
private boolean
theirDeletedState
private java.util.List<OsmPrimitive>
theirReferrers
-
Constructor Summary
Constructors Constructor Description PropertiesMergeModel()
Constructs a newPropertiesMergeModel
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
java.util.List<Command>
buildResolveCommand(Conflict<? extends OsmPrimitive> conflict)
Builds the command(s) to apply the conflict resolutions to my primitivevoid
decideCoordsConflict(MergeDecisionType decision)
Decides a conflict between local and server coordinatesvoid
decideDeletedStateConflict(MergeDecisionType decision)
decides the conflict between two deleted statesvoid
fireCompletelyResolved()
LatLon
getMergedCoords()
replies the coordinates of the mergedOsmPrimitive
.java.lang.Boolean
getMergedDeletedState()
Replies deleted state of combined datasetprivate boolean
getMergedDeletedState(MergeDecisionType decision)
LatLon
getMyCoords()
replies the coordinates of myOsmPrimitive
.java.lang.Boolean
getMyDeletedState()
Replies deleted state of local datasetOsmPrimitive
getMyPrimitive()
java.util.List<OsmPrimitive>
getMyReferrers()
Returns local referrersLatLon
getTheirCoords()
replies the coordinates of theirOsmPrimitive
.java.lang.Boolean
getTheirDeletedState()
Replies deleted state of Server datasetjava.util.List<OsmPrimitive>
getTheirReferrers()
Returns server referrersboolean
hasCoordConflict()
replies true if my and their primitive have a conflict between their coordinate valuesboolean
hasDeletedStateConflict()
replies true if my and their primitive have a conflict between their deleted statesboolean
isCoordMergeDecision(MergeDecisionType decision)
replies true if the current decision for the coordinate conflict isdecision
boolean
isDecidedCoord()
replies true if there is a coordinate conflict and if this conflict is resolvedboolean
isDecidedDeletedState()
replies true if there is a conflict in the deleted state and if this conflict is resolvedboolean
isDeletedStateDecision(MergeDecisionType decision)
replies true if the current decision for the deleted state conflict isdecision
boolean
isResolvedCompletely()
replies true if all conflict in this model are resolvedvoid
populate(Conflict<? extends OsmPrimitive> conflict)
Populates the model with the differences between local and server versionvoid
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
-
Methods inherited from class org.openstreetmap.josm.gui.util.ChangeNotifier
addChangeListener, fireStateChanged, removeChangeListener
-
-
-
-
Field Detail
-
RESOLVED_COMPLETELY_PROP
public static final java.lang.String RESOLVED_COMPLETELY_PROP
-
DELETE_PRIMITIVE_PROP
public static final java.lang.String DELETE_PRIMITIVE_PROP
-
my
private OsmPrimitive my
-
theirCoords
private LatLon theirCoords
-
coordMergeDecision
private MergeDecisionType coordMergeDecision
-
myDeletedState
private boolean myDeletedState
-
theirDeletedState
private boolean theirDeletedState
-
myReferrers
private java.util.List<OsmPrimitive> myReferrers
-
theirReferrers
private java.util.List<OsmPrimitive> theirReferrers
-
deletedMergeDecision
private MergeDecisionType deletedMergeDecision
-
support
private final java.beans.PropertyChangeSupport support
-
resolvedCompletely
private java.lang.Boolean resolvedCompletely
-
-
Constructor Detail
-
PropertiesMergeModel
public PropertiesMergeModel()
Constructs a newPropertiesMergeModel
.
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
-
fireCompletelyResolved
public void fireCompletelyResolved()
-
isDecidedCoord
public boolean isDecidedCoord()
replies true if there is a coordinate conflict and if this conflict is resolved- Returns:
- true if there is a coordinate conflict and if this conflict is resolved; false, otherwise
-
isDecidedDeletedState
public boolean isDecidedDeletedState()
replies true if there is a conflict in the deleted state and if this conflict is resolved- Returns:
- true if there is a conflict in the deleted state and if this conflict is resolved; false, otherwise
-
isCoordMergeDecision
public boolean isCoordMergeDecision(MergeDecisionType decision)
replies true if the current decision for the coordinate conflict isdecision
- Parameters:
decision
- conflict resolution decision- Returns:
- true if the current decision for the coordinate conflict is
decision
; false, otherwise
-
isDeletedStateDecision
public boolean isDeletedStateDecision(MergeDecisionType decision)
replies true if the current decision for the deleted state conflict isdecision
- Parameters:
decision
- conflict resolution decision- Returns:
- true if the current decision for the deleted state conflict is
decision
; false, otherwise
-
populate
public void populate(Conflict<? extends OsmPrimitive> conflict)
Populates the model with the differences between local and server version- Parameters:
conflict
- The conflict information
-
getMyCoords
public LatLon getMyCoords()
replies the coordinates of myOsmPrimitive
. null, if my primitive hasn't coordinates (i.e. because it is aWay
).- Returns:
- the coordinates of my
OsmPrimitive
. null, if my primitive hasn't coordinates (i.e. because it is aWay
).
-
getTheirCoords
public LatLon getTheirCoords()
replies the coordinates of theirOsmPrimitive
. null, if their primitive hasn't coordinates (i.e. because it is aWay
).- Returns:
- the coordinates of my
OsmPrimitive
. null, if my primitive hasn't coordinates (i.e. because it is aWay
).
-
getMergedCoords
public LatLon getMergedCoords()
replies the coordinates of the mergedOsmPrimitive
. null, if the current primitives have no coordinates or if the conflict is yetMergeDecisionType.UNDECIDED
- Returns:
- the coordinates of the merged
OsmPrimitive
. null, if the current primitives have no coordinates or if the conflict is yetMergeDecisionType.UNDECIDED
-
decideCoordsConflict
public void decideCoordsConflict(MergeDecisionType decision)
Decides a conflict between local and server coordinates- Parameters:
decision
- the decision
-
getMyDeletedState
public java.lang.Boolean getMyDeletedState()
Replies deleted state of local dataset- Returns:
- The state of deleted flag
-
getTheirDeletedState
public java.lang.Boolean getTheirDeletedState()
Replies deleted state of Server dataset- Returns:
- The state of deleted flag
-
getMergedDeletedState
public java.lang.Boolean getMergedDeletedState()
Replies deleted state of combined dataset- Returns:
- The state of deleted flag
-
getMyReferrers
public java.util.List<OsmPrimitive> getMyReferrers()
Returns local referrers- Returns:
- The referrers
-
getTheirReferrers
public java.util.List<OsmPrimitive> getTheirReferrers()
Returns server referrers- Returns:
- The referrers
-
getMergedDeletedState
private boolean getMergedDeletedState(MergeDecisionType decision)
-
decideDeletedStateConflict
public void decideDeletedStateConflict(MergeDecisionType decision)
decides the conflict between two deleted states- Parameters:
decision
- the decision (must not be null)- Throws:
java.lang.IllegalArgumentException
- if decision is null
-
hasCoordConflict
public boolean hasCoordConflict()
replies true if my and their primitive have a conflict between their coordinate values- Returns:
- true if my and their primitive have a conflict between their coordinate values; false otherwise
-
hasDeletedStateConflict
public boolean hasDeletedStateConflict()
replies true if my and their primitive have a conflict between their deleted states- Returns:
true
if my and their primitive have a conflict between their deleted states
-
isResolvedCompletely
public boolean isResolvedCompletely()
replies true if all conflict in this model are resolved- Returns:
true
if all conflict in this model are resolved;false
otherwise
-
buildResolveCommand
public java.util.List<Command> buildResolveCommand(Conflict<? extends OsmPrimitive> conflict)
Builds the command(s) to apply the conflict resolutions to my primitive- Parameters:
conflict
- The conflict information- Returns:
- The list of commands
-
getMyPrimitive
public OsmPrimitive getMyPrimitive()
-
-