public virtual Differences VisitQuantifier(Quantifier quantifier1, Quantifier quantifier2){ Differences differences = new Differences(quantifier1, quantifier2); if (quantifier1 == null || quantifier2 == null){ if (quantifier1 != quantifier2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; return differences; } Quantifier changes = (Quantifier)quantifier2.Clone(); Quantifier deletions = (Quantifier)quantifier2.Clone(); Quantifier insertions = (Quantifier)quantifier2.Clone(); Differences diff = this.VisitComprehension((Comprehension)quantifier1.Comprehension, (Comprehension)quantifier2.Comprehension); if (diff == null){Debug.Assert(false); return differences;} changes.Comprehension = diff.Changes as Comprehension; deletions.Comprehension = diff.Deletions as Comprehension; insertions.Comprehension = diff.Insertions as Comprehension; differences.NumberOfDifferences += diff.NumberOfDifferences; differences.NumberOfSimilarities += diff.NumberOfSimilarities; if (quantifier1.QuantifierType == quantifier2.QuantifierType) differences.NumberOfSimilarities++; else differences.NumberOfDifferences++; 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; }
public override Expression VisitQuantifier(Quantifier quantifier) { if (quantifier == null) return null; return base.VisitQuantifier((Quantifier)quantifier.Clone()); }