org.openstreetmap.josm.gui.conflict.pair.tags
Class TagMergeItem

java.lang.Object
  extended by org.openstreetmap.josm.gui.conflict.pair.tags.TagMergeItem

public class TagMergeItem
extends java.lang.Object

TagMergeItem represents an individual merge action for a specific pair of key/value. A TagMergeItem manages the values of the two key/value-pairs and keeps track of the applied merge decision.


Field Summary
private  java.lang.String key
           
private  MergeDecisionType mergeDecision
           
private  java.lang.String myTagValue
           
private  java.lang.String theirTagValue
           
 
Constructor Summary
TagMergeItem(java.lang.String key, OsmPrimitive my, OsmPrimitive their)
          constructor
TagMergeItem(java.lang.String key, java.lang.String myTagValue, java.lang.String theirTagValue)
          constructor
 
Method Summary
 void applyToMyPrimitive(OsmPrimitive primitive)
          applies the current merge decisions to the tag set of an OSM primitive.
 void decide(MergeDecisionType decision)
          applies a merge decision to this merge item
 java.lang.String getKey()
           
 MergeDecisionType getMergeDecision()
           
 java.lang.String getMyTagValue()
           
 java.lang.String getTheirTagValue()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

private java.lang.String key

myTagValue

private java.lang.String myTagValue

theirTagValue

private java.lang.String theirTagValue

mergeDecision

private MergeDecisionType mergeDecision
Constructor Detail

TagMergeItem

public TagMergeItem(java.lang.String key,
                    java.lang.String myTagValue,
                    java.lang.String theirTagValue)
constructor

Parameters:
key - the common tag key. Must not be null.
myTagValue - the value for this key known in the local dataset
theirTagValue - the value for this key known in the dataset on the server
Throws:
java.lang.IllegalArgumentException - if key is null

TagMergeItem

public TagMergeItem(java.lang.String key,
                    OsmPrimitive my,
                    OsmPrimitive their)
constructor

Parameters:
key - the tag key common to the merged OSM primitives. Must not be null.
my - my version of the OSM primitive (i.e. the version known in the local dataset). Must not be null.
their - their version of the OSM primitive (i.e. the version known on the server). Must not be null.
Throws:
java.lang.IllegalArgumentException - thrown if key is null
java.lang.IllegalArgumentException - thrown if my is null
java.lang.IllegalArgumentException - thrown if their is null
Method Detail

decide

public void decide(MergeDecisionType decision)
            throws java.lang.IllegalArgumentException
applies a merge decision to this merge item

Parameters:
decision - the merge decision. Must not be null.
Throws:
java.lang.IllegalArgumentException - thrown if decision is null

getKey

public java.lang.String getKey()

getMyTagValue

public java.lang.String getMyTagValue()

getTheirTagValue

public java.lang.String getTheirTagValue()

getMergeDecision

public MergeDecisionType getMergeDecision()

applyToMyPrimitive

public void applyToMyPrimitive(OsmPrimitive primitive)
                        throws java.lang.IllegalArgumentException,
                               java.lang.IllegalStateException
applies the current merge decisions to the tag set of an OSM primitive. The OSM primitive has the role of primitive in the local dataset ('my' primitive, not 'their' primitive)

Parameters:
primitive - the OSM primitive. Must not be null.
Throws:
java.lang.IllegalArgumentException - thrown, if primitive is null
java.lang.IllegalStateException - thrown, if this merge item is undecided


JOSM