static public DiffOperation Merge(DiffOperation left, DiffOperation right) { // Remove always trumps other operations if (right is RemoveOperation) { return(right); } if (left is RemoveOperation) { return(left); } // Change operation trumps other operations and right changes take precedent if (right is ChangeOperation) { return(right); } if (left is ChangeOperation) { return(left); } // Recurseively merge array and object ops Debug.Assert(left.GetType() == right.GetType()); if (left is ChangeObjectOperation) { return(ChangeObjectOperation.Merge(left as ChangeObjectOperation, right as ChangeObjectOperation)); } if (left is ChangePositionArrayOperation) { return(ChangePositionArrayOperation.Merge(left as ChangePositionArrayOperation, right as ChangePositionArrayOperation)); } if (left is ChangeIdArrayOperation) { return(ChangeIdArrayOperation.Merge(left as ChangeIdArrayOperation, right as ChangeIdArrayOperation)); } Debug.Assert(false); return(null); }
public static ChangeIdArrayOperation Merge(ChangeObjectOperation left, ChangeObjectOperation right) { return(new ChangeIdArrayOperation(CompoundDiff.Merge(left.Diff, right.Diff))); }
public static ChangeObjectOperation Merge(ChangeObjectOperation left, ChangeObjectOperation right) { return new ChangeObjectOperation(CompoundDiff.Merge(left.Diff, right.Diff)); }