org.test4j.hamcrest.matcher.property.comparator
类 IgnoreNumberComparator

java.lang.Object
  继承者 org.test4j.hamcrest.matcher.property.comparator.IgnoreNumberComparator
所有已实现的接口:
Comparator

public class IgnoreNumberComparator
extends Object
implements Comparator

A comparator that compares primitive types by value and not by type. You can for example compare a double with an integer value.


构造方法摘要
IgnoreNumberComparator()
           
 
方法摘要
 boolean canCompare(Object left, Object right)
          Returns true if both objects are not null and instances of Number or Character.
 Difference compare(Object left, Object right, boolean onlyFirstDifference, ReflectionComparator reflectionComparator)
          Compares the two values by converting them to a double and comparing these double values.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

IgnoreNumberComparator

public IgnoreNumberComparator()
方法详细信息

canCompare

public boolean canCompare(Object left,
                          Object right)
Returns true if both objects are not null and instances of Number or Character.

指定者:
接口 Comparator 中的 canCompare
参数:
left - The left object
right - The right object
返回:
True for Numbers and Charaters

compare

public Difference compare(Object left,
                          Object right,
                          boolean onlyFirstDifference,
                          ReflectionComparator reflectionComparator)
Compares the two values by converting them to a double and comparing these double values.

指定者:
接口 Comparator 中的 compare
参数:
left - The left Number or Character, not null
right - The right Number or Character, not null
onlyFirstDifference - True if only the first difference should be returned
reflectionComparator - The root comparator for inner comparisons, not null
返回:
A difference if the values are different, null otherwise


Copyright © 2013. All rights reserved.