// query nodes
    public virtual Differences VisitQueryAggregate(QueryAggregate qa1, QueryAggregate qa2){
      Differences differences = new Differences(qa1, qa2);
      if (qa1 == null || qa2 == null){
        if (qa1 != qa2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      QueryAggregate changes = (QueryAggregate)qa2.Clone();
      QueryAggregate deletions = (QueryAggregate)qa2.Clone();
      QueryAggregate insertions = (QueryAggregate)qa2.Clone();

      Differences diff = this.VisitTypeNode(qa1.AggregateType, qa2.AggregateType);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.AggregateType = diff.Changes as TypeNode;
      deletions.AggregateType = diff.Deletions as TypeNode;
      insertions.AggregateType = diff.Insertions as TypeNode;
      //Debug.Assert(diff.Changes == changes.AggregateType && diff.Deletions == deletions.AggregateType && diff.Insertions == insertions.AggregateType);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

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

      diff = this.VisitQueryGroupBy(qa1.Group, qa2.Group);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Group = diff.Changes as QueryGroupBy;
      deletions.Group = diff.Deletions as QueryGroupBy;
      insertions.Group = diff.Insertions as QueryGroupBy;
      Debug.Assert(diff.Changes == changes.Group && diff.Deletions == deletions.Group && diff.Insertions == insertions.Group);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitIdentifier(qa1.Name, qa2.Name);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Name = diff.Changes as Identifier;
      deletions.Name = diff.Deletions as Identifier;
      insertions.Name = diff.Insertions as Identifier;
      Debug.Assert(diff.Changes == changes.Name && diff.Deletions == deletions.Name && diff.Insertions == insertions.Name);
      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;
    }
示例#2
0
 // query nodes
 public override Node VisitQueryAggregate(QueryAggregate qa){
   if (qa == null) return null;
   return base.VisitQueryAggregate((QueryAggregate)qa.Clone());
 }