Esempio n. 1
0
        private IDocOp ComposeOperations(IDocOp op1, IDocOp op2)
        {
            _target = _defaultTarget;
            int op1Index = 0;
            int op2Index = 0;

            while (op1Index < op1.Size())
            {
                op1.ApplyComponent(op1Index++, _target);
                while (_target.IsPostTarget())
                {
                    if (op2Index >= op2.Size())
                    {
                        throw new OperationException("Document size mismatch: "
                                                     + "op1 resulting length=" + DocOpUtil.ResultingDocumentLength(op1)
                                                     + ", op2 initial length=" + DocOpUtil.InitialDocumentLength(op2));
                    }
                    op2.ApplyComponent(op2Index++, _target);
                }
            }
            if (op2Index < op2.Size())
            {
                _target = new FinisherPostTarget();
                while (op2Index < op2.Size())
                {
                    op2.ApplyComponent(op2Index++, _target);
                }
            }
            FlushAnnotations();
            return _normalizer.Finish();
        }