|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.test4j.hamcrest.matcher.property.comparator.IgnoreOrderComparator
public class IgnoreOrderComparator
A comparator for collections and arrays that ignores the order of both collections. Both collections are found equal if they both contain the same elements (in any order). This implements the LENIENT_ORDER comparison mode.
| 构造方法摘要 | |
|---|---|
IgnoreOrderComparator()
|
|
| 方法摘要 | |
|---|---|
boolean |
canCompare(Object left,
Object right)
Returns true if both objects are not null and are both Arrays or Collections. |
Difference |
compare(Object left,
Object right,
boolean onlyFirstDifference,
ReflectionComparator reflectionComparator)
Compares the given collections/arrays but ignoring the actual order of the elements. |
protected ArrayList<Integer> |
createIndexList(int size)
|
protected MatchingScoreCalculator |
createMatchingScoreCalculator()
Creates the calculator for determining the matching scores of the differences. |
protected void |
fillAllDifferences(ArrayList<Object> leftList,
ArrayList<Object> rightList,
ReflectionComparator reflectionComparator,
UnorderedCollectionDifference difference)
Calculates the difference of all elements in the left list with all elements of the right list. |
protected void |
fillBestMatchingIndexes(ArrayList<Object> leftList,
ArrayList<Object> rightList,
UnorderedCollectionDifference difference)
Calculates the indexes of the best matching differences for the given unordered collection difference. |
protected boolean |
isEqual(ArrayList<Object> leftList,
ArrayList<Object> rightList,
int leftIndex,
ReflectionComparator reflectionComparator)
Recursively checks whether there is a sequence so that both collections have matching elements. |
protected void |
removeMatchingIndexes(ArrayList<Integer> leftIndexes,
ArrayList<Integer> rightIndexes,
UnorderedCollectionDifference difference)
Removes all left and right indexes for which there is a match in the given difference object. |
protected void |
setBestMatchingIndexes(ArrayList<Integer> leftIndexes,
ArrayList<Integer> rightIndexes,
UnorderedCollectionDifference difference)
Actual implementation of the best match finding algorithm. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public IgnoreOrderComparator()
| 方法详细信息 |
|---|
public boolean canCompare(Object left,
Object right)
Comparator 中的 canCompareleft - The left objectright - The right object
public Difference compare(Object left,
Object right,
boolean onlyFirstDifference,
ReflectionComparator reflectionComparator)
Comparator 中的 compareleft - The left array/collection, not nullright - The right array/collection, not nullonlyFirstDifference - True if only the first difference should be returnedreflectionComparator - The root comparator for inner comparisons, not null
protected boolean isEqual(ArrayList<Object> leftList,
ArrayList<Object> rightList,
int leftIndex,
ReflectionComparator reflectionComparator)
leftList - The left list, not nullrightList - The right list, not nullleftIndex - The current index in the left collectionreflectionComparator - reflectionComparator The comparator for the element
comparisons, not null
protected void fillAllDifferences(ArrayList<Object> leftList,
ArrayList<Object> rightList,
ReflectionComparator reflectionComparator,
UnorderedCollectionDifference difference)
leftList - The left list, not nullrightList - The right list, not nullreflectionComparator - The comparator for element comparisons, not nulldifference - The root difference to which all differences will be added,
not null
protected void fillBestMatchingIndexes(ArrayList<Object> leftList,
ArrayList<Object> rightList,
UnorderedCollectionDifference difference)
leftList - The left list, not nullrightList - The right list, not nulldifference - The difference to which all indexes will be added, not null
protected void setBestMatchingIndexes(ArrayList<Integer> leftIndexes,
ArrayList<Integer> rightIndexes,
UnorderedCollectionDifference difference)
leftIndexes - The current remaining indexes in the left collection, not nullrightIndexes - The current remaining indexes in the right collection, not
nulldifference - The difference to which all indexes will be added, not null
protected void removeMatchingIndexes(ArrayList<Integer> leftIndexes,
ArrayList<Integer> rightIndexes,
UnorderedCollectionDifference difference)
leftIndexes - The indexes, not nullrightIndexes - The indexes, not nulldifference - The collection difference, not nullprotected ArrayList<Integer> createIndexList(int size)
size - The nr of elements
protected MatchingScoreCalculator createMatchingScoreCalculator()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||