fix match count for pairs with equals second entry
This commit is contained in:
@@ -16,11 +16,13 @@ public class RouteSpecificationByPair<T> implements RouteSpecification<T> {
|
|||||||
this.first = new ArrayList<>();
|
this.first = new ArrayList<>();
|
||||||
this.first.add(first);
|
this.first.add(first);
|
||||||
this.second = second;
|
this.second = second;
|
||||||
|
checkSecond = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RouteSpecificationByPair(Collection<T> first, T second) {
|
public RouteSpecificationByPair(Collection<T> first, T second) {
|
||||||
this.first = new ArrayList<>(first);
|
this.first = new ArrayList<>(first);
|
||||||
this.second = second;
|
this.second = second;
|
||||||
|
checkSecond = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,8 +76,16 @@ public class RouteSpecificationByPair<T> implements RouteSpecification<T> {
|
|||||||
@Override
|
@Override
|
||||||
public void onAnd(RouteSpecification<T> other) {
|
public void onAnd(RouteSpecification<T> other) {
|
||||||
if (other instanceof RouteSpecificationByTarget){
|
if (other instanceof RouteSpecificationByTarget){
|
||||||
T otherTarget = ((RouteSpecificationByTarget<T>)other).target;
|
if (checkSecond){
|
||||||
checkSecond = checkSecond || !second.equals(otherTarget);
|
T otherTarget = ((RouteSpecificationByTarget<T>)other).target;
|
||||||
|
checkSecond = !second.equals(otherTarget);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (other instanceof RouteSpecificationByPair){
|
||||||
|
RouteSpecificationByPair<T> os = (RouteSpecificationByPair<T>)other;
|
||||||
|
if (checkSecond && os.checkSecond){
|
||||||
|
checkSecond = !second.equals(os.second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user