public interface CorrespondenceComparatorDeducer<E extends Element<E>>
This is important in situations where the choice of the API comparison "partner" element cannot be determined without knowing its "neighborhood" in both element forests. A concrete example of this is comparison of overloaded methods.
Modifier and Type | Method and Description |
---|---|
static <E extends Element<E>> |
editDistance(java.util.function.BiPredicate<? super E,? super E> equality)
This correspondence deducer is a good match for situations where the ordering of the children of some element
is not semantic but rather positional, e.g.
|
static <E extends Element<E>> |
naturalOrder() |
Comparator<? super E> |
sortAndGetCorrespondenceComparator(List<E> first,
List<E> second)
Deduces the correspondence comparator and sorts the provided lists so that the comparator, when used to compare
the elements for the two lists mutually is consistent.
|
static <E extends Element<E>> CorrespondenceComparatorDeducer<E> naturalOrder()
static <E extends Element<E>> CorrespondenceComparatorDeducer<E> editDistance(java.util.function.BiPredicate<? super E,? super E> equality)
E
- the base type of the elementsequality
- a function to determine the element equalityComparator<? super E> sortAndGetCorrespondenceComparator(List<E> first, List<E> second)
The collections will contain elements of different types (which is consistent with how ElementForest
stores the children) and it is assumed that the sorter is able to pick and choose which types of elements it is
able to sort. The collections will be sorted according the natural order of the elements when entering this
method.
first
- the first collection of elementssecond
- the second collection of elementsCopyright © 2014-2021 Lukas Krejci. All Rights Reserved.