IConceptMap<IConceptSet> cis = new SparseConceptMap<IConceptSet>(factory.getTotalConcepts());
for (IntIterator itr = subsumptions.keyIterator(); itr.hasNext();) {
final int X = itr.next();
IConceptSet set = new SparseConceptHashSet();
cis.put(X, set);
for (IntIterator it = subsumptions.get(X).iterator(); it.hasNext();) {
int next = it.next();
set.add(next);
}
}
// Build equivalent and direct concept sets
for (IntIterator itr = cis.keyIterator(); itr.hasNext();) {
final int a = itr.next();
for (IntIterator itr2 = cis.get(a).iterator(); itr2.hasNext();) {
int c = itr2.next();
IConceptSet cs = cis.get(c);
if (c == IFactory.BOTTOM_CONCEPT) {
addToSet(equiv, a, c);
} else if (cs != null && cs.contains(a)) {
addToSet(equiv, a, c);
} else {
boolean isDirect = true;
IConceptSet d = direc.get(a);
if (d != null) {
IConceptSet toRemove = new SparseConceptHashSet();
for (IntIterator itr3 = d.iterator(); itr3.hasNext();) {
int b = itr3.next();
IConceptSet bs = cis.get(b);
if (bs != null && bs.contains(c)) {
isDirect = false;
break;
}
if (cs != null && cs.contains(b)) {
toRemove.add(b);
}
}
d.removeAll(toRemove);
}
if (isDirect) {