NodeState before, NodeState after, NodeStateDiff diff) {
Set<String> beforeProperties = new HashSet<String>();
for (PropertyState beforeProperty : before.getProperties()) {
String name = beforeProperty.getName();
PropertyState afterProperty = after.getProperty(name);
if (afterProperty == null) {
diff.propertyDeleted(beforeProperty);
} else {
beforeProperties.add(name);
if (!beforeProperty.equals(afterProperty)) {
diff.propertyChanged(beforeProperty, afterProperty);
}
}
}
for (PropertyState afterProperty : after.getProperties()) {
if (!beforeProperties.contains(afterProperty.getName())) {
diff.propertyAdded(afterProperty);
}
}
}