Program: 16475
Project: 16475
Buggy source:
/** 
 * After all the analysis iteratives have finished, the final MultipleAlignment object is constructed using the alignment graph.
 * @return true if the MultipleAlignment could be reconstructed, falseotherwise
 * @throws StructureException
 */
private boolean buildAlignment() throws StructureException {
  if (levels.size() == 1)   return false;
  MultipleAlignment msa=new MultipleAlignmentImpl();
  msa.getEnsemble().setAtomArrays(new ArrayList<Atom[]>());
  msa.getEnsemble().setStructureIdentifiers(new ArrayList<StructureIdentifier>());
  msa.getEnsemble().setAlgorithmName(CeSymm.algorithmName);
  msa.getEnsemble().setVersion(CeSymm.version);
  BlockSet bs=new BlockSetImpl(msa);
  Block b=new BlockImpl(bs);
  b.setAlignRes(new ArrayList<List<Integer>>());
  ConnectivityInspector<Integer,DefaultEdge> inspector=new ConnectivityInspector<Integer,DefaultEdge>(alignGraph);
  List<Set<Integer>> comps=inspector.connectedSets();
  List<ResidueGroup> groups=new ArrayList<ResidueGroup>(comps.size());
  for (  Set<Integer> comp : comps)   groups.add(new ResidueGroup(comp));
  int order=1;
  for (  MultipleAlignment m : levels)   order*=m.size();
  for (int su=0; su < order; su++)   b.getAlignRes().add(new ArrayList<Integer>());
  for (  ResidueGroup group : groups) {
    if (group.order() != order)     continue;
    group.combineWith(b.getAlignRes());
  }
  if (b.length() == 0)   return false;
  for (int su=0; su < order; su++) {
    Collections.sort(b.getAlignRes().get(su));
    msa.getEnsemble().getAtomArrays().add(allAtoms);
    msa.getEnsemble().getStructureIdentifiers().add(result.getStructureId());
  }
  result.setMultipleAlignment(msa);
  result.setRefined(true);
  result.setSymmOrder(order);
  result.setSymmLevels(levels.size());
  return true;
}

Fixed version (ground truth):
/** 
 * After all the analysis iteratives have finished, the final MultipleAlignment object is constructed using the alignment graph.
 * @return true if the MultipleAlignment could be reconstructed, falseotherwise
 * @throws StructureException
 */
private boolean buildAlignment() throws StructureException {
  if (levels.size() == 1) {
    result.setSymmLevels(1);
    return false;
  }
  MultipleAlignment msa=new MultipleAlignmentImpl();
  msa.getEnsemble().setAtomArrays(new ArrayList<Atom[]>());
  msa.getEnsemble().setStructureIdentifiers(new ArrayList<StructureIdentifier>());
  msa.getEnsemble().setAlgorithmName(CeSymm.algorithmName);
  msa.getEnsemble().setVersion(CeSymm.version);
  BlockSet bs=new BlockSetImpl(msa);
  Block b=new BlockImpl(bs);
  b.setAlignRes(new ArrayList<List<Integer>>());
  ConnectivityInspector<Integer,DefaultEdge> inspector=new ConnectivityInspector<Integer,DefaultEdge>(alignGraph);
  List<Set<Integer>> comps=inspector.connectedSets();
  List<ResidueGroup> groups=new ArrayList<ResidueGroup>(comps.size());
  for (  Set<Integer> comp : comps)   groups.add(new ResidueGroup(comp));
  int order=1;
  for (  MultipleAlignment m : levels)   order*=m.size();
  for (int su=0; su < order; su++)   b.getAlignRes().add(new ArrayList<Integer>());
  for (  ResidueGroup group : groups) {
    if (group.order() != order)     continue;
    group.combineWith(b.getAlignRes());
  }
  if (b.length() == 0)   return false;
  for (int su=0; su < order; su++) {
    Collections.sort(b.getAlignRes().get(su));
    msa.getEnsemble().getAtomArrays().add(allAtoms);
    msa.getEnsemble().getStructureIdentifiers().add(result.getStructureId());
  }
  result.setMultipleAlignment(msa);
  result.setRefined(true);
  result.setSymmOrder(order);
  result.setSymmLevels(levels.size());
  return true;
}