Program: 57702
Project: 57702
Buggy source:
/** 
 * Sets the list of nodes that are used as the basis for rendering the mapped data. Triggers a complete re-build of the layout. Creates the layout used for the rendering.
 * @param linearizedNodes setter, see  {@link #linearizedNodes}
 */
public void setLinearizedNodes(List<ALinearizableNode> linearizedNodes){
  float[] color;
  relationShipRenderers=new ArrayList<RelationshipRenderer>(linearizedNodes.size());
  Row baseRow=new Row("String_Node_Str");
  layoutManger.setBaseElementLayout(baseRow);
  Column dataSetColumn=new Column("String_Node_Str");
  dataSetColumn.setBottomUp(false);
  baseRow.append(dataSetColumn);
  Column captionColumn=new Column("String_Node_Str");
  captionColumn.setBottomUp(false);
  captionColumn.setPixelSizeX(100);
  ElementLayout columnCaptionSpacing=new ElementLayout();
  columnCaptionSpacing.setPixelSizeY(50);
  captionColumn.append(columnCaptionSpacing);
  baseRow.append(captionColumn);
  this.linearizedNodes=linearizedNodes;
  int nodeCount=0;
  float previousNodePosition=viewFrustum.getHeight() + yOffset - parentView.getPixelGLConverter().getGLHeightForPixelHeight(50);
  int previousNrDavids=0;
  ArrayList<ArrayList<ElementLayout>> rowListForDataContainers=new ArrayList<ArrayList<ElementLayout>>((int)(usedDataContainers.size() * 1.6));
  for (  DataContainer dataContainer : usedDataContainers) {
    rowListForDataContainers.add(new ArrayList<ElementLayout>(linearizedNodes.size() * 2));
  }
  ArrayList<Integer> davidIDs=new ArrayList<Integer>(linearizedNodes.size() * 2);
  ElementLayout xSpacing=new ElementLayout();
  xSpacing.setPixelSizeX(1);
  ArrayList<ALinearizableNode> resolvedNodes=new ArrayList<ALinearizableNode>();
  for (  ALinearizableNode node : linearizedNodes) {
    if (node instanceof ComplexNode) {
      List<ALinearizableNode> embeddedNodes=((ComplexNode)node).getNodes();
      resolvedNodes.addAll(embeddedNodes);
    }
 else     resolvedNodes.add(node);
  }
  for (  ALinearizableNode node : resolvedNodes) {
    if (node.getNumAssociatedRows() == 0)     continue;
    List<Integer> subDavidIDs=node.getMappedDavidIDs();
    int currentNrDavids=subDavidIDs.size();
    davidIDs.addAll(subDavidIDs);
    float currentNodePositionY=node.getPosition().y();
    float deviation;
    if (node.getParentNode() != null) {
      currentNodePositionY=node.getParentNode().getPosition().y();
      currentNrDavids=node.getParentNode().getNumAssociatedRows();
    }
    float previousLowerHeight=previousNodePosition - rowHeight * ((float)previousNrDavids) / 2;
    float currentUpperHeight=(currentNodePositionY + rowHeight * ((float)currentNrDavids) / 2);
    deviation=previousLowerHeight - currentUpperHeight;
    if (previousNodePosition > 0 && deviation > 0) {
      ElementLayout spacing=new ElementLayout();
      spacing.setAbsoluteSizeY(deviation);
      dataSetColumn.append(spacing);
      captionColumn.append(spacing);
    }
    previousNodePosition=currentNodePositionY;
    previousNrDavids=currentNrDavids;
    if (nodeCount % 2 == 0)     color=EVEN_BACKGROUND_COLOR;
 else     color=ODD_BACKGROUND_COLOR;
    RelationshipRenderer relationShipRenderer=new RelationshipRenderer(color);
    relationShipRenderers.add(relationShipRenderer);
    float x=node.getPosition().x() + parentView.getPixelGLConverter().getGLWidthForPixelWidth(node.getWidthPixels()) / 2;
    float height=parentView.getPixelGLConverter().getGLHeightForPixelHeight(node.getHeightPixels());
    relationShipRenderer.topLeft[0]=x - xOffset;
    relationShipRenderer.topLeft[1]=node.getPosition().y() + height / 2 - yOffset;
    relationShipRenderer.bottomLeft[0]=x - xOffset;
    relationShipRenderer.bottomLeft[1]=node.getPosition().y() - height / 2 - yOffset;
    nodeCount++;
    int idCount=0;
    for (    Integer davidID : subDavidIDs) {
      Row row=new Row("String_Node_Str" + davidID);
      row.setAbsoluteSizeY(rowHeight);
      dataSetColumn.append(row);
      for (int dataContainerCount=0; dataContainerCount < usedDataContainers.size(); dataContainerCount++) {
        ElementLayout dataContainerLayout=new ElementLayout("String_Node_Str" + dataContainerCount + "String_Node_Str"+ idCount);
        dataContainerLayout.addBackgroundRenderer(new RowBackgroundRenderer(color));
        row.append(dataContainerLayout);
        rowListForDataContainers.get(dataContainerCount).add(dataContainerLayout);
        if (dataContainerCount != usedDataContainers.size() - 1) {
          row.append(xSpacing);
        }
      }
      ElementLayout rowCaption=new ElementLayout();
      rowCaption.setAbsoluteSizeY(rowHeight);
      RowCaptionRenderer captionRenderer=new RowCaptionRenderer(davidID,parentView,this,color);
      rowCaption.setRenderer(captionRenderer);
      captionColumn.append(rowCaption);
      if (idCount == 0)       relationShipRenderer.topRightLayout=row;
      if (idCount == subDavidIDs.size() - 1)       relationShipRenderer.bottomRightLayout=row;
      idCount++;
    }
  }
  ElementLayout ySpacing=new ElementLayout();
  ySpacing.setPixelSizeY(5);
  dataSetColumn.append(ySpacing);
  Row topCaptionRow=new Row("String_Node_Str");
  topCaptionRow.setPixelSizeY(50);
  dataSetColumn.add(0,topCaptionRow);
  Row bottomCaptionRow=new Row("String_Node_Str");
  bottomCaptionRow.setPixelSizeY(50);
  dataSetColumn.append(bottomCaptionRow);
  for (int dataContainerCount=0; dataContainerCount < usedDataContainers.size(); dataContainerCount++) {
    ColumnCaptionLayout topCaptionLayout=new ColumnCaptionLayout(parentView,this);
    topCaptionRow.append(topCaptionLayout);
    ColumnCaptionLayout bottomCaptionLayout=new ColumnCaptionLayout(parentView,this);
    bottomCaptionRow.append(bottomCaptionLayout);
    if (dataContainerCount != usedDataContainers.size() - 1) {
      bottomCaptionRow.append(xSpacing);
      topCaptionRow.append(xSpacing);
    }
    prepareData(usedDataContainers.get(dataContainerCount),rowListForDataContainers.get(dataContainerCount),topCaptionLayout,bottomCaptionLayout,davidIDs);
  }
}

