Program: 96468
Project: 96468
Buggy source:
@Override protected void applyLayoutInternal(InternalNode[] entitiesToLayout,InternalRelationship[] relationshipsToConsider,double boundsX,double boundsY,double boundsWidth,double boundsHeight){
  BundleDependencyContentResult contentResult=this.contentProvider.getContentResult();
  Set<IBundle> rootBundles=contentResult.getBundles();
  Set<IBundle> bundlesProcessed=new HashSet<IBundle>();
  if (contentResult != null) {
    Set<ColumnHolder> columnNodes=new HashSet<ColumnHolder>();
    double columnWith=0;
    double currentX=boundsX + 0;
    double currentY=boundsY + 10;
    double maxY=boundsHeight;
    int columns=0;
    int degree=contentResult.getIncomingDegree();
    while (degree > 0) {
      Set<InternalNode> degreeNodes=new HashSet<InternalNode>();
      Set<IBundle> deps=contentResult.getIncomingDependencies().get(degree);
      for (      IBundle bundle : deps) {
        if (!bundlesProcessed.contains(bundle) && !rootBundles.contains(bundle) && lowestRanking(bundle,contentResult.getIncomingDegree(),contentResult.getIncomingDependencies()) == degree) {
          for (          InternalNode node : entitiesToLayout) {
            LayoutEntity obj=node.getLayoutEntity();
            IBundle graphBundle=(IBundle)((GraphNode)obj.getGraphData()).getData();
            if (graphBundle.equals(bundle)) {
              columnWith=Math.max(columnWith,node.getWidthInLayout());
              node.setLocation(currentX,currentY);
              bundlesProcessed.add(bundle);
              currentY=currentY + node.getHeightInLayout() + 15;
              degreeNodes.add(node);
              maxY=Math.max(currentY,maxY);
              break;
            }
          }
        }
      }
      for (      InternalNode node : degreeNodes) {
        if (node.getWidthInLayout() < columnWith) {
          double x=(columnWith - node.getWidthInLayout()) / 2;
          node.setLocation(node.getLayoutEntity().getXInLayout() + x,node.getLayoutEntity().getYInLayout());
        }
      }
      ColumnHolder holder=new ColumnHolder();
      holder.index=columns;
      holder.y=currentY;
      holder.nodes=degreeNodes;
      columnNodes.add(holder);
      columns++;
      currentY=boundsY + 10;
      if (degreeNodes.size() > 0) {
        currentX=currentX + columnWith + 30;
      }
      degree--;
      columnWith=0;
    }
    Set<InternalNode> rootNodes=new HashSet<InternalNode>();
    for (    IBundle bundle : rootBundles) {
      for (      InternalNode node : entitiesToLayout) {
        LayoutEntity obj=node.getLayoutEntity();
        IBundle graphBundle=(IBundle)((GraphNode)obj.getGraphData()).getData();
        if (graphBundle.equals(bundle)) {
          columnWith=Math.max(columnWith,node.getWidthInLayout());
          node.setLocation(currentX,currentY);
          bundlesProcessed.add(bundle);
          currentY=currentY + node.getHeightInLayout() + 15;
          maxY=Math.max(currentY,maxY);
          rootNodes.add(node);
          break;
        }
      }
    }
    for (    InternalNode node : rootNodes) {
      if (node.getWidthInLayout() < columnWith) {
        double x=(columnWith - node.getWidthInLayout()) / 2;
        node.setLocation(node.getLayoutEntity().getXInLayout() + x,node.getLayoutEntity().getYInLayout());
      }
    }
    ColumnHolder holder=new ColumnHolder();
    holder.index=columns;
    holder.y=currentY;
    holder.nodes=rootNodes;
    columnNodes.add(holder);
    currentY=boundsY + 10;
    currentX=currentX + columnWith + 30;
    int maxDegree=contentResult.getOutgoingDegree();
    degree=1;
    while (degree <= maxDegree) {
      Set<InternalNode> degreeNodes=new HashSet<InternalNode>();
      Set<IBundle> deps=contentResult.getOutgoingDependencies().get(degree);
      for (      IBundle bundle : deps) {
        if (!bundlesProcessed.contains(bundle) && !rootBundles.contains(bundle) && lowestRanking(bundle,contentResult.getOutgoingDegree(),contentResult.getOutgoingDependencies()) == degree) {
          for (          InternalNode node : entitiesToLayout) {
            LayoutEntity obj=node.getLayoutEntity();
            IBundle graphBundle=(IBundle)((GraphNode)obj.getGraphData()).getData();
            if (graphBundle.equals(bundle)) {
              columnWith=Math.max(columnWith,node.getWidthInLayout());
              node.setLocation(currentX,currentY);
              bundlesProcessed.add(bundle);
              currentY=currentY + node.getHeightInLayout() + 15;
              maxY=Math.max(currentY,maxY);
              degreeNodes.add(node);
              break;
            }
          }
        }
      }
      for (      InternalNode node : degreeNodes) {
        if (node.getWidthInLayout() < columnWith) {
          double x=(columnWith - node.getWidthInLayout()) / 2;
          node.setLocation(node.getLayoutEntity().getXInLayout() + x,node.getLayoutEntity().getYInLayout());
        }
      }
      holder=new ColumnHolder();
      holder.index=columns;
      holder.y=currentY;
      holder.nodes=degreeNodes;
      columnNodes.add(holder);
      currentY=boundsY + 10;
      currentX=currentX + columnWith + 30;
      degree++;
      columnWith=0;
    }
    for (    ColumnHolder column : columnNodes) {
      if (column.y <= maxY) {
        double y=(maxY - column.y) / 2;
        for (        InternalNode node : column.nodes) {
          node.setLocation(node.getLayoutEntity().getXInLayout(),node.getLayoutEntity().getYInLayout() + y);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void applyLayoutInternal(InternalNode[] entitiesToLayout,InternalRelationship[] relationshipsToConsider,double boundsX,double boundsY,double boundsWidth,double boundsHeight){
  BundleDependencyContentResult contentResult=this.contentProvider.getContentResult();
  if (contentResult != null) {
    Set<IBundle> rootBundles=contentResult.getBundles();
    Set<IBundle> bundlesProcessed=new HashSet<IBundle>();
    Set<ColumnHolder> columnNodes=new HashSet<ColumnHolder>();
    double columnWith=0;
    double currentX=boundsX + 0;
    double currentY=boundsY + 10;
    double maxY=boundsHeight;
    int degree=contentResult.getIncomingDegree().intValue();
    while (degree > 0) {
      Set<InternalNode> degreeNodes=new HashSet<InternalNode>();
      Set<IBundle> deps=contentResult.getIncomingDependencies().get(Integer.valueOf(degree));
      for (      IBundle bundle : deps) {
        if (!bundlesProcessed.contains(bundle) && !rootBundles.contains(bundle) && lowestRanking(bundle,degree,contentResult.getIncomingDependencies()) == degree) {
          for (          InternalNode node : entitiesToLayout) {
            LayoutEntity obj=node.getLayoutEntity();
            IBundle graphBundle=(IBundle)((GraphNode)obj.getGraphData()).getData();
            if (graphBundle.equals(bundle)) {
              columnWith=Math.max(columnWith,node.getWidthInLayout());
              node.setLocation(currentX,currentY);
              bundlesProcessed.add(bundle);
              currentY=currentY + node.getHeightInLayout() + 15;
              degreeNodes.add(node);
              maxY=Math.max(currentY,maxY);
              break;
            }
          }
        }
      }
      for (      InternalNode node : degreeNodes) {
        if (node.getWidthInLayout() < columnWith) {
          double x=(columnWith - node.getWidthInLayout()) / 2;
          node.setLocation(node.getLayoutEntity().getXInLayout() + x,node.getLayoutEntity().getYInLayout());
        }
      }
      ColumnHolder holder=new ColumnHolder();
      holder.y=currentY;
      holder.nodes=degreeNodes;
      columnNodes.add(holder);
      currentY=boundsY + 10;
      if (degreeNodes.size() > 0) {
        currentX=currentX + columnWith + 30;
      }
      degree--;
      columnWith=0;
    }
    Set<InternalNode> rootNodes=new HashSet<InternalNode>();
    for (    IBundle bundle : rootBundles) {
      for (      InternalNode node : entitiesToLayout) {
        LayoutEntity obj=node.getLayoutEntity();
        IBundle graphBundle=(IBundle)((GraphNode)obj.getGraphData()).getData();
        if (graphBundle.equals(bundle)) {
          columnWith=Math.max(columnWith,node.getWidthInLayout());
          node.setLocation(currentX,currentY);
          bundlesProcessed.add(bundle);
          currentY=currentY + node.getHeightInLayout() + 15;
          maxY=Math.max(currentY,maxY);
          rootNodes.add(node);
          break;
        }
      }
    }
    for (    InternalNode node : rootNodes) {
      if (node.getWidthInLayout() < columnWith) {
        double x=(columnWith - node.getWidthInLayout()) / 2;
        node.setLocation(node.getLayoutEntity().getXInLayout() + x,node.getLayoutEntity().getYInLayout());
      }
    }
    ColumnHolder holder=new ColumnHolder();
    holder.y=currentY;
    holder.nodes=rootNodes;
    columnNodes.add(holder);
    currentY=boundsY + 10;
    currentX=currentX + columnWith + 30;
    int maxDegree=contentResult.getOutgoingDegree();
    degree=1;
    while (degree <= maxDegree) {
      Set<InternalNode> degreeNodes=new HashSet<InternalNode>();
      Set<IBundle> deps=contentResult.getOutgoingDependencies().get(degree);
      for (      IBundle bundle : deps) {
        if (!bundlesProcessed.contains(bundle) && !rootBundles.contains(bundle) && lowestRanking(bundle,contentResult.getOutgoingDegree(),contentResult.getOutgoingDependencies()) == degree) {
          for (          InternalNode node : entitiesToLayout) {
            LayoutEntity obj=node.getLayoutEntity();
            IBundle graphBundle=(IBundle)((GraphNode)obj.getGraphData()).getData();
            if (graphBundle.equals(bundle)) {
              columnWith=Math.max(columnWith,node.getWidthInLayout());
              node.setLocation(currentX,currentY);
              bundlesProcessed.add(bundle);
              currentY=currentY + node.getHeightInLayout() + 15;
              maxY=Math.max(currentY,maxY);
              degreeNodes.add(node);
              break;
            }
          }
        }
      }
      for (      InternalNode node : degreeNodes) {
        if (node.getWidthInLayout() < columnWith) {
          double x=(columnWith - node.getWidthInLayout()) / 2;
          node.setLocation(node.getLayoutEntity().getXInLayout() + x,node.getLayoutEntity().getYInLayout());
        }
      }
      holder=new ColumnHolder();
      holder.y=currentY;
      holder.nodes=degreeNodes;
      columnNodes.add(holder);
      currentY=boundsY + 10;
      currentX=currentX + columnWith + 30;
      degree++;
      columnWith=0;
    }
    for (    ColumnHolder column : columnNodes) {
      if (column.y <= maxY) {
        double y=(maxY - column.y) / 2;
        for (        InternalNode node : column.nodes) {
          node.setLocation(node.getLayoutEntity().getXInLayout(),node.getLayoutEntity().getYInLayout() + y);
        }
      }
    }
  }
}