Program: 56960
Project: 56960
Buggy source:
/** 
 * sorts the current data
 */
void order(){
  if (!dirtyOrder)   return;
  dirtyOrder=false;
  order=null;
  int[] deltas=null;
  boolean anyDelta=false;
  orderBy=findFirstRankable();
  exaequoOffsets.clear();
  final List<IRow> data=getTable().getData();
  if (orderBy == null) {
    List<IRow> targetOrderItems=new ArrayList<>(data.size());
    for (int i=0; i < data.size(); ++i) {
      if (!filter.get(i))       continue;
      targetOrderItems.add(data.get(i));
    }
    int[] newOrder=new int[targetOrderItems.size()];
    deltas=new int[newOrder.length];
    IntIntHashMap newRanks=new IntIntHashMap(newOrder.length);
    newRanks.setKeyNotFoundValue(-1);
    for (int i=0; i < newOrder.length; ++i) {
      IRow r=targetOrderItems.get(i);
      final int ri=r.getIndex();
      newOrder[i]=ri;
      exaequoOffsets.put(i,-i);
      if (ranks.get(ri) < 0) {
        anyDelta=true;
        deltas[i]=Integer.MIN_VALUE;
      }
 else {
        int delta=i - ranks.get(ri);
        deltas[i]=delta;
        anyDelta=anyDelta || delta != 0;
      }
      newRanks.put(ri,i);
    }
    order=newOrder;
    ranks=newRanks;
  }
 else   if (orderBy instanceof IFloatRankableColumnMixin) {
    IFloatRankableColumnMixin orderByF=(IFloatRankableColumnMixin)orderBy;
    List<IntFloat> targetOrderItems=new ArrayList<>(data.size());
    for (int i=0; i < data.size(); ++i) {
      if (filter.get(i)) {
        targetOrderItems.add(new IntFloat(i,orderByF.applyPrimitive(data.get(i))));
      }
    }
    Collections.sort(targetOrderItems);
    int[] newOrder=new int[targetOrderItems.size()];
    deltas=new int[newOrder.length];
    IntIntHashMap newRanks=new IntIntHashMap(newOrder.length);
    newRanks.setKeyNotFoundValue(-1);
    int offset=0;
    float last=Float.NaN;
    for (int i=0; i < targetOrderItems.size(); ++i) {
      IntFloat pair=targetOrderItems.get(i);
      final int ri=pair.id;
      newOrder[i]=pair.id;
      if (last == pair.value) {
        offset++;
        exaequoOffsets.put(i,offset);
      }
 else {
        offset=0;
      }
      if (ranks.get(ri) < 0) {
        anyDelta=true;
        deltas[i]=Integer.MIN_VALUE;
      }
 else {
        int delta=i - ranks.get(ri);
        deltas[i]=delta;
        anyDelta=anyDelta || delta != 0;
      }
      newRanks.put(ri,i);
      last=pair.value;
    }
    order=newOrder;
    ranks=newRanks;
  }
 else {
    List<IRow> targetOrderItems=new ArrayList<>(data.size());
    for (int i=0; i < data.size(); ++i) {
      if (filter.get(i)) {
        targetOrderItems.add(data.get(i));
      }
    }
    Collections.sort(targetOrderItems,orderBy);
    int[] newOrder=new int[targetOrderItems.size()];
    deltas=new int[newOrder.length];
    IntIntHashMap newRanks=new IntIntHashMap(newOrder.length);
    newRanks.setKeyNotFoundValue(-1);
    int offset=0;
    IRow last=null;
    for (int i=0; i < targetOrderItems.size(); ++i) {
      IRow pair=targetOrderItems.get(i);
      final int ri=pair.getIndex();
      newOrder[i]=pair.getIndex();
      if (last != null && orderBy.compare(last,pair) == 0) {
        offset++;
        exaequoOffsets.put(i,offset);
      }
 else {
        offset=0;
      }
      if (ranks.get(ri) < 0) {
        anyDelta=true;
        deltas[i]=Integer.MIN_VALUE;
      }
 else {
        int delta=i - ranks.get(ri);
        deltas[i]=delta;
        anyDelta=anyDelta || delta != 0;
      }
      newRanks.put(ri,i);
      last=pair;
    }
    order=newOrder;
    ranks=newRanks;
  }
  if (anyDelta)   propertySupport.firePropertyChange(PROP_ORDER,deltas,order);
}

