@Override public void updateAttributes(AttributesUpdate attrUpdate) { flushAnnotations(); normalizer.updateAttributes(this.attrUpdate.composeWith(attrUpdate)); target = defaultTarget; }
private static AttributesUpdate invertUpdate(AttributesUpdate attrUpdate) { AttributesUpdate inverseUpdate = new AttributesUpdateImpl(); // TODO: This is a little silly. We should do this a better way. for (int i = 0; i < attrUpdate.changeSize(); ++i) { inverseUpdate = inverseUpdate.composeWith(new AttributesUpdateImpl( attrUpdate.getChangeKey(i), attrUpdate.getNewValue(i), attrUpdate.getOldValue(i))); } return inverseUpdate; }
@Override void resolveUpdateAttributes(AttributesUpdate update) { syncAnnotations(); Map<String, String> updated = new HashMap<String, String>(); for (int i = 0; i < update.changeSize(); ++i) { updated.put(update.getChangeKey(i), update.getNewValue(i)); } AttributesUpdate newUpdate = new AttributesUpdateImpl(); // TODO: This is a little silly. We should do this a better way. for (int i = 0; i < this.update.changeSize(); ++i) { String key = this.update.getChangeKey(i); String newOldValue = updated.containsKey(key) ? updated.get(key) : this.update.getOldValue(i); newUpdate = newUpdate.composeWith(new AttributesUpdateImpl(key, newOldValue, this.update.getNewValue(i))); } targetDocument.updateAttributes(newUpdate); Set<String> keySet = new HashSet<String>(); for (int i = 0; i < this.update.changeSize(); ++i) { keySet.add(this.update.getChangeKey(i)); } AttributesUpdate transformedAttributes = update.exclude(keySet); otherTarget.targetDocument.updateAttributes(transformedAttributes); }
@Override public void updateAttributes(AttributesUpdate attrUpdate) { AttributesUpdate update = new AttributesUpdateImpl(); // TODO: This is a little silly. We should do this a better way. for (int i = 0; i < attrUpdate.changeSize(); ++i) { update = update.composeWith(new AttributesUpdateImpl(attrUpdate.getChangeKey(i), attrUpdate.getNewValue(i), attrUpdate.getOldValue(i))); } target.updateAttributes(update); }
@Override void resolveUpdateAttributes(AttributesUpdate update) { Map<String, String> updated = new HashMap<String, String>(); for (int i = 0; i < update.changeSize(); ++i) { updated.put(update.getChangeKey(i), update.getNewValue(i)); } AttributesUpdate newUpdate = new AttributesUpdateImpl(); // TODO: This is a little silly. We should do this a better way. for (int i = 0; i < this.update.changeSize(); ++i) { String key = this.update.getChangeKey(i); String newOldValue = updated.containsKey(key) ? updated.get(key) : this.update.getOldValue(i); newUpdate = newUpdate.composeWith(new AttributesUpdateImpl(key, newOldValue, this.update.getNewValue(i))); } targetDocument.updateAttributes(newUpdate); Set<String> keySet = new HashSet<String>(); for (int i = 0; i < this.update.changeSize(); ++i) { keySet.add(this.update.getChangeKey(i)); } AttributesUpdate transformedAttributes = update.exclude(keySet); otherTarget.targetDocument.updateAttributes(transformedAttributes); }
@Override void resolveUpdateAttributes(AttributesUpdate update) { Map<String, String> updated = new HashMap<String, String>(); for (int i = 0; i < update.changeSize(); ++i) { updated.put(update.getChangeKey(i), update.getNewValue(i)); } AttributesUpdate newUpdate = new AttributesUpdateImpl(); // TODO: This is a little silly. We should do this a better way. for (int i = 0; i < this.update.changeSize(); ++i) { String key = this.update.getChangeKey(i); String newOldValue = updated.containsKey(key) ? updated.get(key) : this.update.getOldValue(i); newUpdate = newUpdate.composeWith(new AttributesUpdateImpl(key, newOldValue, this.update.getNewValue(i))); } targetDocument.updateAttributes(newUpdate); Set<String> keySet = new HashSet<String>(); for (int i = 0; i < this.update.changeSize(); ++i) { keySet.add(this.update.getChangeKey(i)); } AttributesUpdate transformedAttributes = update.exclude(keySet); otherTarget.targetDocument.updateAttributes(transformedAttributes); }