Program: 17752
Project: 17752
Buggy source:
/** 
 * Build objcache
 */
public Rectangle2D buildObjCache(List<BioFabricNetwork.NodeInfo> targets,List<BioFabricNetwork.LinkInfo> links,boolean shadeNodes,boolean showShadows,BioFabricNetwork.Extents ext,Map<NID.WithName,Rectangle2D> nameMap,Map<NID.WithName,List<Rectangle2D>> drainMap,Rectangle2D netBounds,AnnotationSet nodeAnnot,AnnotationSet linkAnnot,BTProgressMonitor monitor) throws AsynchExitRequestException {
  nameKeyToPaintZero_.clear();
  nameKeyToPaintOneQuarter_.clear();
  nameKeyToPaintOneHalf_.clear();
  nameKeyToPaintFirst_.clear();
  nameKeyToPaintSecond_.clear();
  nameKeyToPaintThird_.clear();
  nameKeyCount_=0;
  ArrayList<QuadTree.Payload> qtpc=new ArrayList<QuadTree.Payload>();
  FontRenderContext frc=new FontRenderContext(new AffineTransform(),true,true);
  int numLinks=links.size();
  Map<Integer,MinMax> linkExtents=ext.allLinkExtents.get(Boolean.valueOf(showShadows));
  MinMax linkCols=ext.allLinkFullRange.get(Boolean.valueOf(showShadows));
  linkIndex_=new int[(numLinks == 0) ? 0 : linkCols.max + 1 - linkCols.min];
  indexOffset_=linkCols.min;
  Arrays.fill(linkIndex_,-1);
  linkRefs_=links;
  int numNodes=targets.size();
  LoopReporter lr=new LoopReporter(targets.size(),20,monitor,0.0,1.0,"String_Node_Str");
  HashMap<Integer,MinMax> nodeExtents=ext.allNodeExtents.get(Boolean.valueOf(showShadows));
  MinMax nodeRows=ext.allNodeFullRange.get(Boolean.valueOf(showShadows));
  for (int i=0; i < numNodes; i++) {
    BioFabricNetwork.NodeInfo node=targets.get(i);
    int num=node.nodeRow;
    lr.report();
    buildNodeTextAndRect(node,frc,colGen_,linkExtents,shadeNodes,showShadows,nameMap,drainMap,qtpc);
  }
  nodeIndex_=new int[(numNodes == 0) ? 0 : nodeRows.max + 1 - nodeRows.min];
  nodeIndexOffset_=nodeRows.min;
  Arrays.fill(nodeIndex_,-1);
  nodeRefs_=targets;
  nodesForShadow_=showShadows;
  LoopReporter lr2=new LoopReporter(numLinks,20,monitor,0.0,1.0,"String_Node_Str");
  for (int i=0; i < numLinks; i++) {
    BioFabricNetwork.LinkInfo link=links.get(i);
    lr2.report();
    linkIndex_[link.getUseColumn(showShadows) - indexOffset_]=i;
  }
  LoopReporter lr3=new LoopReporter(numLinks,20,monitor,0.0,1.0,"String_Node_Str");
  for (int i=0; i < numNodes; i++) {
    BioFabricNetwork.NodeInfo node=targets.get(i);
    lr3.report();
    nodeIndex_[node.nodeRow - nodeIndexOffset_]=i;
  }
  int annotCount=0;
  if (nodeAnnot != null) {
    LoopReporter lr4=new LoopReporter(nodeAnnot.size(),20,monitor,0.0,1.0,"String_Node_Str");
    for (    AnnotationSet.Annot an : nodeAnnot) {
      AnnotColor acol=an.getColor();
      AnnotColor col=(acol == null) ? annotColors_[annotCount++ % annotColors_.length] : acol;
      lr4.report();
      buildAnAnnotationRect(an.getRange(),an.getName(),col.getColor(),true,nodeExtents,frc,linkCols,qtpc);
    }
  }
  annotCount=0;
  Color[] useColors=(nodeAnnot != null) ? annotGrays_ : annotColors_;
  if (linkAnnot != null) {
    LoopReporter lr5=new LoopReporter(linkAnnot.size(),20,monitor,0.0,1.0,"String_Node_Str");
    for (    AnnotationSet.Annot an : linkAnnot) {
      Color col;
      if (nodeAnnot != null) {
        col=annotGrays_[annotCount++ % annotGrays_.length];
      }
 else {
        AnnotColor acol=an.getColor();
        col=(acol == null) ? annotColors_[annotCount++ % annotColors_.length].getColor() : acol.getColor();
      }
      lr5.report();
      buildAnAnnotationRect(an.getRange(),an.getName(),col,false,linkExtents,frc,nodeRows,qtpc);
    }
  }
  DoubMinMax dmmw=new DoubMinMax(netBounds.getMinX(),netBounds.getMaxX());
  DoubMinMax dmmh=new DoubMinMax(netBounds.getMinY(),netBounds.getMaxY());
  for (  QuadTree.Payload qtp : qtpc) {
    Rectangle2D qtpr=qtp.getRect();
    dmmw.update(qtpr.getMinX());
    dmmw.update(qtpr.getMaxX());
    dmmh.update(qtpr.getMinY());
    dmmh.update(qtpr.getMaxY());
  }
  Rectangle2D worldRect=new Rectangle2D.Double(dmmw.min,dmmh.min,dmmw.max - dmmw.min,dmmh.max - dmmh.min);
  names_=new QuadTree(worldRect,5);
  for (  QuadTree.Payload qtp : qtpc) {
    names_.insertPayload(qtp);
  }
  qtpc.clear();
  return (worldRect);
}