Fixed version (ground truth):
/** 
 * sorts the current data
 */
void order(){
  if (!dirtyOrder)   return;
  dirtyOrder=false;
  order=null;
  int[] deltas=null;
  boolean anyDelta=false;
  orderBy=findFirstRankable();
  exaequoOffsets.clear();
  final List<IRow> data=getTable().getData();
  if (orderBy == null) {
    List<IRow> targetOrderItems=new ArrayList<>(data.size());
    for (int i=0; i < data.size(); ++i) {
      if (!filter.get(i))       continue;
      targetOrderItems.add(data.get(i));
    }
    int[] newOrder=new int[targetOrderItems.size()];
    deltas=new int[newOrder.length];
    IntIntHashMap newRanks=new IntIntHashMap(newOrder.length);
    newRanks.setKeyNotFoundValue(-1);
    for (int i=0; i < newOrder.length; ++i) {
      IRow r=targetOrderItems.get(i);
      final int ri=r.getIndex();
      newOrder[i]=ri;
      exaequoOffsets.put(i,-i);
      if (ranks.get(ri) < 0) {
        anyDelta=true;
        deltas[i]=Integer.MIN_VALUE;
      }
 else {
        int delta=i - ranks.get(ri);
        deltas[i]=delta;
        anyDelta=anyDelta || delta != 0;
      }
      newRanks.put(ri,i);
    }
    order=newOrder;
    ranks=newRanks;
  }
 else   if (orderBy instanceof IFloatRankableColumnMixin && !(orderBy instanceof NestedRankColumnModel)) {
    IFloatRankableColumnMixin orderByF=(IFloatRankableColumnMixin)orderBy;
    List<IntFloat> targetOrderItems=new ArrayList<>(data.size());
    for (int i=0; i < data.size(); ++i) {
      if (filter.get(i)) {
        targetOrderItems.add(new IntFloat(i,orderByF.applyPrimitive(data.get(i))));
      }
    }
    Collections.sort(targetOrderItems);
    int[] newOrder=new int[targetOrderItems.size()];
    deltas=new int[newOrder.length];
    IntIntHashMap newRanks=new IntIntHashMap(newOrder.length);
    newRanks.setKeyNotFoundValue(-1);
    int offset=0;
    float last=Float.NaN;
    for (int i=0; i < targetOrderItems.size(); ++i) {
      IntFloat pair=targetOrderItems.get(i);
      final int ri=pair.id;
      newOrder[i]=pair.id;
      if (last == pair.value) {
        offset++;
        exaequoOffsets.put(i,offset);
      }
 else {
        offset=0;
      }
      if (ranks.get(ri) < 0) {
        anyDelta=true;
        deltas[i]=Integer.MIN_VALUE;
      }
 else {
        int delta=i - ranks.get(ri);
        deltas[i]=delta;
        anyDelta=anyDelta || delta != 0;
      }
      newRanks.put(ri,i);
      last=pair.value;
    }
    order=newOrder;
    ranks=newRanks;
  }
 else {
    List<IRow> targetOrderItems=new ArrayList<>(data.size());
    for (int i=0; i < data.size(); ++i) {
      if (filter.get(i)) {
        targetOrderItems.add(data.get(i));
      }
    }
    Collections.sort(targetOrderItems,orderBy);
    int[] newOrder=new int[targetOrderItems.size()];
    deltas=new int[newOrder.length];
    IntIntHashMap newRanks=new IntIntHashMap(newOrder.length);
    newRanks.setKeyNotFoundValue(-1);
    int offset=0;
    IRow last=null;
    for (int i=0; i < targetOrderItems.size(); ++i) {
      IRow pair=targetOrderItems.get(i);
      final int ri=pair.getIndex();
      newOrder[i]=pair.getIndex();
      if (last != null && orderBy.compare(last,pair) == 0) {
        offset++;
        exaequoOffsets.put(i,offset);
      }
 else {
        offset=0;
      }
      if (ranks.get(ri) < 0) {
        anyDelta=true;
        deltas[i]=Integer.MIN_VALUE;
      }
 else {
        int delta=i - ranks.get(ri);
        deltas[i]=delta;
        anyDelta=anyDelta || delta != 0;
      }
      newRanks.put(ri,i);
      last=pair;
    }
    order=newOrder;
    ranks=newRanks;
  }
  if (anyDelta)   propertySupport.firePropertyChange(PROP_ORDER,deltas,order);
}