for (AffinityGroup group : sample1) {
ArrayList<Identity> groupList =
new ArrayList<Identity>(group.getIdentities());
int size = groupList.size();
for (int i = 0; i < size - 1; i++) {
Identity v1 = groupList.get(i);
for (int j = i + 1; j < size; j++) {
Identity v2 = groupList.get(j);
// v1 and v2 are in the same group in sample1. Are they
// in the same group in sample2?
if (inSameGroup(v1, v2, sample2)) {
a++;
} else {
b++;
}
}
}
}
for (AffinityGroup group : sample2) {
ArrayList<Identity> groupList =
new ArrayList<Identity>(group.getIdentities());
int size = groupList.size();
for (int i = 0; i < size - 1; i++) {
Identity v1 = groupList.get(i);
for (int j = i + 1; j < size; j++) {
Identity v2 = groupList.get(j);
// v1 and v2 are in the same group in sample2. Count those
// that are not in the same group in sample1.
if (!inSameGroup(v1, v2, sample1)) {
c++;
}