Program: 17754
Project: 17754
Buggy source:
/** 
 * Process a link set
 */
private SortedMap<Integer,FabricLink> defaultLinkToColumn(SortedMap<Integer,SortedSet<Integer>> rankedLinks,Map<Link,SortedMap<FabricLink.AugRelation,FabricLink>> relsForPair,HashMap<Integer,String> rowToTarg,BioFabricNetwork.RelayoutBuildData rbd){
  TreeMap<Integer,FabricLink> linkOrder=new TreeMap<Integer,FabricLink>();
  ArrayList<String> microRels;
  ArrayList<String> macroRels;
  if (rbd.layoutMode == BioFabricNetwork.LayoutMode.PER_NODE_MODE) {
    microRels=new ArrayList<String>(rbd.linkGroups);
    macroRels=null;
  }
 else   if (rbd.layoutMode == BioFabricNetwork.LayoutMode.PER_NETWORK_MODE) {
    microRels=new ArrayList<String>();
    macroRels=new ArrayList<String>(rbd.linkGroups);
  }
 else {
    microRels=new ArrayList<String>();
    macroRels=null;
  }
  if (microRels.isEmpty()) {
    microRels.add("String_Node_Str");
  }
  int numRel=microRels.size();
  int colCount=0;
  int rowCount=rbd.nodeOrder.size();
  for (int k=0; k < rowCount; k++) {
    Integer topRow=Integer.valueOf(k);
    for (int i=0; i < numRel; i++) {
      String relOnly=microRels.get(i);
      if (relOnly.equals("String_Node_Str")) {
        relOnly=null;
      }
      colCount=shadowLinkToColumn(topRow.intValue(),rankedLinks,relsForPair,relOnly,microRels,colCount,rowToTarg,rbd,linkOrder);
      SortedSet<Integer> perSrc=rankedLinks.get(topRow);
      if (perSrc == null) {
        continue;
      }
      Iterator<Integer> psit=perSrc.iterator();
      while (psit.hasNext()) {
        Integer botRow=psit.next();
        String topNode=rowToTarg.get(topRow);
        String botNode=rowToTarg.get(botRow);
        SortedMap<FabricLink.AugRelation,FabricLink> forPair1=relsForPair.get(new Link(topNode,botNode));
        if (forPair1 != null) {
          Iterator<FabricLink> fp1it=forPair1.values().iterator();
          while (fp1it.hasNext()) {
            FabricLink nextLink=fp1it.next();
            if (!nextLink.isShadow()) {
              if (bestSuffixMatch(nextLink,relOnly,microRels)) {
                Integer shadowKey=Integer.valueOf(colCount++);
                linkOrder.put(shadowKey,nextLink);
              }
            }
          }
        }
        if (!topNode.equals(botNode)) {
          SortedMap<FabricLink.AugRelation,FabricLink> forPair2=relsForPair.get(new Link(botNode,topNode));
          if (forPair2 != null) {
            Iterator<FabricLink> fp2it=forPair2.values().iterator();
            while (fp2it.hasNext()) {
              FabricLink nextLink=fp2it.next();
              if (!nextLink.isShadow()) {
                if (bestSuffixMatch(nextLink,relOnly,microRels)) {
                  Integer shadowKey=Integer.valueOf(colCount++);
                  linkOrder.put(shadowKey,nextLink);
                }
              }
            }
          }
        }
      }
    }
  }
  if (rbd.getMode() == BioFabricNetwork.BuildMode.GROUP_PER_NETWORK_CHANGE) {
    orderNetworkByGroups(linkOrder,macroRels);
  }
  return (linkOrder);
}

Fixed version (ground truth):
/** 
 * Process a link set
 */
private SortedMap<Integer,FabricLink> defaultLinkToColumn(SortedMap<Integer,SortedSet<Integer>> rankedLinks,Map<Link,SortedMap<FabricLink.AugRelation,FabricLink>> relsForPair,HashMap<Integer,String> rowToTarg,BioFabricNetwork.RelayoutBuildData rbd){
  TreeMap<Integer,FabricLink> linkOrder=new TreeMap<Integer,FabricLink>();
  ArrayList<String> microRels;
  ArrayList<String> macroRels;
  if (rbd.layoutMode == BioFabricNetwork.LayoutMode.PER_NODE_MODE) {
    microRels=new ArrayList<String>(rbd.linkGroups);
    macroRels=null;
  }
 else   if (rbd.layoutMode == BioFabricNetwork.LayoutMode.PER_NETWORK_MODE) {
    microRels=new ArrayList<String>();
    macroRels=new ArrayList<String>(rbd.linkGroups);
  }
 else {
    microRels=new ArrayList<String>();
    macroRels=null;
  }
  if (microRels.isEmpty()) {
    microRels.add("String_Node_Str");
  }
  int numRel=microRels.size();
  int colCount=0;
  int rowCount=rbd.nodeOrder.size();
  for (int k=0; k < rowCount; k++) {
    Integer topRow=Integer.valueOf(k);
    for (int i=0; i < numRel; i++) {
      String relOnly=microRels.get(i);
      if (relOnly.equals("String_Node_Str")) {
        relOnly=null;
      }
      colCount=shadowLinkToColumn(topRow.intValue(),rankedLinks,relsForPair,relOnly,microRels,colCount,rowToTarg,rbd,linkOrder);
      SortedSet<Integer> perSrc=rankedLinks.get(topRow);
      if (perSrc == null) {
        continue;
      }
      Iterator<Integer> psit=perSrc.iterator();
      while (psit.hasNext()) {
        Integer botRow=psit.next();
        String topNode=rowToTarg.get(topRow);
        String botNode=rowToTarg.get(botRow);
        SortedMap<FabricLink.AugRelation,FabricLink> forPair1=relsForPair.get(new Link(topNode,botNode));
        if (forPair1 != null) {
          Iterator<FabricLink> fp1it=forPair1.values().iterator();
          while (fp1it.hasNext()) {
            FabricLink nextLink=fp1it.next();
            if (!nextLink.isShadow()) {
              String augRel=nextLink.getAugRelation().relation;
              if (bestSuffixMatch(augRel,relOnly,microRels)) {
                Integer shadowKey=Integer.valueOf(colCount++);
                linkOrder.put(shadowKey,nextLink);
              }
            }
          }
        }
        if (!topNode.equals(botNode)) {
          SortedMap<FabricLink.AugRelation,FabricLink> forPair2=relsForPair.get(new Link(botNode,topNode));
          if (forPair2 != null) {
            Iterator<FabricLink> fp2it=forPair2.values().iterator();
            while (fp2it.hasNext()) {
              FabricLink nextLink=fp2it.next();
              if (!nextLink.isShadow()) {
                String augRel=nextLink.getAugRelation().relation;
                if (bestSuffixMatch(augRel,relOnly,microRels)) {
                  Integer shadowKey=Integer.valueOf(colCount++);
                  linkOrder.put(shadowKey,nextLink);
                }
              }
            }
          }
        }
      }
    }
  }
  if (rbd.getMode() == BioFabricNetwork.BuildMode.GROUP_PER_NETWORK_CHANGE || (macroRels != null && rbd.bfn != null && rbd.bfn.getLayoutMode().equals(BioFabricNetwork.LayoutMode.PER_NETWORK_MODE))) {
    orderNetworkByGroups(linkOrder,macroRels);
  }
  return (linkOrder);
}