/** * Check to see if we have found a solution to the problem. TODO: we could throw an exception to * simulate a non-local exit here, since we've assumed that P is the unity set. * * @param uCls * @param vCls * @param index */ protected static void checkSolution(OntClass uCls, OntClass vCls, LCAIndex index) { DisjointSet vSet = index.getSet(vCls); DisjointSet uSet = index.getSet(uCls); if (vSet != null && vSet.isBlack() && !vSet.used() && uSet != null && uSet.isBlack() && !uSet.used()) { vSet.setUsed(); uSet.setUsed(); // log.debug( "Found LCA: u = " + uCls + ", v = " + vCls ); OntClass lca = (OntClass) vSet.find().getAncestor().getNode(); // log.debug( "Found LCA: lca = " + lca ); index.setLCA(uCls, vCls, lca); } }