예제 #1
0
 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));
 }
예제 #2
0
        public void AddOperation(BubbleChangeOperation operation)
        {
            var existingOperationIndex = mOperations.IndexOf(operation);

            if (existingOperationIndex != -1)
            {
                var existingOperation = mOperations[existingOperationIndex];
                existingOperation.MergeFrom(operation);
            }
            else
            {
                mOperations.Add(operation);
            }
        }
예제 #3
0
        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);
                    }
                }
            }
        }