Fixed version (ground truth):
/** 
 * Sets the list of nodes that are used as the basis for rendering the mapped data. Triggers a complete re-build of the layout. Creates the layout used for the rendering.
 * @param linearizedNodes setter, see  {@link #linearizedNodes}
 */
public void setLinearizedNodes(List<ALinearizableNode> linearizedNodes){
  float[] color;
  relationShipRenderers=new ArrayList<RelationshipRenderer>(linearizedNodes.size());
  Row baseRow=new Row("String_Node_Str");
  layoutManger.setBaseElementLayout(baseRow);
  Column dataSetColumn=new Column("String_Node_Str");
  dataSetColumn.setBottomUp(false);
  baseRow.append(dataSetColumn);
  Column captionColumn=new Column("String_Node_Str");
  captionColumn.setBottomUp(false);
  captionColumn.setPixelSizeX(100);
  ElementLayout columnCaptionSpacing=new ElementLayout();
  columnCaptionSpacing.setPixelSizeY(50);
  captionColumn.append(columnCaptionSpacing);
  baseRow.append(captionColumn);
  this.linearizedNodes=linearizedNodes;
  int nodeCount=0;
  float previousNodePosition=viewFrustum.getHeight() + yOffset - parentView.getPixelGLConverter().getGLHeightForPixelHeight(50);
  int previousNrDavids=0;
  ArrayList<ArrayList<ElementLayout>> rowListForDataContainers=new ArrayList<ArrayList<ElementLayout>>((int)(usedDataContainers.size() * 1.6));
  for (  DataContainer dataContainer : usedDataContainers) {
    rowListForDataContainers.add(new ArrayList<ElementLayout>(linearizedNodes.size() * 2));
  }
  ArrayList<Integer> davidIDs=new ArrayList<Integer>(linearizedNodes.size() * 2);
  ElementLayout xSpacing=new ElementLayout();
  xSpacing.setPixelSizeX(1);
  ArrayList<ALinearizableNode> resolvedNodes=new ArrayList<ALinearizableNode>();
  for (  ALinearizableNode node : linearizedNodes) {
    if (node instanceof ComplexNode) {
      List<ALinearizableNode> embeddedNodes=((ComplexNode)node).getNodes();
      resolvedNodes.addAll(embeddedNodes);
    }
 else     resolvedNodes.add(node);
  }
  for (  ALinearizableNode node : resolvedNodes) {
    if (node.getNumAssociatedRows() == 0)     continue;
    List<Integer> subDavidIDs=node.getMappedDavidIDs();
    int currentNrDavids=subDavidIDs.size();
    davidIDs.addAll(subDavidIDs);
    float currentNodePositionY=node.getPosition().y();
    float deviation;
    if (node.getParentNode() != null) {
      currentNodePositionY=node.getParentNode().getPosition().y();
      currentNrDavids=node.getParentNode().getNumAssociatedRows();
    }
    float previousLowerHeight=previousNodePosition - rowHeight * ((float)previousNrDavids) / 2;
    float currentUpperHeight=(currentNodePositionY + rowHeight * ((float)currentNrDavids) / 2);
    deviation=previousLowerHeight - currentUpperHeight;
    if (previousNodePosition > 0 && deviation > 0) {
      ElementLayout spacing=new ElementLayout();
      spacing.setAbsoluteSizeY(deviation);
      dataSetColumn.append(spacing);
      captionColumn.append(spacing);
    }
    previousNodePosition=currentNodePositionY;
    previousNrDavids=currentNrDavids;
    if (nodeCount % 2 == 0)     color=EVEN_BACKGROUND_COLOR;
 else     color=ODD_BACKGROUND_COLOR;
    RelationshipRenderer relationShipRenderer=new RelationshipRenderer(color,parentView);
    relationShipRenderers.add(relationShipRenderer);
    float x=node.getPosition().x() + parentView.getPixelGLConverter().getGLWidthForPixelWidth(node.getWidthPixels()) / 2;
    float height=parentView.getPixelGLConverter().getGLHeightForPixelHeight(node.getHeightPixels());
    relationShipRenderer.topLeft[0]=x - xOffset;
    relationShipRenderer.topLeft[1]=node.getPosition().y() + height / 2 - yOffset;
    relationShipRenderer.bottomLeft[0]=x - xOffset;
    relationShipRenderer.bottomLeft[1]=node.getPosition().y() - height / 2 - yOffset;
    nodeCount++;
    int idCount=0;
    for (    Integer davidID : subDavidIDs) {
      Row row=new Row("String_Node_Str" + davidID);
      row.setAbsoluteSizeY(rowHeight);
      dataSetColumn.append(row);
      for (int dataContainerCount=0; dataContainerCount < usedDataContainers.size(); dataContainerCount++) {
        ElementLayout dataContainerLayout=new ElementLayout("String_Node_Str" + dataContainerCount + "String_Node_Str"+ idCount);
        dataContainerLayout.addBackgroundRenderer(new RowBackgroundRenderer(color));
        row.append(dataContainerLayout);
        rowListForDataContainers.get(dataContainerCount).add(dataContainerLayout);
        if (dataContainerCount != usedDataContainers.size() - 1) {
          row.append(xSpacing);
        }
      }
      ElementLayout rowCaption=new ElementLayout();
      rowCaption.setAbsoluteSizeY(rowHeight);
      RowCaptionRenderer captionRenderer=new RowCaptionRenderer(davidID,parentView,this,color);
      rowCaption.setRenderer(captionRenderer);
      captionColumn.append(rowCaption);
      if (idCount == 0)       relationShipRenderer.topRightLayout=row;
      if (idCount == subDavidIDs.size() - 1)       relationShipRenderer.bottomRightLayout=row;
      idCount++;
    }
  }
  ElementLayout ySpacing=new ElementLayout();
  ySpacing.setPixelSizeY(5);
  dataSetColumn.append(ySpacing);
  Row topCaptionRow=new Row("String_Node_Str");
  topCaptionRow.setPixelSizeY(50);
  dataSetColumn.add(0,topCaptionRow);
  Row bottomCaptionRow=new Row("String_Node_Str");
  bottomCaptionRow.setPixelSizeY(50);
  dataSetColumn.append(bottomCaptionRow);
  for (int dataContainerCount=0; dataContainerCount < usedDataContainers.size(); dataContainerCount++) {
    ColumnCaptionLayout topCaptionLayout=new ColumnCaptionLayout(parentView,this);
    topCaptionRow.append(topCaptionLayout);
    ColumnCaptionLayout bottomCaptionLayout=new ColumnCaptionLayout(parentView,this);
    bottomCaptionRow.append(bottomCaptionLayout);
    if (dataContainerCount != usedDataContainers.size() - 1) {
      bottomCaptionRow.append(xSpacing);
      topCaptionRow.append(xSpacing);
    }
    prepareData(usedDataContainers.get(dataContainerCount),rowListForDataContainers.get(dataContainerCount),topCaptionLayout,bottomCaptionLayout,davidIDs);
  }
}