indexedDbEntities.put(entity, new Integer(index++));
}
}
boolean acyclic = GraphUtils.isAcyclic(pkDependencyGraph);
if (acyclic) {
IndegreeTopologicalSort sorter = new IndegreeTopologicalSort(
pkDependencyGraph);
while (sorter.hasNext())
indexedDbEntities.put(sorter.next(), new Integer(index++));
}
else {
StrongConnection contractor = new StrongConnection(
pkDependencyGraph,
CollectionFactory.ARRAYLIST_FACTORY);
Digraph contractedDigraph = new MapDigraph(MapDigraph.HASHMAP_FACTORY);
contractor.contract(contractedDigraph, CollectionFactory.ARRAYLIST_FACTORY);
IndegreeTopologicalSort sorter = new IndegreeTopologicalSort(
contractedDigraph);
while (sorter.hasNext()) {
Collection component = (Collection) sorter.next();
for (Iterator i = component.iterator(); i.hasNext();)
indexedDbEntities.put(i.next(), new Integer(index++));
}
}
}