Exemplo n.º 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);
            }
Exemplo n.º 2
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));
 }
Exemplo n.º 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;
			}
Exemplo n.º 4
0
 public HashCodeProvider(StructuredDiff differ)
 {
     this.differ = differ;
 }
Exemplo n.º 5
0
 public NodeComparerWrapper(float threshold, StructuredDiff differ)
 {
     this.threshold = threshold;
     this.differ    = differ;
 }
Exemplo n.º 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;
	}
Exemplo n.º 7
0
 public abstract float Compare(object left, object right, StructuredDiff comparer);
Exemplo n.º 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));
			}
Exemplo n.º 9
0
		public NodeComparerWrapper(float threshold, StructuredDiff differ) {
			this.threshold = threshold;
			this.differ = differ;
		}
Exemplo n.º 10
0
		public HashCodeProvider(StructuredDiff differ) { this.differ = differ; }
Exemplo n.º 11
0
		public abstract float Compare(object left, object right, StructuredDiff comparer);
Exemplo n.º 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;
	}