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); } }
public abstract bool MergeOperation(ref IndexOperation postOperation);
public override bool MergeOperation(ref IndexOperation postOperation) { return(true); }