Ejemplo n.º 1
0
        public override bool MergeOperation(ref IndexOperation postOperation)
        {
            if (this._rowId != postOperation.RowId)
            {
                return(false);
            }
            switch (postOperation.OperationType)
            {
            case Type.Add:
                if (this._value == postOperation.Value)
                {
                    postOperation = this;
                    return(true);
                }
                return(false);

            case Type.Remove:
                if (this._value == postOperation.Value)
                {
                    postOperation = new RemoveOperation(this._rowId, this._oldValue);
                    return(true);
                }
                else if (this._oldValue == postOperation.Value)
                {
                    postOperation = this;
                    return(true);
                }
                return(false);

            case Type.Update:
                UpdateOperation update = postOperation as UpdateOperation;
                if (this._oldValue == update.OldValue && this._value == update.Value)
                {
                    return(true);
                }
                else if (this._value == update.OldValue)
                {
                    update._oldValue = this._oldValue;
                    return(true);
                }
                else if (this._value == update.Value)
                {
                    postOperation = new RemoveOperation(update._rowId, update._oldValue);
                }
                else if (this._oldValue == update.Value)
                {
                    postOperation = new AddOperation(update._rowId, update._value);
                }
                return(false);

            case Type.NoOp:
                postOperation = this;
                return(true);

            default:
                return(false);
            }
        }
Ejemplo n.º 2
0
 public abstract bool MergeOperation(ref IndexOperation postOperation);
Ejemplo n.º 3
0
 public override bool MergeOperation(ref IndexOperation postOperation)
 {
     return(true);
 }