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

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

public class CollectionDifference
extends Difference

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


构造方法摘要
CollectionDifference(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 index, Difference difference)
          Adds a difference for the element at the given index.
 void addLeftMissingIndex(int index)
          Adds an index of a left element that is missing in the right collection.
 void addRightMissingIndex(int index)
          Adds an index of a right element that is missing in the left collection.
 Map<Integer,Difference> getElementDifferences()
          Gets all element differences per index.
 List<?> getLeftList()
           
 List<Integer> getLeftMissingIndexes()
          Gets the indexes of the left elements that were missing in the right collection.
 List<?> getRightList()
           
 List<Integer> getRightMissingIndexes()
          Gets the indexes of the right elements that were missing in the left collection.
 
从类 org.test4j.hamcrest.matcher.property.difference.Difference 继承的方法
getLeftValue, getMessage, getRightValue, toString
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

CollectionDifference

public CollectionDifference(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 index,
                                 Difference difference)
Adds a difference for the element at the given index.

参数:
index - The element index
difference - The difference, not null

getElementDifferences

public Map<Integer,Difference> getElementDifferences()
Gets all element differences per index.

返回:
The differences, not null

addLeftMissingIndex

public void addLeftMissingIndex(int index)
Adds an index of a left element that is missing in the right collection.

参数:
index - The left element index

getLeftMissingIndexes

public List<Integer> getLeftMissingIndexes()
Gets the indexes of the left elements that were missing in the right collection.

返回:
The indexes, not null

addRightMissingIndex

public void addRightMissingIndex(int index)
Adds an index of a right element that is missing in the left collection.

参数:
index - The right element index

getRightMissingIndexes

public List<Integer> getRightMissingIndexes()
Gets the indexes of the right elements that were missing in the left collection.

返回:
The indexes, not null

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.