internal void InsertOperationAtBeginning(DiffgramOperation op)
 {
     Debug.Assert(op._nextSiblingOp == null);
     op._nextSiblingOp = _firstChildOp;
     _firstChildOp     = op;
     op._parent        = this;
 }
示例#2
0
// 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;
 }
示例#4
0
        internal void WriteChildrenTo(XmlWriter xmlWriter, XmlDiff xmlDiff)
        {
            DiffgramOperation curOp = _firstChildOp;

            while (curOp != null)
            {
                curOp.WriteTo(xmlWriter, xmlDiff);
                curOp = curOp._nextSiblingOp;
            }
        }
示例#5
0
// 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;
 }
示例#7
0
// Methods
        internal void InsertAtBeginning(DiffgramOperation newOp)
        {
            newOp._nextSiblingOp = _firstChildOp;
            _firstChildOp        = newOp;

            if (newOp._nextSiblingOp == null)
            {
                _lastChildOp = newOp;
            }
        }
示例#8
0
        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());
        }
示例#9
0
 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;
     }
 }
示例#11
0
 internal void InsertAtEnd(DiffgramOperation newOp)
 {
     newOp._nextSiblingOp = null;
     if (_lastChildOp == null)
     {
         Debug.Assert(_firstChildOp == null);
         _firstChildOp = _lastChildOp = newOp;
     }
     else
     {
         _lastChildOp._nextSiblingOp = newOp;
         _lastChildOp = newOp;
     }
 }
示例#12
0
// 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);
        }
示例#13
0
 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();
 }
示例#14
0
 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();
 }
示例#15
0
        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);
        }
示例#16
0
// Constructor
        internal DiffgramParentOperation(ulong operationID) : base(operationID)
        {
            _firstChildOp = null;
            _lastChildOp  = null;
        }
 internal void InsertOperationAtBeginning(DiffgramOperation op)
 {
     op._nextSiblingOp  = this._firstChildOp;
     this._firstChildOp = op;
 }
示例#18
0
 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();
 }
示例#19
0
    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;
            }
        }
示例#27
0
 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;
        }