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 = 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);
}
} }
} }
} }