Program: 57759
Project: 57759
Buggy source:
private Row createPreviewRow(ElementLayout horizontalSpacing,ElementLayout verticalSpacing){
  PathwayVertexRep vertexRep=node.getPathwayVertexRep();
  List<IDataDomain> dataDomains=DataDomainManager.get().getDataDomainsByType("String_Node_Str");
  List<GeneticDataDomain> geneticDataDomains=new ArrayList<GeneticDataDomain>();
  for (  IDataDomain dataDomain : dataDomains) {
    geneticDataDomains.add((GeneticDataDomain)dataDomain);
  }
  PathwayDataDomain pathwayDataDomain=(PathwayDataDomain)DataDomainManager.get().getDataDomainByType("String_Node_Str");
  Map<Integer,Set<GeneticDataDomain>> geneIDsToDataDomains=new HashMap<Integer,Set<GeneticDataDomain>>();
  Set<GeneticDataDomain> dataDomainsWithMappedGenes=new HashSet<GeneticDataDomain>();
  List<PathwayVertex> vertices=vertexRep.getPathwayVertices();
  if (vertices != null) {
    for (    PathwayVertex vertex : vertices) {
      int davidId=PathwayItemManager.get().getDavidIdByPathwayVertex(vertex);
      for (      GeneticDataDomain dataDomain : geneticDataDomains) {
        Set<Integer> ids=dataDomain.getGeneIDMappingManager().getIDAsSet(pathwayDataDomain.getDavidIDType(),dataDomain.getGeneIDType(),davidId);
        if (ids != null && !ids.isEmpty()) {
          for (          Integer id : ids) {
            Set<GeneticDataDomain> set=geneIDsToDataDomains.get(id);
            if (set == null) {
              set=new HashSet<GeneticDataDomain>();
              geneIDsToDataDomains.put(id,set);
            }
            set.add(dataDomain);
            dataDomainsWithMappedGenes.add(dataDomain);
          }
        }
      }
    }
  }
  Row previewRow=new Row("String_Node_Str");
  previewRow.setFrameColor(1,0,0,1);
  List<GeneticDataDomain> mappedGeneticDataDomainList=new ArrayList<GeneticDataDomain>(dataDomainsWithMappedGenes.size());
  List<Column> dataDomainColumns=new ArrayList<Column>(dataDomainsWithMappedGenes.size());
  previewRow.append(horizontalSpacing);
  for (  GeneticDataDomain dataDomain : geneticDataDomains) {
    if (dataDomainsWithMappedGenes.contains(dataDomain)) {
      mappedGeneticDataDomainList.add(dataDomain);
      Column column=new Column("String_Node_Str");
      dataDomainColumns.add(column);
      previewRow.append(column);
      previewRow.append(horizontalSpacing);
    }
  }
  List<Integer> geneIDList=new ArrayList<Integer>(geneIDsToDataDomains.keySet());
  Collections.sort(geneIDList);
  for (int i=0; i < mappedGeneticDataDomainList.size(); i++) {
    GeneticDataDomain currentDataDomain=mappedGeneticDataDomainList.get(i);
    Column column=dataDomainColumns.get(i);
    for (int j=0; j < geneIDList.size(); j++) {
      Integer id=geneIDList.get(j);
      Set<GeneticDataDomain> mappedDataDomains=geneIDsToDataDomains.get(id);
      if (mappedDataDomains.contains(currentDataDomain)) {
        Row geneRow=new Row("String_Node_Str" + i + "String_Node_Str");
        ColorRenderer geneRowColorRenderer=new ColorRenderer(new float[]{1,1,1,1},new float[]{0,0,0,1},1);
        geneRow.setRenderer(geneRowColorRenderer);
        geneRow.setPixelSizeY(GENE_ROW_HEIGHT_PIXELS);
        column.append(geneRow);
      }
 else {
        Row emptyRow=new Row("String_Node_Str" + i + "String_Node_Str");
        emptyRow.setPixelSizeY(GENE_ROW_HEIGHT_PIXELS);
        column.append(emptyRow);
      }
      if (i == 0)       heightPixels+=GENE_ROW_HEIGHT_PIXELS;
      if (j != geneIDList.size()) {
        column.append(verticalSpacing);
        if (i == 0)         heightPixels+=SPACING_PIXELS;
      }
    }
  }
  return previewRow;
}

