CmpVertex currentBlueState = BlueEntry.getValue();
int numberOfCompatiblePairs = 0;
for(CmpVertex oldRed:reds)
{
PairScore pair = coregraph.pairscores.obtainPair(currentBlueState,oldRed,null);
if (pair.getScore() >= coregraph.config.getGeneralisationThreshold())
{
coregraph.pairsAndScores.add(pair);
++numberOfCompatiblePairs;
}
}
if (numberOfCompatiblePairs == 0)
{// mark this blue node as red.
CmpVertex newRedNode = currentBlueState;
newRedNode.setColour(JUConstants.RED);
reds.add(newRedNode);currentExplorationBoundary.add(newRedNode);
BlueStatesConsideredSoFar.remove(newRedNode);
// All future blue nodes will use this revised set of red states; the fact that
// it is added to the exploration boundary ensures that it is considered when looking for more blue states.
// Note that previously-considered blue states were not compared to this one (because it was blue before),
// however previously-introduced red were - we're using the up-to-date reds set above.
// For this reason, all we have to do is iterate over the old blue states and compare them to the
// current one; none of those states may become red as a consequence since they are not
// red already, i.e. there is an entry about them in PairsAndScores
for(CmpVertex oldBlue:BlueStatesConsideredSoFar)
{
PairScore pair = coregraph.pairscores.obtainPair(oldBlue,newRedNode,null);
if (pair.getScore() >= coregraph.config.getGeneralisationThreshold())
{
coregraph.pairsAndScores.add(pair);
}
}
}