// init to default state:
leftSide.clear();
rightSide.clear();
final StringMap<String> leftValues = CollectionUtils.createStringMap();
final StringMap<String> rightValues = CollectionUtils.createStringMap();
final StringSet keysToCheck = CollectionUtils.createStringSet();
// collection up non-null annotations on both sides
if (location > 0) {
doc.forEachAnnotationAt(location - 1, new ProcV<String>() {
public void apply(String key, String value) {
if (value != null) {
leftValues.put(key, value);
keysToCheck.add(key);
}
}
});
}
if (location < doc.size()) {
doc.forEachAnnotationAt(location, new ProcV<String>() {
public void apply(String key, String value) {
if (value != null) {
rightValues.put(key, value);
keysToCheck.add(key);
}
}
});
}
// fill in values that change
keysToCheck.each(new Proc() {
public void apply(String key) {
String left = leftValues.get(key);
String right = rightValues.get(key);
if (ValueUtils.notEqual(left, right)) {
leftSide.put(key, left);