Fixed version (ground truth):
private Row createPreviewRow(ElementLayout horizontalSpacing,ElementLayout verticalSpacing){
  PathwayVertexRep vertexRep=node.getPathwayVertexRep();
  List<IDataDomain> dataDomains=DataDomainManager.get().getDataDomainsByType("String_Node_Str");
  List<GeneticDataDomain> geneticDataDomains=new ArrayList<GeneticDataDomain>();
  for (  IDataDomain dataDomain : dataDomains) {
    geneticDataDomains.add((GeneticDataDomain)dataDomain);
  }
  PathwayDataDomain pathwayDataDomain=(PathwayDataDomain)DataDomainManager.get().getDataDomainByType("String_Node_Str");
  Map<Integer,Set<GeneticDataDomain>> geneIDsToDataDomains=new HashMap<Integer,Set<GeneticDataDomain>>();
  Set<GeneticDataDomain> dataDomainsWithMappedGenes=new HashSet<GeneticDataDomain>();
  List<PathwayVertex> vertices=vertexRep.getPathwayVertices();
  if (vertices != null) {
    for (    PathwayVertex vertex : vertices) {
      int davidId=PathwayItemManager.get().getDavidIdByPathwayVertex(vertex);
      for (      GeneticDataDomain dataDomain : geneticDataDomains) {
        Set<Integer> ids=dataDomain.getGeneIDMappingManager().getIDAsSet(pathwayDataDomain.getDavidIDType(),dataDomain.getGeneIDType(),davidId);
        if (ids != null && !ids.isEmpty()) {
          Set<GeneticDataDomain> set=geneIDsToDataDomains.get(davidId);
          if (set == null) {
            set=new HashSet<GeneticDataDomain>();
            geneIDsToDataDomains.put(davidId,set);
          }
          set.add(dataDomain);
          dataDomainsWithMappedGenes.add(dataDomain);
        }
      }
    }
  }
  Row previewRow=new Row("String_Node_Str");
  previewRow.setFrameColor(1,0,0,1);
  List<GeneticDataDomain> mappedGeneticDataDomainList=new ArrayList<GeneticDataDomain>(dataDomainsWithMappedGenes.size());
  List<Column> dataDomainColumns=new ArrayList<Column>(dataDomainsWithMappedGenes.size());
  previewRow.append(horizontalSpacing);
  for (  GeneticDataDomain dataDomain : geneticDataDomains) {
    if (dataDomainsWithMappedGenes.contains(dataDomain)) {
      mappedGeneticDataDomainList.add(dataDomain);
      Column column=new Column("String_Node_Str");
      column.setBottomUp(false);
      dataDomainColumns.add(column);
      ElementLayout labelLayout=new ElementLayout("String_Node_Str");
      LabelRenderer labelRenderer=new LabelRenderer(view,dataDomain.getLabel());
      labelRenderer.setAlignment(LabelRenderer.ALIGN_CENTER);
      labelLayout.setRenderer(labelRenderer);
      labelLayout.setPixelSizeY(CAPTION_HEIGHT_PIXELS);
      column.append(labelLayout);
      column.append(verticalSpacing);
      column.append(verticalSpacing);
      previewRow.append(column);
      previewRow.append(horizontalSpacing);
    }
  }
  List<Integer> davidIdList=new ArrayList<Integer>(geneIDsToDataDomains.keySet());
  Collections.sort(davidIdList);
  for (int i=0; i < mappedGeneticDataDomainList.size(); i++) {
    GeneticDataDomain currentDataDomain=mappedGeneticDataDomainList.get(i);
    Column column=dataDomainColumns.get(i);
    column.setRatioSizeX(1.0f / (float)dataDomainColumns.size());
    if (i == 0) {
      heightPixels+=CAPTION_HEIGHT_PIXELS + SPACING_PIXELS + SPACING_PIXELS;
    }
    for (int j=0; j < davidIdList.size(); j++) {
      Integer davidId=davidIdList.get(j);
      Set<GeneticDataDomain> mappedDataDomains=geneIDsToDataDomains.get(davidId);
      if (mappedDataDomains.contains(currentDataDomain)) {
        Row geneRow=new Row("String_Node_Str" + i + "String_Node_Str");
        ColorRenderer geneRowColorRenderer=new ColorRenderer(new float[]{1,1,1,1},new float[]{0,0,0,1},1);
        geneRow.setRenderer(geneRowColorRenderer);
        geneRow.setPixelSizeY(GENE_ROW_HEIGHT_PIXELS);
        column.append(geneRow);
      }
 else {
        Row emptyRow=new Row("String_Node_Str" + i + "String_Node_Str");
        emptyRow.setPixelSizeY(GENE_ROW_HEIGHT_PIXELS);
        column.append(emptyRow);
      }
      if (i == 0)       heightPixels+=GENE_ROW_HEIGHT_PIXELS;
      if (j != davidIdList.size()) {
        column.append(verticalSpacing);
        if (i == 0)         heightPixels+=SPACING_PIXELS;
      }
    }
  }
  return previewRow;
}