public bool Equals(BubbleChangeOperation other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Type.Equals(other.Type) && Equals(Item, other.Item)); }
public void AddOperation(BubbleChangeOperation operation) { var existingOperationIndex = mOperations.IndexOf(operation); if (existingOperationIndex != -1) { var existingOperation = mOperations[existingOperationIndex]; existingOperation.MergeFrom(operation); } else { mOperations.Add(operation); } }
public void MergeFrom(BubbleChangeOperation other) { if (!Equals(other)) { throw new ArgumentException("Cannot merge when other object is not for the same item and type."); } if (other.Type == BubbleChangeType.ItemChanged) { foreach (var otherProperty in other.Properties) { if (!mProperties.Contains(otherProperty)) { mProperties.Add(otherProperty); } } } }