org.test4j.hamcrest.matcher.property.difference
类 UnorderedCollectionDifference

java.lang.Object
  继承者 org.test4j.hamcrest.matcher.property.difference.Difference
      继承者 org.test4j.hamcrest.matcher.property.difference.UnorderedCollectionDifference

public class UnorderedCollectionDifference
extends Difference

A class for holding the difference between all elements of two collections or arrays.


构造方法摘要
UnorderedCollectionDifference(String message, Object leftValue, Object rightValue, List<?> leftList, List<?> rightList)
          Creates a difference.
 
方法摘要
<T,A> T
accept(DifferenceVisitor<T,A> visitor, A argument)
          Double dispatch method.
 void addElementDifference(int leftIndex, int rightIndex, Difference difference)
          Adds a difference or a match for the elements at the given left and right index.
 Map<Integer,Integer> getBestMatchingIndexes()
          Gets the indexes of the best matching element differences.
 int getBestMatchingScore()
          Gets the matching score of the best matching indexes.
 Difference getElementDifference(int leftIndex, int rightIndex)
          Gets the difference between the elements with the given indexes.
 Map<Integer,Map<Integer,Difference>> getElementDifferences()
          Gets all element differences per left index and right index.
 List<?> getLeftList()
           
 List<?> getRightList()
           
 void setBestMatchingIndexes(int leftIndex, int rightIndex)
          Sets the given left and right index as best matching elements.
 void setBestMatchingScore(int bestMatchingScore)
          Gets the matching score of the best matching indexes.
 
从类 org.test4j.hamcrest.matcher.property.difference.Difference 继承的方法
getLeftValue, getMessage, getRightValue, toString
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

UnorderedCollectionDifference

public UnorderedCollectionDifference(String message,
                                     Object leftValue,
                                     Object rightValue,
                                     List<?> leftList,
                                     List<?> rightList)
Creates a difference.

参数:
message - a message describing the difference
leftValue - the left instance
rightValue - the right instance
leftList - The left instance as a list
rightList - The right instance as a list
方法详细信息

addElementDifference

public void addElementDifference(int leftIndex,
                                 int rightIndex,
                                 Difference difference)
Adds a difference or a match for the elements at the given left and right index.

参数:
leftIndex - The index of the left element
rightIndex - The index of the right element
difference - The difference, null for a match

getElementDifference

public Difference getElementDifference(int leftIndex,
                                       int rightIndex)
Gets the difference between the elements with the given indexes.

参数:
leftIndex - The left element index
rightIndex - The right element index
返回:
The difference, null if not found or if there is no difference

getElementDifferences

public Map<Integer,Map<Integer,Difference>> getElementDifferences()
Gets all element differences per left index and right index. A null difference means a match.

返回:
The differences, not null

setBestMatchingIndexes

public void setBestMatchingIndexes(int leftIndex,
                                   int rightIndex)
Sets the given left and right index as best matching elements.

参数:
leftIndex - The left index
rightIndex - The right index

getBestMatchingIndexes

public Map<Integer,Integer> getBestMatchingIndexes()
Gets the indexes of the best matching element differences.

返回:
The indexes, not null

getBestMatchingScore

public int getBestMatchingScore()
Gets the matching score of the best matching indexes.

返回:
The score

setBestMatchingScore

public void setBestMatchingScore(int bestMatchingScore)
Gets the matching score of the best matching indexes.

参数:
bestMatchingScore - The score

getLeftList

public List<?> getLeftList()
返回:
The left instance as a list

getRightList

public List<?> getRightList()
返回:
The right instance as a list

accept

public <T,A> T accept(DifferenceVisitor<T,A> visitor,
                      A argument)
Double dispatch method. Dispatches back to the given visitor.

All subclasses should copy this method in their own class body.

覆盖:
Difference 中的 accept
参数:
visitor - The visitor, not null
argument - An optional argument for the visitor, null if not applicable
返回:
The result


Copyright © 2013. All rights reserved.