Archived
0

fix match count for pairs with equals second entry

This commit is contained in:
iMoHax
2015-09-11 12:55:54 +03:00
parent 448e5b1763
commit cd59440ae2

View File

@@ -16,11 +16,13 @@ public class RouteSpecificationByPair<T> implements RouteSpecification<T> {
this.first = new ArrayList<>();
this.first.add(first);
this.second = second;
checkSecond = true;
}
public RouteSpecificationByPair(Collection<T> first, T second) {
this.first = new ArrayList<>(first);
this.second = second;
checkSecond = true;
}
@Override
@@ -74,8 +76,16 @@ public class RouteSpecificationByPair<T> implements RouteSpecification<T> {
@Override
public void onAnd(RouteSpecification<T> other) {
if (other instanceof RouteSpecificationByTarget){
if (checkSecond){
T otherTarget = ((RouteSpecificationByTarget<T>)other).target;
checkSecond = checkSecond || !second.equals(otherTarget);
checkSecond = !second.equals(otherTarget);
}
} else
if (other instanceof RouteSpecificationByPair){
RouteSpecificationByPair<T> os = (RouteSpecificationByPair<T>)other;
if (checkSecond && os.checkSecond){
checkSecond = !second.equals(os.second);
}
}
}
}