Let’s say I have three groups of data, group0, group1 and group2.
group0 is set up to check against group1 and group2.
group1 is set up to check against group0 and group2.
group2 is set up to check against group0 and group1.
When I call group0.checkData(), it checks all of it’s local data against group1 and group 2. When I call group1.checkData(), it checks all of it’s local data against group0 and group2. When I call group2.checkData(), it checks all of it’s local data against group0 and group1.
You can see though that group2’s checks aren’t necessary because group0 and group1 already checked against them. You end up doing a bunch of unnecessary duplicate checks.
group0 doesn’t know that group2 is going to check against it and group2 doesn’t know that group0 is going to check against it.
Any ideas how to solve this filtering problem?
The only way to avoid duplicate checks is to move the checking logic to a component that is aware of all the groups (or a few components each of which is responsible for comparing a pair of groups).