public virtual Differences VisitCollectionEnumerator(CollectionEnumerator ce1, CollectionEnumerator ce2){
      Differences differences = new Differences(ce1, ce2);
      if (ce1 == null || ce2 == null){
        if (ce1 != ce2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      CollectionEnumerator changes = (CollectionEnumerator)ce2.Clone();
      CollectionEnumerator deletions = (CollectionEnumerator)ce2.Clone();
      CollectionEnumerator insertions = (CollectionEnumerator)ce2.Clone();

      Differences diff = this.VisitExpression(ce1.Collection, ce2.Collection);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Collection = diff.Changes as Expression;
      deletions.Collection = diff.Deletions as Expression;
      insertions.Collection = diff.Insertions as Expression;
      Debug.Assert(diff.Changes == changes.Collection && diff.Deletions == deletions.Collection && diff.Insertions == insertions.Collection);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      if (differences.NumberOfDifferences == 0){
        differences.Changes = null;
        differences.Deletions = null;
        differences.Insertions = null;
      }else{
        differences.Changes = changes;
        differences.Deletions = deletions;
        differences.Insertions = insertions;
      }
      return differences;
    }
Exemple #2
0
 public override CollectionEnumerator VisitCollectionEnumerator(CollectionEnumerator ce)
 {
     if (ce == null) return null;
     return base.VisitCollectionEnumerator((CollectionEnumerator)ce.Clone());
 }