Fixed version (ground truth):
/** 
 * Build objcache
 */
public Rectangle2D buildObjCache(List<BioFabricNetwork.NodeInfo> targets,List<BioFabricNetwork.LinkInfo> links,boolean shadeNodes,boolean showShadows,BioFabricNetwork.Extents ext,Map<NID.WithName,Rectangle2D> nameMap,Map<NID.WithName,List<Rectangle2D>> drainMap,Rectangle2D netBounds,AnnotationSet nodeAnnot,AnnotationSet linkAnnot,BTProgressMonitor monitor) throws AsynchExitRequestException {
  nameKeyToPaintZero_.clear();
  nameKeyToPaintOneQuarter_.clear();
  nameKeyToPaintOneHalf_.clear();
  nameKeyToPaintFirst_.clear();
  nameKeyToPaintSecond_.clear();
  nameKeyToPaintThird_.clear();
  nameKeyCount_=0;
  ArrayList<QuadTree.Payload> qtpc=new ArrayList<QuadTree.Payload>();
  FontRenderContext frc=new FontRenderContext(new AffineTransform(),true,true);
  int numLinks=links.size();
  Map<Integer,MinMax> linkExtents=ext.allLinkExtents.get(Boolean.valueOf(showShadows));
  MinMax linkCols=ext.allLinkFullRange.get(Boolean.valueOf(showShadows));
  linkIndex_=new int[(numLinks == 0) ? 0 : linkCols.max + 1 - linkCols.min];
  indexOffset_=linkCols.min;
  Arrays.fill(linkIndex_,-1);
  linkRefs_=links;
  int numNodes=targets.size();
  LoopReporter lr=new LoopReporter(targets.size(),20,monitor,0.0,1.0,"String_Node_Str");
  HashMap<Integer,MinMax> nodeExtents=ext.allNodeExtents.get(Boolean.valueOf(showShadows));
  MinMax nodeRows=ext.allNodeFullRange.get(Boolean.valueOf(showShadows));
  for (int i=0; i < numNodes; i++) {
    BioFabricNetwork.NodeInfo node=targets.get(i);
    int num=node.nodeRow;
    lr.report();
    buildNodeTextAndRect(node,frc,colGen_,linkExtents,shadeNodes,showShadows,nameMap,drainMap,qtpc);
  }
  nodeIndex_=new int[(numNodes == 0) ? 0 : nodeRows.max + 1 - nodeRows.min];
  nodeIndexOffset_=nodeRows.min;
  Arrays.fill(nodeIndex_,-1);
  nodeRefs_=targets;
  nodesForShadow_=showShadows;
  LoopReporter lr2=new LoopReporter(numLinks,20,monitor,0.0,1.0,"String_Node_Str");
  for (int i=0; i < numLinks; i++) {
    BioFabricNetwork.LinkInfo link=links.get(i);
    lr2.report();
    linkIndex_[link.getUseColumn(showShadows) - indexOffset_]=i;
  }
  LoopReporter lr3=new LoopReporter(numLinks,20,monitor,0.0,1.0,"String_Node_Str");
  for (int i=0; i < numNodes; i++) {
    BioFabricNetwork.NodeInfo node=targets.get(i);
    lr3.report();
    nodeIndex_[node.nodeRow - nodeIndexOffset_]=i;
  }
  int annotCount=0;
  if (nodeAnnot != null) {
    LoopReporter lr4=new LoopReporter(nodeAnnot.size(),20,monitor,0.0,1.0,"String_Node_Str");
    for (    AnnotationSet.Annot an : nodeAnnot) {
      AnnotColor acol=an.getColor();
      AnnotColor col=(acol == null) ? annotColors_[annotCount++ % annotColors_.length] : acol;
      lr4.report();
      buildAnAnnotationRect(an.getRange(),an.getName(),col.getColor(),true,nodeExtents,frc,linkCols,qtpc);
    }
  }
  annotCount=0;
  if (linkAnnot != null) {
    LoopReporter lr5=new LoopReporter(linkAnnot.size(),20,monitor,0.0,1.0,"String_Node_Str");
    for (    AnnotationSet.Annot an : linkAnnot) {
      Color col;
      if (nodeAnnot != null) {
        col=annotGrays_[annotCount++ % annotGrays_.length];
      }
 else {
        AnnotColor acol=an.getColor();
        col=(acol == null) ? annotColors_[annotCount++ % annotColors_.length].getColor() : acol.getColor();
      }
      lr5.report();
      buildAnAnnotationRect(an.getRange(),an.getName(),col,false,linkExtents,frc,nodeRows,qtpc);
    }
  }
  DoubMinMax dmmw=new DoubMinMax(netBounds.getMinX(),netBounds.getMaxX());
  DoubMinMax dmmh=new DoubMinMax(netBounds.getMinY(),netBounds.getMaxY());
  for (  QuadTree.Payload qtp : qtpc) {
    Rectangle2D qtpr=qtp.getRect();
    dmmw.update(qtpr.getMinX());
    dmmw.update(qtpr.getMaxX());
    dmmh.update(qtpr.getMinY());
    dmmh.update(qtpr.getMaxY());
  }
  Rectangle2D worldRect=new Rectangle2D.Double(dmmw.min,dmmh.min,dmmw.max - dmmw.min,dmmh.max - dmmh.min);
  names_=new QuadTree(worldRect,5);
  for (  QuadTree.Payload qtp : qtpc) {
    names_.insertPayload(qtp);
  }
  qtpc.clear();
  return (worldRect);
}