Beispiel #1
0
            public override float Compare(object left, object right, StructuredDiff comparer)
            {
                string l = left.ToString(), r = right.ToString();

                if (Equal(l, r))
                {
                    return(0);
                }
                if (l.Length <= 1 || r.Length <= 1)
                {
                    return(1);
                }
                float d = comparer.CompareLists(GetChildren(left), GetChildren(right));

                if (((Node)left).level == 2 && d >= .75)
                {
                    d = 1.1f;
                }
                return(d);
            }
 public Pair(object a, object b, StructuredDiff differ)
 {
     left = a; right = b;
     code = unchecked (differ.GetInterface(left).GetHashCode(left) + differ.GetInterface(right).GetHashCode(right));
 }
Beispiel #3
0
			public override float Compare(object left, object right, StructuredDiff comparer) {
				string l = left.ToString(), r = right.ToString();
				if (Equal(l, r)) return 0;
				if (l.Length <= 1 || r.Length <= 1) return 1;
				float d = comparer.CompareLists(GetChildren(left), GetChildren(right));
				if (((Node)left).level == 2 && d >= .75) d = 1.1f;
				return d;
			}
 public HashCodeProvider(StructuredDiff differ)
 {
     this.differ = differ;
 }
 public NodeComparerWrapper(float threshold, StructuredDiff differ)
 {
     this.threshold = threshold;
     this.differ    = differ;
 }
Beispiel #6
0
	public override float Compare(object left, object right, StructuredDiff comparer) {
		ASTNode l = (ASTNode)left;
		ASTNode r = (ASTNode)right;
		
		if (l.getText() != r.getText()) return 1;
		
		if (l.EqualsTree(r)) return 0;
		
		float ret = comparer.CompareLists(GetChildren(left), GetChildren(right));
		return ret;
	}
 public abstract float Compare(object left, object right, StructuredDiff comparer);
Beispiel #8
0
			public Pair(object a, object b, StructuredDiff differ) {
				left = a; right = b;
				code = unchecked(differ.GetInterface(left).GetHashCode(left) + differ.GetInterface(right).GetHashCode(right));
			}
Beispiel #9
0
		public NodeComparerWrapper(float threshold, StructuredDiff differ) {
			this.threshold = threshold;
			this.differ = differ;
		}
Beispiel #10
0
		public HashCodeProvider(StructuredDiff differ) { this.differ = differ; }
Beispiel #11
0
		public abstract float Compare(object left, object right, StructuredDiff comparer);
Beispiel #12
0
	public override float Compare(object left, object right, StructuredDiff comparer) {
		XmlNode l = (XmlNode)left;
		XmlNode r = (XmlNode)right;
		
		float ret;
		
		IList cleft = GetChildren(left);
		IList cright = GetChildren(right);

		if (cleft == null || cright == null) {
			if (l.InnerText == r.InnerText) ret = 0;
			else if (l.InnerText.Trim() == r.InnerText.Trim()) ret = .05F;
			else ret = 1;
		} else {		
			ret = comparer.CompareLists(cleft, cright);
		}
		
		if (l is XmlElement || l is XmlAttribute) {
			ret *= .75F;
			if (l.Name != r.Name) 
				ret += .25F;
		}
		
		return ret;
	}