internal void InsertOperationAtBeginning(DiffgramOperation op) { Debug.Assert(op._nextSiblingOp == null); op._nextSiblingOp = _firstChildOp; _firstChildOp = op; op._parent = this; }
// Constructor internal XmlDiffShrankNode(XmlDiffNode firstNode, XmlDiffNode lastNode) : base(-1) { Debug.Assert(firstNode != null); Debug.Assert(lastNode != null); Debug.Assert(firstNode.Position <= lastNode.Position); Debug.Assert(firstNode.NodeType != XmlDiffNodeType.Attribute || (firstNode.NodeType == XmlDiffNodeType.Attribute && firstNode == lastNode)); _firstNode = firstNode; _lastNode = lastNode; _matchingShrankNode = null; // hash value XmlDiffNode curNode = firstNode; for (;;) { _hashValue += (_hashValue << 7) + curNode.HashValue; if (curNode == lastNode) { break; } curNode = curNode._nextSibling; } _localAddress = DiffgramOperation.GetRelativeAddressOfNodeset(_firstNode, _lastNode); }
internal void InsertAfter(DiffgramOperation newOp, DiffgramOperation refOp) { if (refOp == null) { return; } newOp._nextSiblingOp = refOp._nextSiblingOp; refOp._nextSiblingOp = newOp; }
internal void WriteChildrenTo(XmlWriter xmlWriter, XmlDiff xmlDiff) { DiffgramOperation curOp = _firstChildOp; while (curOp != null) { curOp.WriteTo(xmlWriter, xmlDiff); curOp = curOp._nextSiblingOp; } }
// Constructor internal EditScriptPostponed(DiffgramOperation diffOperation, int startSourceIndex, int endSourceIndex) : base(null) { Debug.Assert(diffOperation != null); Debug.Assert(startSourceIndex > 0); Debug.Assert(endSourceIndex > 0); _diffOperation = diffOperation; _startSourceIndex = startSourceIndex; _endSourceIndex = endSourceIndex; }
internal void InsertAtBeginning(DiffgramOperation newOp) { newOp._nextSiblingOp = this._firstChildOp; this._firstChildOp = newOp; if (newOp._nextSiblingOp != null) { return; } this._lastChildOp = newOp; }
// Methods internal void InsertAtBeginning(DiffgramOperation newOp) { newOp._nextSiblingOp = _firstChildOp; _firstChildOp = newOp; if (newOp._nextSiblingOp == null) { _lastChildOp = newOp; } }
internal static void WriteAbsoluteMatchAttribute(XmlDiffNode node, XmlWriter xmlWriter) { var attr = node as XmlDiffAttribute; if (attr is XmlDiffAttribute && attr.NamespaceURI != string.Empty) { DiffgramOperation.WriteNamespaceDefinition(attr, xmlWriter); } xmlWriter.WriteAttributeString("match", node.GetAbsoluteAddress()); }
internal void InsertAfter(DiffgramOperation newOp, DiffgramOperation refOp) { Debug.Assert(newOp._nextSiblingOp == null); if (refOp == null) { } else { newOp._nextSiblingOp = refOp._nextSiblingOp; refOp._nextSiblingOp = newOp; } }
internal void InsertAtEnd(DiffgramOperation newOp) { newOp._nextSiblingOp = null; if (this._lastChildOp == null) { this._firstChildOp = this._lastChildOp = newOp; } else { this._lastChildOp._nextSiblingOp = newOp; this._lastChildOp = newOp; } }
internal void InsertAtEnd(DiffgramOperation newOp) { newOp._nextSiblingOp = null; if (_lastChildOp == null) { Debug.Assert(_firstChildOp == null); _firstChildOp = _lastChildOp = newOp; } else { _lastChildOp._nextSiblingOp = newOp; _lastChildOp = newOp; } }
// Constructor internal XmlDiffShrankNode(XmlDiffNode firstNode, XmlDiffNode lastNode, ulong hashValue) : base(-1) { Debug.Assert(firstNode != null); Debug.Assert(lastNode != null); Debug.Assert(firstNode.Position <= lastNode.Position); Debug.Assert(firstNode.NodeType != XmlDiffNodeType.Attribute || (firstNode.NodeType == XmlDiffNodeType.Attribute && firstNode == lastNode)); _firstNode = firstNode; _lastNode = lastNode; _matchingShrankNode = null; _hashValue = hashValue; _localAddress = DiffgramOperation.GetRelativeAddressOfNodeset(_firstNode, _lastNode); }
internal override void WriteTo(XmlWriter xmlWriter, XmlDiff xmlDiff) { xmlWriter.WriteStartElement("xd", "add", "http://schemas.microsoft.com/xmltools/2002/xmldiff"); DiffgramOperation.WriteAbsoluteMatchAttribute(this._sourceNode, xmlWriter); if (!this._bSubtree) { xmlWriter.WriteAttributeString("subtree", "no"); } if (this._operationID != 0UL) { xmlWriter.WriteAttributeString("opid", this._operationID.ToString()); } this.WriteChildrenTo(xmlWriter, xmlDiff); xmlWriter.WriteEndElement(); }
internal override void WriteTo(XmlWriter xmlWriter, XmlDiff xmlDiff) { if (!this._bSorted) { this.Sort(); } xmlWriter.WriteStartElement("xd", "remove", "http://schemas.microsoft.com/xmltools/2002/xmldiff"); if (this._firstSourceNode == this._lastSourceNode) { xmlWriter.WriteAttributeString("match", this._firstSourceNode.GetRelativeAddress()); } else { xmlWriter.WriteAttributeString("match", DiffgramOperation.GetRelativeAddressOfNodeset(this._firstSourceNode, this._lastSourceNode)); } if (this._operationID != 0UL) { xmlWriter.WriteAttributeString("opid", this._operationID.ToString()); } xmlWriter.WriteEndElement(); }
internal XmlDiffShrankNode(XmlDiffNode firstNode, XmlDiffNode lastNode) : base(-1) { this._firstNode = firstNode; this._lastNode = lastNode; this._matchingShrankNode = (XmlDiffShrankNode)null; var xmlDiffNode = firstNode; while (true) { this._hashValue += (this._hashValue << 7) + xmlDiffNode.HashValue; if (xmlDiffNode != lastNode) { xmlDiffNode = xmlDiffNode._nextSibling; } else { break; } } this._localAddress = DiffgramOperation.GetRelativeAddressOfNodeset(this._firstNode, this._lastNode); }
// Constructor internal DiffgramParentOperation(ulong operationID) : base(operationID) { _firstChildOp = null; _lastChildOp = null; }
internal void InsertOperationAtBeginning(DiffgramOperation op) { op._nextSiblingOp = this._firstChildOp; this._firstChildOp = op; }
internal override void WriteTo(XmlWriter xmlWriter, XmlDiff xmlDiff) { xmlWriter.WriteStartElement("xd", "remove", "http://schemas.microsoft.com/xmltools/2002/xmldiff"); DiffgramOperation.GetAddressOfAttributeInterval(this._attributes, xmlWriter); xmlWriter.WriteEndElement(); }
private bool ParentMatches( XmlDiffNode sourceNode, XmlDiffNode targetNode, DiffgramOperation diffParent ) { switch ( diffParent.Operation ) { case XmlDiffOperation.Match: DiffgramPosition diffMatch = diffParent as DiffgramPosition; if ( diffMatch != null ) { return ( diffMatch._sourceNode == sourceNode._parent && diffMatch._targetNode == targetNode._parent ); } return false; case XmlDiffOperation.Remove: DiffgramRemoveNode diffRemove = diffParent as DiffgramRemoveNode; if ( diffRemove != null && diffRemove._sourceNode == sourceNode._parent ) { return ParentMatches( diffRemove._sourceNode, targetNode, diffParent._parent ); } return false; case XmlDiffOperation.Add: return false; default: DiffgramChangeNode diffChange = diffParent as DiffgramChangeNode; if ( diffChange != null ) { return ( diffChange._sourceNode == sourceNode._parent && diffChange._targetNode == targetNode._parent ); } return false; } }
internal void InsertOperationAtBeginning( DiffgramOperation op ) { Debug.Assert( op._nextSiblingOp == null ); op._nextSiblingOp = _firstChildOp; _firstChildOp = op; }
internal void InsertAtEnd( DiffgramOperation newOp ) { newOp._nextSiblingOp = null; if ( _lastChildOp == null ) { Debug.Assert( _firstChildOp == null ); _firstChildOp = _lastChildOp = newOp; } else { _lastChildOp._nextSiblingOp = newOp; _lastChildOp = newOp; } }
// Constructor internal EditScriptPostponed( DiffgramOperation diffOperation, int startSourceIndex, int endSourceIndex ) : base( null ) { Debug.Assert( diffOperation != null ); Debug.Assert( startSourceIndex > 0 ); Debug.Assert( endSourceIndex > 0 ); _diffOperation = diffOperation; _startSourceIndex = startSourceIndex; _endSourceIndex = endSourceIndex; }
// Constructor internal DiffgramParentOperation( ulong operationID ) : base(operationID) { _firstChildOp = null; _lastChildOp = null; }
internal DiffgramOperation( ulong operationID ) { _nextSiblingOp = null; _operationID = operationID; }
internal void InsertAfter( DiffgramOperation newOp, DiffgramOperation refOp ) { Debug.Assert( newOp._nextSiblingOp == null ); if ( refOp == null ) { } else { newOp._nextSiblingOp = refOp._nextSiblingOp; refOp._nextSiblingOp = newOp; } }
private void PostponedOperation( DiffgramOperation op, int startSourceIndex, int endSourceIndex ) { Debug.Assert( _bBuildingAddTree ); Debug.Assert( op != null ); EditScriptPostponed es = new EditScriptPostponed( op, startSourceIndex, endSourceIndex ); if ( _postponedEditScript._firstES == null ) { _postponedEditScript._firstES = es; _postponedEditScript._lastES = es; _postponedEditScript._startSourceIndex = startSourceIndex; _postponedEditScript._endSourceIndex = endSourceIndex; } else { Debug.Assert( _postponedEditScript._lastES != null ); Debug.Assert( _postponedEditScript._lastES._startSourceIndex > endSourceIndex ); _postponedEditScript._lastES._nextEditScript = es; _postponedEditScript._lastES = es; _postponedEditScript._startSourceIndex = startSourceIndex; } }
internal DiffgramOperation(ulong operationID) { _nextSiblingOp = null; _operationID = operationID; }
// Methods internal void InsertAtBeginning( DiffgramOperation newOp ) { newOp._nextSiblingOp = _firstChildOp; _firstChildOp = newOp; if ( newOp._nextSiblingOp == null ) _lastChildOp = newOp; }