コード例 #1
0
 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);
        }
コード例 #3
0
 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;
        }
コード例 #6
0
 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;
     }
 }
コード例 #10
0
 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;
        }
コード例 #17
0
 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;
        }

    }
コード例 #20
0
 internal void InsertOperationAtBeginning( DiffgramOperation op )
 {
     Debug.Assert( op._nextSiblingOp == null );
     op._nextSiblingOp = _firstChildOp;
     _firstChildOp = op;
 }
コード例 #21
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;
     }
 }
コード例 #22
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;
    }
コード例 #23
0
 // Constructor
 internal DiffgramParentOperation( ulong operationID )
     : base(operationID)
 {
     _firstChildOp = null;
     _lastChildOp = null;
 }
コード例 #24
0
 internal DiffgramOperation( ulong operationID )
 {
     _nextSiblingOp = null;
     _operationID = operationID;
 }
コード例 #25
0
 internal void InsertAfter( DiffgramOperation newOp, DiffgramOperation refOp )
 {
     Debug.Assert( newOp._nextSiblingOp == null );
     if ( refOp == null )
     {
     }
     else
     {
     newOp._nextSiblingOp = refOp._nextSiblingOp;
     refOp._nextSiblingOp = newOp;
     }
 }
コード例 #26
0
        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;
 }
コード例 #28
0
        // Methods
        internal void InsertAtBeginning( DiffgramOperation newOp )
        {
            newOp._nextSiblingOp = _firstChildOp;
            _firstChildOp = newOp;

            if ( newOp._nextSiblingOp == null )
            _lastChildOp = newOp;
        }