Ranker<CompoundModel> r = new Ranker<CompoundModel>();
for (NodeModel neigh : neighbors)
{
if (neigh instanceof ComplexMember) neigh = neigh.getParentModel();
CompoundModel cm = neigh.getParentModel();
if (cm != null) r.count(cm);
}
List<List<CompoundModel>> list = r.getRankedList();
if (list.isEmpty()) return;
List<CompoundModel> firstGroup = list.get(0);
CompoundModel comp;
if (firstGroup.size() == 1)
{
comp = firstGroup.get(0);
}
else
{
for (NodeModel neigh : neighbors)
{
if (neigh instanceof ComplexMember) neigh = neigh.getParentModel();
CompoundModel cm = neigh.getParentModel();
if (cm != null) cm = cm.getParentModel();
if (cm != null) r.count(cm);
}
list = r.getRankedList();
List<CompoundModel> secondGroup = list.get(0);