001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.data.correction; 003 004/** 005 * Represents a change of a single tag. 006 * Both key and value can be subject of this change. 007 * @since 729 008 */ 009public class TagCorrection implements Correction { 010 011 /** Old key */ 012 public final String oldKey; 013 /** New key */ 014 public final String newKey; 015 /** Old value */ 016 public final String oldValue; 017 /** New value */ 018 public final String newValue; 019 020 /** 021 * Constructs a new {@code TagCorrection}. 022 * @param oldKey old key 023 * @param oldValue old value 024 * @param newKey new key 025 * @param newValue new value 026 */ 027 public TagCorrection(String oldKey, String oldValue, String newKey, String newValue) { 028 this.oldKey = oldKey; 029 this.oldValue = oldValue; 030 this.newKey = newKey; 031 this.newValue = newValue; 032 } 033 034 /** 035 * Determines if the key has changed. 036 * @return {@code true} if the key has changed 037 */ 038 public boolean isKeyChanged() { 039 return !newKey.equals(oldKey); 040 } 041 042 /** 043 * Determines if the value has changed. 044 * @return {@code true} if the value has changed 045 */ 046 public boolean isValueChanged() { 047 return !newValue.equals(oldValue); 048 } 049}