/// <summary> /// Removes a structured property. /// </summary> /// <param name="myPropertyName">The name of the property</param> /// <returns>The reference of the current object. (fluent interface).</returns> public RequestUpdate RemoveAttribute(String myPropertyName) { RemovedAttributes = RemovedAttributes ?? new List <String>(); RemovedAttributes.Add(myPropertyName); return(this); }
public void ComputeMarkingDiff(SerializedNode fromTree, Node toTree) { //compute the difference between attributes var fromInterpreters = fromTree.Interpreters; var toInterpreters = toTree.Interpreters; foreach (var attributeNameId in fromInterpreters.Keys) { if (false == toInterpreters.ContainsKey(attributeNameId)) { RemovedAttributes.Add(attributeNameId); } else { var fromData = GetSerializedAttribute(fromTree, attributeNameId); var toData = toTree.Interpreters[attributeNameId].Serialize(); if (false == fromData.IsSame(toData)) { ModifiedAttributeData[attributeNameId] = toData; } } } foreach (var attributeNameId in toInterpreters.Keys) { if (fromTree.Interpreters.ContainsKey(attributeNameId)) { continue; } var toData = toTree.Interpreters[attributeNameId].Serialize(); ModifiedAttributeData[attributeNameId] = toData; } if (toTree.Markings == null) { return; } foreach (var childIndex in toTree.Markings.Keys) { if (!toTree.Children.ContainsKey(childIndex)) { if (fromTree.Children.ContainsKey(childIndex)) { RemovedNodes.Add(childIndex); } } else if (!fromTree.Children.ContainsKey(childIndex)) { if (toTree.Children.ContainsKey(childIndex)) { Children[childIndex] = ReflectTreeAsDiff(Document.ReflectTreeMirror(toTree.Children[childIndex])); } } else { var childRedoDiff = new NodeDiff(this); childRedoDiff.ComputeMarkingDiff( fromTree.Children[childIndex], toTree.Children[childIndex]); if (!childRedoDiff.Empty) { Children[childIndex] = childRedoDiff; } } } toTree.ClearMarkings(); }