コード例 #1
0
        private void AppendDescriptors( Diffgram diffgram )
        {
            IDictionaryEnumerator en = _moveDescriptors.GetEnumerator();
            while ( en.MoveNext() )
            diffgram.AddDescriptor( new OperationDescrMove( (ulong)en.Value ) );
            NamespaceChange nsChange = _namespaceChangeDescr;
            while ( nsChange != null )
            {
            diffgram.AddDescriptor( new OperationDescrNamespaceChange( nsChange ) );
            nsChange = nsChange._next;
            }

            PrefixChange prefixChange = _prefixChangeDescr;
            while ( prefixChange != null )
            {
            diffgram.AddDescriptor( new OperationDescrPrefixChange( prefixChange ) );
            prefixChange = prefixChange._next;
            }
        }
コード例 #2
0
        // Methods
        internal Diffgram GenerateFromEditScript( EditScript editScript )
        {
            Debug.Assert( editScript != null );

            Debug.Assert( _xmlDiff._sourceNodes != null );
            Debug.Assert( _xmlDiff._targetNodes != null );
            _sourceNodes = _xmlDiff._sourceNodes;
            _targetNodes = _xmlDiff._targetNodes;

            Diffgram diffgram = new Diffgram( _xmlDiff );

            // root nodes always match; remove them from the edit script
            EditScriptMatch esm = editScript as EditScriptMatch;
            if ( editScript.Operation == EditScriptOperation.Match  &&
             ( esm._firstSourceIndex + esm._length == _sourceNodes.Length  &&
               esm._firstTargetIndex + esm._length == _targetNodes.Length ) )
            {
            esm._length--;
            if ( esm._length == 0 )
                editScript = esm._nextEditScript;
            }
            else
            Debug.Assert( false, "The root nodes does not match!" );

            // init globals
            _curSourceIndex = _sourceNodes.Length - 2;
            _curTargetIndex = _targetNodes.Length - 2;
            _editScript = editScript;

            // generate diffgram
            GenerateDiffgramMatch( diffgram, 1, 1 );

            // add descriptors
            AppendDescriptors( diffgram );

            return diffgram;
        }
コード例 #3
0
 // Walktree diffgram generation
 internal Diffgram GenerateFromWalkTree()
 {
     Diffgram diffgram = new Diffgram( _xmlDiff );
     WalkTreeGenerateDiffgramMatch( diffgram, _xmlDiff._sourceDoc, _xmlDiff._targetDoc );
     AppendDescriptors( diffgram );
     return diffgram;
 }