nus-yam/ex-repair huggingface dataset:
Program: 56719
Project: 56719
Buggy source:
@Override public boolean isBuildingPlaceable(ISPosition2D position,byte player){
  return !blockedGrid.isBlocked(position.getX(),position.getY()) && partitionsGrid.getPlayerAt(position) == player;
}

Fixed version (ground truth):
@Override public boolean isBuildingPlaceable(ISPosition2D position,byte player){
  short x=position.getX(), y=position.getY();
  return MainGrid.this.isInBounds(x,y) && !blockedGrid.isBlocked(x,y) && partitionsGrid.getPlayerAt(x,y) == player;
}
Program: 56720
Project: 56720
Buggy source:
@Override public IMapObjectsManagerTile getTile(final short x,final short y){
  return new IMapObjectsManagerTile(){
    @Override public void setLandscape(    ELandscapeType landscapeType){
      landscapeGrid.setLandscapeTypeAt(x,y,landscapeType);
    }
    @Override public void setBlocked(    boolean blocked){
      blockedGrid.setBlocked(x,y,blocked);
    }
    @Override public AbstractHexMapObject removeMapObjectType(    EMapObjectType mapObjectType){
      return objectsGrid.removeMapObjectType(x,y,mapObjectType);
    }
    @Override public boolean removeMapObject(    AbstractHexMapObject mapObject){
      return objectsGrid.removeMapObjectType(x,y,mapObject);
    }
    @Override public boolean isBlocked(){
      return blockedGrid.isBlocked(x,y);
    }
    @Override public AbstractHexMapObject getMapObject(    EMapObjectType mapObjectType){
      return objectsGrid.getMapObjectAt(x,y,mapObjectType);
    }
    @Override public void addMapObject(    AbstractHexMapObject mapObject){
      objectsGrid.addMapObjectAt(x,y,mapObject);
    }
  }
;
}

Fixed version (ground truth):
@Override public IMapObjectsManagerTile getTile(final short x,final short y){
  return new IMapObjectsManagerTile(){
    @Override public void setLandscape(    ELandscapeType landscapeType){
      landscapeGrid.setLandscapeTypeAt(x,y,landscapeType);
    }
    @Override public void setBlocked(    boolean blocked){
      blockedGrid.setBlocked(x,y,blocked);
    }
    @Override public AbstractHexMapObject removeMapObjectType(    EMapObjectType mapObjectType){
      return objectsGrid.removeMapObjectType(x,y,mapObjectType);
    }
    @Override public boolean removeMapObject(    AbstractHexMapObject mapObject){
      return objectsGrid.removeMapObject(x,y,mapObject);
    }
    @Override public boolean isBlocked(){
      return blockedGrid.isBlocked(x,y);
    }
    @Override public AbstractHexMapObject getMapObject(    EMapObjectType mapObjectType){
      return objectsGrid.getMapObjectAt(x,y,mapObjectType);
    }
    @Override public void addMapObject(    AbstractHexMapObject mapObject){
      objectsGrid.addMapObjectAt(x,y,mapObject);
    }
  }
;
}
Program: 56721
Project: 56721
Buggy source:
@Override public boolean removeMapObject(AbstractHexMapObject mapObject){
  return objectsGrid.removeMapObjectType(x,y,mapObject);
}

Fixed version (ground truth):
@Override public boolean removeMapObject(AbstractHexMapObject mapObject){
  return objectsGrid.removeMapObject(x,y,mapObject);
}
Program: 56722
Project: 56722
Buggy source:
public boolean removeMapObjectType(short x,short y,AbstractHexMapObject mapObject){
  AbstractHexMapObject mapObjectHead=objectsGrid[x][y];
  if (mapObjectHead != null) {
    boolean removed;
    if (mapObjectHead == mapObject) {
      mapObjectHead=mapObjectHead.getNextObject();
      removed=true;
    }
 else {
      removed=mapObjectHead.removeMapObject(mapObject);
    }
    return removed;
  }
 else   return false;
}

Fixed version (ground truth):
public AbstractHexMapObject removeMapObjectType(short x,short y,EMapObjectType mapObjectType){
  AbstractHexMapObject mapObjectHead=objectsGrid[x][y];
  AbstractHexMapObject removed=null;
  if (mapObjectHead != null) {
    if (mapObjectHead.getObjectType() == mapObjectType) {
      removed=mapObjectHead;
      objectsGrid[x][y]=mapObjectHead.getNextObject();
    }
 else {
      removed=mapObjectHead.removeMapObjectType(mapObjectType);
    }
  }
  return removed;
}
Program: 56723
Project: 56723
Buggy source:
public void removeMapObjectType(ISPosition2D pos,EMapObjectType mapObjectType){
  AbstractHexMapObject removed=getTile(pos).removeMapObjectType(mapObjectType);
  if (removed != null) {
    setBlockedForObject(pos,removed,false);
  }
}

Fixed version (ground truth):
public void removeMapObjectType(ISPosition2D pos,EMapObjectType mapObjectType){
  AbstractHexMapObject removed=getTile(pos).removeMapObjectType(mapObjectType);
  if (removed != null) {
    setBlockedForObject(pos,removed,false);
    AbstractHexMapObject object=getTile(pos).getMapObject(mapObjectType);
    System.out.println("String_Node_Str");
  }
}
Program: 56724
Project: 56724
Buggy source:
@Override public void run(){
  while (!canceled) {
    if (!positionsQueue.isEmpty()) {
      ISPosition2D position=positionsQueue.poll();
      byte player=grid.getPlayer(position.getX(),position.getY());
      boolean isBorder=false;
      for (      EDirection currDir : EDirection.values()) {
        short currNeighborX=currDir.getNextTileX(position.getX());
        short currNeighborY=currDir.getNextTileY(position.getY());
        byte neighborPlayer=grid.getPlayer(currNeighborX,currNeighborY);
        boolean neighborIsBorder=false;
        if (neighborPlayer >= 0) {
          if (neighborPlayer != player) {
            isBorder=true;
          }
          for (          EDirection currNeighborDir : EDirection.values()) {
            if (grid.getPlayer(currNeighborDir.getNextTileX(currNeighborX),currNeighborDir.getNextTileY(currNeighborY)) != neighborPlayer) {
              neighborIsBorder=true;
              break;
            }
          }
        }
        grid.setBorder(currNeighborX,currNeighborY,neighborIsBorder);
      }
      grid.setBorder(position.getX(),position.getY(),isBorder && player >= 0);
    }
 else {
      try {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!canceled) {
    if (!positionsQueue.isEmpty()) {
      ISPosition2D position=positionsQueue.poll();
      byte player=grid.getPlayer(position.getX(),position.getY());
      boolean isBorder=false;
      for (      EDirection currDir : EDirection.values()) {
        short currNeighborX=currDir.getNextTileX(position.getX());
        short currNeighborY=currDir.getNextTileY(position.getY());
        if (!grid.isInBounds(currNeighborX,currNeighborY)) {
          continue;
        }
        byte neighborPlayer=grid.getPlayer(currNeighborX,currNeighborY);
        boolean neighborIsBorder=false;
        if (neighborPlayer >= 0) {
          if (neighborPlayer != player) {
            isBorder=true;
          }
          for (          EDirection currNeighborDir : EDirection.values()) {
            short nextX=currNeighborDir.getNextTileX(currNeighborX);
            short nextY=currNeighborDir.getNextTileY(currNeighborY);
            if (grid.isInBounds(nextX,nextY) && grid.getPlayer(nextX,nextY) != neighborPlayer) {
              neighborIsBorder=true;
              break;
            }
          }
        }
        grid.setBorder(currNeighborX,currNeighborY,neighborIsBorder);
      }
      grid.setBorder(position.getX(),position.getY(),isBorder && player >= 0);
    }
 else {
      try {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 56725
Project: 56725
Buggy source:
public void addMapObjectAt(short x,short y,AbstractHexMapObject mapObject){
  AbstractHexMapObject mapObjectHead=objectsGrid[x][y];
  if (mapObjectHead == null) {
    mapObjectHead=mapObject;
  }
 else {
    mapObjectHead.addMapObject(mapObject);
  }
}

Fixed version (ground truth):
public void addMapObjectAt(short x,short y,AbstractHexMapObject mapObject){
  AbstractHexMapObject mapObjectHead=objectsGrid[x][y];
  if (mapObjectHead == null) {
    objectsGrid[x][y]=mapObject;
  }
 else {
    mapObjectHead.addMapObject(mapObject);
  }
}
Program: 56726
Project: 56726
Buggy source:
@Override public byte getHeightAt(short x,short y){
  return 0;
}

Fixed version (ground truth):
@Override public byte getHeightAt(int x,int y){
  return 0;
}
Program: 56727
Project: 56727
Buggy source:
@Override public byte getPlayerAt(short x,short y){
  return 0;
}

Fixed version (ground truth):
@Override public byte getPlayerAt(int x,int y){
  return 0;
}
Program: 56728
Project: 56728
Buggy source:
@Override public IMapObject getMapObjectsAt(short x,short y){
  return tiles[x][y].getHeadMapObject();
}

Fixed version (ground truth):
@Override public IMapObject getMapObjectsAt(int x,int y){
  return tiles[x][y].getHeadMapObject();
}
Program: 56729
Project: 56729
Buggy source:
@Override public Color getDebugColorAt(short x,short y){
  return tiles[x][y].getDebugColor();
}

Fixed version (ground truth):
@Override public Color getDebugColorAt(int x,int y){
  return tiles[x][y].getDebugColor();
}
Program: 56730
Project: 56730
Buggy source:
@Override public IMovable getMovableAt(short x,short y){
  return null;
}

Fixed version (ground truth):
@Override public IMovable getMovableAt(int x,int y){
  return null;
}
Program: 56731
Project: 56731
Buggy source:
@Override public ELandscapeType getLandscapeTypeAt(short x,short y){
  return ELandscapeType.GRASS;
}

Fixed version (ground truth):
@Override public ELandscapeType getLandscapeTypeAt(int x,int y){
  return ELandscapeType.GRASS;
}
Program: 56732
Project: 56732
Buggy source:
@Override public boolean isBorder(short x,short y){
  return false;
}

Fixed version (ground truth):
@Override public boolean isBorder(int x,int y){
  return false;
}
Program: 56733
Project: 56733
Buggy source:
public boolean pushMaterial(ISPosition2D position,EMaterialType materialType){
  StackMapObject stackObject=(StackMapObject)grid.getTile(position.getX(),position.getY()).getMapObject(EMapObjectType.STACK_OBJECT);
  if (stackObject == null) {
    stackObject=new StackMapObject(materialType,(byte)1);
    return true;
  }
 else {
    if (stackObject.getMaterialType() != materialType || stackObject.isFull()) {
      return false;
    }
 else {
      stackObject.increment();
      return true;
    }
  }
}

Fixed version (ground truth):
public boolean pushMaterial(ISPosition2D position,EMaterialType materialType){
  StackMapObject stackObject=(StackMapObject)grid.getTile(position.getX(),position.getY()).getMapObject(EMapObjectType.STACK_OBJECT);
  if (stackObject == null) {
    grid.getTile(position.getX(),position.getY()).addMapObject(new StackMapObject(materialType,(byte)1));
    return true;
  }
 else {
    if (stackObject.getMaterialType() != materialType || stackObject.isFull()) {
      return false;
    }
 else {
      stackObject.increment();
      return true;
    }
  }
}
Program: 56734
Project: 56734
Buggy source:
@Override public void run(){
  while (!canceled) {
    if (!positionsQueue.isEmpty()) {
      ISPosition2D position=positionsQueue.poll();
      byte player=grid.getPlayer(position.getX(),position.getY());
      boolean isBorder=false;
      for (      EDirection currDir : EDirection.values()) {
        short currNeighborX=currDir.getNextTileX(position.getX());
        short currNeighborY=currDir.getNextTileY(position.getY());
        byte neighborPlayer=grid.getPlayer(currNeighborX,currNeighborY);
        boolean neighborIsBorder=false;
        if (neighborPlayer != player) {
          isBorder=true;
        }
        for (        EDirection currNeighborDir : EDirection.values()) {
          if (grid.getPlayer(currNeighborDir.getNextTileX(currNeighborX),currNeighborDir.getNextTileY(currNeighborY)) != neighborPlayer) {
            neighborIsBorder=true;
            break;
          }
        }
        grid.setBorder(currNeighborX,currNeighborY,neighborIsBorder);
      }
      grid.setBorder(position.getX(),position.getY(),isBorder);
    }
 else {
      try {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!canceled) {
    if (!positionsQueue.isEmpty()) {
      ISPosition2D position=positionsQueue.poll();
      byte player=grid.getPlayer(position.getX(),position.getY());
      boolean isBorder=false;
      for (      EDirection currDir : EDirection.values()) {
        short currNeighborX=currDir.getNextTileX(position.getX());
        short currNeighborY=currDir.getNextTileY(position.getY());
        byte neighborPlayer=grid.getPlayer(currNeighborX,currNeighborY);
        boolean neighborIsBorder=false;
        if (neighborPlayer >= 0) {
          if (neighborPlayer != player) {
            isBorder=true;
          }
          for (          EDirection currNeighborDir : EDirection.values()) {
            if (grid.getPlayer(currNeighborDir.getNextTileX(currNeighborX),currNeighborDir.getNextTileY(currNeighborY)) != neighborPlayer) {
              neighborIsBorder=true;
              break;
            }
          }
        }
        grid.setBorder(currNeighborX,currNeighborY,neighborIsBorder);
      }
      grid.setBorder(position.getX(),position.getY(),isBorder && player >= 0);
    }
 else {
      try {
        Thread.sleep(50);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 56735
Project: 56735
Buggy source:
@Override public byte getHeightAt(short x,short y){
  return getTile(x,y).getHeight();
}

Fixed version (ground truth):
@Override public byte getHeightAt(int x,int y){
  return getTile(x,y).getHeight();
}
Program: 56736
Project: 56736
Buggy source:
@Override public boolean isBorder(short x,short y){
  return false;
}

Fixed version (ground truth):
@Override public boolean isBorder(int x,int y){
  return false;
}
Program: 56737
Project: 56737
Buggy source:
@Override public IMapObject getMapObjectsAt(short x,short y){
  return getTile(x,y).getHeadMapObject();
}

Fixed version (ground truth):
@Override public IMapObject getMapObjectsAt(int x,int y){
  return getTile(x,y).getHeadMapObject();
}
Program: 56738
Project: 56738
Buggy source:
@Override public byte getPlayerAt(short x,short y){
  return 0;
}

Fixed version (ground truth):
@Override public byte getPlayerAt(int x,int y){
  return 0;
}
Program: 56739
Project: 56739
Buggy source:
@Override public Color getDebugColorAt(short x,short y){
  return null;
}

Fixed version (ground truth):
@Override public Color getDebugColorAt(int x,int y){
  return null;
}
Program: 56740
Project: 56740
Buggy source:
@Override public IMovable getMovableAt(short x,short y){
  return getTile(x,y).getMovable();
}

Fixed version (ground truth):
@Override public IMovable getMovableAt(int x,int y){
  return getTile(x,y).getMovable();
}
Program: 56741
Project: 56741
Buggy source:
@Override public ELandscapeType getLandscapeTypeAt(short x,short y){
  return getTile(x,y).getLandscapeType();
}

Fixed version (ground truth):
@Override public ELandscapeType getLandscapeTypeAt(int x,int y){
  return getTile(x,y).getLandscapeType();
}
Program: 56742
Project: 56742
Buggy source:
private void setPositionsToMap(boolean[][] areaMap,List<ISPosition2D> positions2){
  for (  ISPosition2D curr : positions) {
    areaMap[getMapX(curr)][getMapY(curr)]=true;
  }
}

Fixed version (ground truth):
private void setPositionsToMap(boolean[][] areaMap,List<ISPosition2D> positions){
  for (  ISPosition2D curr : positions) {
    areaMap[getMapX(curr)][getMapY(curr)]=true;
  }
}
Program: 56744
Project: 56744
Buggy source:
public void stopAll() throws Exception {
  for (  Integer i : runningMonitors.keySet()) {
    LOG.debug("String_Node_Str");
    runningMonitors.get(i).stop();
    monitorFutures.get(i).get();
  }
}

Fixed version (ground truth):
public void stopAll() throws Exception {
  for (  Integer i : runningMonitors.keySet()) {
    StreamMonitor monitor=runningMonitors.get(i);
    LOG.debug("String_Node_Str" + monitor.getConfig().getStreamName() + "String_Node_Str");
    monitor.stop();
    monitorFutures.get(i).get();
    LOG.debug("String_Node_Str" + monitor.getConfig().getStreamName() + "String_Node_Str");
  }
}
Program: 56745
Project: 56745
Buggy source:
public void startMonitors(){
  try {
    int i=0;
    for (    AutoscalingConfiguration c : this.config) {
      StreamMonitor monitor;
      try {
        LOG.info(String.format("String_Node_Str",c.getStreamName()));
        monitor=new StreamMonitor(c,executor);
        runningMonitors.put(i,monitor);
        monitorFutures.put(i,executor.submit(monitor));
        i++;
      }
 catch (      Exception e) {
        LOG.error(e);
      }
    }
    while (true) {
      for (      Integer n : monitorFutures.keySet()) {
        if (monitorFutures.get(n) == null) {
          throw new InterruptedException("String_Node_Str");
        }
 else {
          if (monitorFutures.get(n).isDone()) {
            if (runningMonitors.get(n).getException() != null) {
              throw new InterruptedException(runningMonitors.get(n).getException().getMessage());
            }
          }
        }
      }
      Thread.sleep(60000);
    }
  }
 catch (  InterruptedException e) {
    try {
      stopAll();
      LOG.error(e);
      LOG.error("String_Node_Str");
      executor.shutdown();
    }
 catch (    Exception e1) {
      LOG.error(e);
    }
  }
}

Fixed version (ground truth):
public void startMonitors(){
  try {
    int i=0;
    for (    AutoscalingConfiguration c : this.config) {
      StreamMonitor monitor;
      try {
        LOG.info(String.format("String_Node_Str",c.getStreamName()));
        monitor=new StreamMonitor(c,executor);
        runningMonitors.put(i,monitor);
        monitorFutures.put(i,executor.submit(monitor));
        i++;
      }
 catch (      Exception e) {
        LOG.error(e);
      }
    }
    while (true) {
      for (      Integer n : monitorFutures.keySet()) {
        if (monitorFutures.get(n) == null) {
          throw new InterruptedException("String_Node_Str");
        }
 else {
          if (monitorFutures.get(n).isDone()) {
            if (runningMonitors.get(n).getException() != null) {
              throw new InterruptedException(runningMonitors.get(n).getException().getMessage());
            }
          }
        }
      }
      Thread.sleep(60000);
    }
  }
 catch (  InterruptedException e) {
    try {
      stopAll();
      LOG.debug(e);
      LOG.info("String_Node_Str");
      executor.shutdown();
    }
 catch (    Exception e1) {
      LOG.error(e);
    }
  }
}
Program: 56746
Project: 56746
Buggy source:
public void stop(){
  this.keepRunning=false;
  LOG.info(String.format("String_Node_Str",config.getStreamName()));
}

Fixed version (ground truth):
public void stop(){
  this.keepRunning=false;
  this.kinesisClient.shutdown();
  this.cloudWatchClient.shutdown();
  IdleConnectionReaper.shutdown();
  LOG.info(String.format("String_Node_Str",config.getStreamName()));
}
Program: 56748
Project: 56748
Buggy source:
@Override public void contextDestroyed(ServletContextEvent arg0){
  streamMonitorController.interrupt();
}

Fixed version (ground truth):
@Override public void contextDestroyed(ServletContextEvent arg0){
  streamMonitorController.interrupt();
  try {
    streamMonitorController.join();
  }
 catch (  InterruptedException e) {
  }
}
Program: 56749
Project: 56749
Buggy source:
public static Double getPctOfKeyspace(BigInteger hashWidth){
  return new BigDecimal(hashWidth).divide(new BigDecimal(maxHash),6,RoundingMode.HALF_UP).doubleValue();
}

Fixed version (ground truth):
public static Double getPctOfKeyspace(BigInteger hashWidth){
  return new BigDecimal(hashWidth).divide(new BigDecimal(maxHash),StreamScalingUtils.PCT_COMPARISON_SCALE,StreamScalingUtils.ROUNDING_MODE).doubleValue();
}
Program: 56750
Project: 56750
Buggy source:
/** 
 * Method to do a fuzzy comparison between two doubles, so that we can make generalisations about allocation of keyspace to shards. For example, when we have a stream of 3 shards, we'll have shards of 33, 33, and 34% of the keyspace - these must all be treated as equal
 * @param a
 * @param b
 * @return
 */
public static int softCompare(double a,double b){
  final int pctComparisonScale=4;
  final RoundingMode roundingMode=RoundingMode.HALF_DOWN;
  final BigDecimal acceptedVariation=BigDecimal.valueOf(1d).divide(BigDecimal.valueOf(10d).pow(pctComparisonScale - 1));
  BigDecimal first=new BigDecimal(a).setScale(pctComparisonScale,roundingMode);
  BigDecimal second=new BigDecimal(b).setScale(pctComparisonScale,roundingMode);
  BigDecimal variation=first.subtract(second).abs();
  if (variation.compareTo(acceptedVariation) < 0) {
    return 0;
  }
 else {
    return first.compareTo(second);
  }
}

Fixed version (ground truth):
/** 
 * Method to do a fuzzy comparison between two doubles, so that we can make generalisations about allocation of keyspace to shards. For example, when we have a stream of 3 shards, we'll have shards of 33, 33, and 34% of the keyspace - these must all be treated as equal
 * @param a
 * @param b
 * @return
 */
public static int softCompare(double a,double b){
  final BigDecimal acceptedVariation=BigDecimal.valueOf(1d).divide(BigDecimal.valueOf(10d).pow(PCT_COMPARISON_SCALE - 1));
  BigDecimal first=new BigDecimal(a).setScale(PCT_COMPARISON_SCALE,ROUNDING_MODE);
  BigDecimal second=new BigDecimal(b).setScale(PCT_COMPARISON_SCALE,ROUNDING_MODE);
  BigDecimal variation=first.subtract(second).abs();
  if (variation.compareTo(acceptedVariation) < 0) {
    return 0;
  }
 else {
    return first.compareTo(second);
  }
}
Program: 56751
Project: 56751
Buggy source:
/** 
 * @return      a calculated split factor value which is equal to numerator divided by denumerator
 */
public BigDecimal getSplitFactor(){
  return numerator.divide(denumerator);
}

Fixed version (ground truth):
/** 
 * @return      a calculated split factor value which is equal to numerator divided by denominator
 */
public BigDecimal getSplitFactor(){
  return numerator.divide(denominator,10,RoundingMode.HALF_UP);
}
Program: 56752
Project: 56752
Buggy source:
public HistoricalSplit(String symbol,Calendar date,BigDecimal numerator,BigDecimal denumerator){
  this.symbol=symbol;
  this.date=date;
  this.numerator=numerator;
  this.denumerator=denumerator;
}

Fixed version (ground truth):
public HistoricalSplit(String symbol,Calendar date,BigDecimal numerator,BigDecimal denominator){
  this.symbol=symbol;
  this.date=date;
  this.numerator=numerator;
  this.denominator=denominator;
}
Program: 56753
Project: 56753
Buggy source:
@Override public String toString(){
  SimpleDateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
  String dateStr=dateFormat.format(this.date.getTime());
  return "String_Node_Str" + this.symbol + "String_Node_Str"+ dateStr+ "String_Node_Str"+ this.numerator+ "String_Node_Str"+ this.denumerator;
}

Fixed version (ground truth):
@Override public String toString(){
  SimpleDateFormat dateFormat=new SimpleDateFormat("String_Node_Str");
  String dateStr=dateFormat.format(this.date.getTime());
  return "String_Node_Str" + this.symbol + "String_Node_Str"+ dateStr+ "String_Node_Str"+ this.numerator+ "String_Node_Str"+ this.denominator;
}
Program: 56756
Project: 56756
Buggy source:
public static BigDecimal getBigDecimal(String data){
  BigDecimal result=BigDecimal.ZERO;
  if (!Utils.isParseable(data)) {
    return result;
  }
  try {
    data=Utils.cleanNumberString(data);
    char lastChar=data.charAt(data.length() - 1);
    BigDecimal multiplier=BigDecimal.ONE;
switch (lastChar) {
case 'B':
      data=data.substring(0,data.length() - 1);
    multiplier=new BigDecimal(1000000000);
  break;
case 'M':
data=data.substring(0,data.length() - 1);
multiplier=new BigDecimal(1000000);
break;
case 'K':
data=data.substring(0,data.length() - 1);
multiplier=new BigDecimal(1000);
break;
}
result=new BigDecimal(data).multiply(multiplier);
}
 catch (NumberFormatException e) {
YahooFinance.logger.log(Level.INFO,"String_Node_Str" + data,e);
}
return result;
}

Fixed version (ground truth):
public static BigDecimal getBigDecimal(String data){
  BigDecimal result=BigDecimal.ZERO;
  if (!Utils.isParseable(data)) {
    return result;
  }
  try {
    data=Utils.cleanNumberString(data);
    char lastChar=data.charAt(data.length() - 1);
    BigDecimal multiplier=BigDecimal.ONE;
switch (lastChar) {
case 'B':
      data=data.substring(0,data.length() - 1);
    multiplier=BILLION;
  break;
case 'M':
data=data.substring(0,data.length() - 1);
multiplier=MILLION;
break;
case 'K':
data=data.substring(0,data.length() - 1);
multiplier=THOUSAND;
break;
}
result=new BigDecimal(data).multiply(multiplier);
}
 catch (NumberFormatException e) {
YahooFinance.logger.log(Level.INFO,"String_Node_Str" + data,e);
}
return result;
}
Program: 56757
Project: 56757
Buggy source:
public static double getPercent(double numerator,double denominator){
  if (denominator == 0) {
    return 0;
  }
  return numerator / denominator;
}

Fixed version (ground truth):
public static double getPercent(double numerator,double denominator){
  if (denominator == 0) {
    return 0;
  }
  return (numerator / denominator) * 100;
}
Program: 56758
Project: 56758
Buggy source:
private Object loadProperty(String stringValue){
  Object boundValue;
  try {
    boundValue=Long.parseLong(stringValue);
  }
 catch (  NumberFormatException ex1) {
    try {
      boundValue=Double.parseDouble(stringValue);
    }
 catch (    NumberFormatException ex2) {
      try {
        boundValue=Boolean.parseBoolean(stringValue);
      }
 catch (      NumberFormatException ex3) {
        boundValue=stringValue;
      }
    }
  }
  return boundValue;
}

Fixed version (ground truth):
private Object loadProperty(String stringValue){
  Object boundValue=stringValue;
  try {
    boundValue=Long.parseLong(stringValue);
  }
 catch (  NumberFormatException ex1) {
    try {
      boundValue=Double.parseDouble(stringValue);
    }
 catch (    NumberFormatException ex2) {
      if (stringValue.equalsIgnoreCase("String_Node_Str")) {
        boundValue=Boolean.TRUE;
      }
 else       if (stringValue.equalsIgnoreCase("String_Node_Str")) {
        boundValue=Boolean.FALSE;
      }
    }
  }
  return boundValue;
}
Program: 56759
Project: 56759
Buggy source:
public static String unescape(CharSequence escaped){
switch (escaped.charAt(0)) {
case '"':
    return "String_Node_Str";
case '\\':
  return "String_Node_Str";
case '/':
return "String_Node_Str";
case 'b':
return "String_Node_Str";
case 'n':
return "String_Node_Str";
case 'r':
return "String_Node_Str";
case 't':
return "String_Node_Str";
case 'f':
return "String_Node_Str";
case 'u':
return Character.toString((char)parseInt(escaped.subSequence(2,escaped.length()).toString(),16));
default :
throw new UnsupportedOperationException();
}
}

Fixed version (ground truth):
public static String unescape(CharSequence escaped){
switch (escaped.charAt(0)) {
case '"':
    return "String_Node_Str";
case '\\':
  return "String_Node_Str";
case '/':
return "String_Node_Str";
case 'b':
return "String_Node_Str";
case 'n':
return "String_Node_Str";
case 'r':
return "String_Node_Str";
case 't':
return "String_Node_Str";
case 'f':
return "String_Node_Str";
case 'u':
return Character.toString((char)parseInt(escaped.subSequence(1,escaped.length()).toString(),16));
default :
throw new UnsupportedOperationException();
}
}
Program: 56760
Project: 56760
Buggy source:
@Test public void canHandleEscapedCharacters() throws Exception {
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").failure(),is(true));
}

Fixed version (ground truth):
@Test public void canHandleEscapedCharacters() throws Exception {
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").value(),is("String_Node_Str"));
  assertThat(Grammar.ESCAPED_CHARACTER.parse("String_Node_Str").failure(),is(true));
}
Program: 56761
Project: 56761
Buggy source:
public Templates extension(String value){
  return new Templates((s,r) -> missing.apply(s + "String_Node_Str" + value,r));
}

Fixed version (ground truth):
public Templates extension(String value){
  return new Templates((s,r) -> missing.apply(s + "String_Node_Str" + value,r),renderers,implicits);
}
Program: 56762
Project: 56762
Buggy source:
public static Templates templates(Function2<? super String,? super Renderers,? extends Renderer<?>> missing){
  return new Templates(missing);
}

Fixed version (ground truth):
public static Templates templates(Function2<? super String,? super Renderers,? extends Renderer<?>> missing){
  return new Templates(missing,new ConcurrentHashMap<>(),CompositeRenderer.compositeRenderer());
}
Program: 56763
Project: 56763
Buggy source:
public Templates logger(Appendable logger){
  return new Templates((s,r) -> {
    try {
      return missing.apply(s,r);
    }
 catch (    Exception e) {
      logger.append(format("String_Node_Str",s,e.getMessage()));
      return (instance,appendable) -> appendable;
    }
  }
);
}

Fixed version (ground truth):
public Templates logger(Appendable logger){
  return new Templates((s,r) -> {
    try {
      return missing.apply(s,r);
    }
 catch (    Exception e) {
      logger.append(format("String_Node_Str",s,e.getMessage()));
      return (instance,appendable) -> appendable;
    }
  }
,renderers,implicits);
}
Program: 56764
Project: 56764
Buggy source:
private Templates(Function2<? super String,? super Renderers,? extends Renderer<?>> missing){
  this.missing=missing;
}

Fixed version (ground truth):
public Templates(Function2<? super String,? super Renderers,? extends Renderer<?>> missing,ConcurrentMap<String,Renderer<Object>> renderers,CompositeRenderer implicits){
  this.missing=missing;
  this.renderers=renderers;
  this.implicits=implicits;
}
Program: 56765
Project: 56765
Buggy source:
@Test public void doesNotThrowWhenASubTemplateIsNotFoundButReturnsEmptyStringAndLogs() throws Exception {
  StringBuilder builder=new StringBuilder();
  Templates templates=templates(getClass()).logger(builder).extension("String_Node_Str").add("String_Node_Str",ignore -> "String_Node_Str");
  String result=templates.get("String_Node_Str").render(map());
  assertThat(result,is("String_Node_Str"));
  String log=builder.toString();
  assertThat(log,startsWith("String_Node_Str"));
  assertThat(log,not(contains("String_Node_Str")));
}

Fixed version (ground truth):
@Test public void doesNotThrowWhenASubTemplateIsNotFoundButReturnsEmptyStringAndLogs() throws Exception {
  StringBuilder builder=new StringBuilder();
  Templates templates=templates(getClass()).add("String_Node_Str",ignore -> "String_Node_Str").logger(builder);
  String result=templates.get("String_Node_Str").render(map());
  assertThat(result,is("String_Node_Str"));
  String log=builder.toString();
  assertThat(log,startsWith("String_Node_Str"));
  assertThat(log,not(contains("String_Node_Str")));
}
Program: 56766
Project: 56766
Buggy source:
static <T>FirstOptionTransducer<T> firstOptionTransducer(){
  AtomicBoolean complete=new AtomicBoolean(false);
  return receiver -> Receiver.receiver(receiver,item -> {
    receiver.next(Option.some(item));
    receiver.finish();
    return Stop;
  }
,() -> {
    if (!complete.get())     receiver.next(Option.none());
    receiver.finish();
  }
);
}

Fixed version (ground truth):
static <T>FirstOptionTransducer<T> firstOptionTransducer(){
  AtomicBoolean complete=new AtomicBoolean(false);
  return receiver -> Receiver.receiver(receiver,item -> {
    receiver.next(Option.some(item));
    receiver.finish();
    complete.set(true);
    return Stop;
  }
,() -> {
    if (!complete.get()) {
      receiver.next(Option.none());
      receiver.finish();
    }
  }
);
}
Program: 56767
Project: 56767
Buggy source:
@Override default Receiver<T> apply(Receiver<Group<K,T>> receiver){
  return new Receiver<T>(){
    private final Map<K,Group<K,T>> groups=new ConcurrentHashMap<>();
    @Override public State start(){
      receivers().each(Receiver::start);
      return receiver.start();
    }
    @Override public State next(    T item){
      groups.computeIfAbsent(keyExtractor().apply(item),k -> {
        Group<K,T> group=new Group<>(k);
        receiver.next(group);
        return group;
      }
).next(item);
      return State.Continue;
    }
    @Override public void error(    Throwable throwable){
      receivers().each(o -> o.error(throwable));
      receiver.error(throwable);
    }
    @Override public void finish(){
      receivers().each(Receiver::finish);
      receiver.finish();
    }
    private Sequence<Receiver<T>> receivers(){
      return Sequences.sequence(groups.values());
    }
  }
;
}

Fixed version (ground truth):
@Override default Receiver<T> apply(Receiver<Group<K,T>> receiver){
  return new Receiver<T>(){
    private final Map<K,Group<K,T>> groups=new ConcurrentHashMap<>();
    @Override public State start(){
      receivers().each(Receiver::start);
      return receiver.start();
    }
    @Override public State next(    T item){
      groups.computeIfAbsent(keyExtractor().apply(item),k -> {
        Group<K,T> group=new Group<>(k);
        receiver.next(group);
        return group;
      }
).next(item);
      return State.Continue;
    }
    @Override public State error(    Throwable throwable){
      receivers().each(o -> o.error(throwable));
      return receiver.error(throwable);
    }
    @Override public void finish(){
      receivers().each(Receiver::finish);
      receiver.finish();
    }
    private Sequence<Receiver<T>> receivers(){
      return Sequences.sequence(groups.values());
    }
  }
;
}
Program: 56768
Project: 56768
Buggy source:
@Override public void error(Throwable throwable){
  receivers().each(o -> o.error(throwable));
  receiver.error(throwable);
}

Fixed version (ground truth):
@Override public State error(Throwable throwable){
  receivers().each(o -> o.error(throwable));
  return receiver.error(throwable);
}
Program: 56769
Project: 56769
Buggy source:
@Override public void error(Throwable throwable){
  for (  Receiver<T> receiver : receivers) {
    receiver.error(throwable);
  }
}

Fixed version (ground truth):
@Override public State error(Throwable throwable){
  for (  Receiver<T> receiver : receivers) {
    if (receiver.error(throwable).equals(Stop))     receivers.remove(receiver);
  }
  return receivers.isEmpty() ? Stop : Continue;
}
Program: 56770
Project: 56770
Buggy source:
@Override default void error(Throwable throwable){
  delegate().error(throwable);
}

Fixed version (ground truth):
@Override default State error(Throwable throwable){
  return delegate().error(throwable);
}
Program: 56771
Project: 56771
Buggy source:
@Override public void error(Throwable throwable){
  error.set(throwable);
}

Fixed version (ground truth):
@Override public State error(Throwable throwable){
  error.set(throwable);
  return State.Stop;
}
Program: 56772
Project: 56772
Buggy source:
static <T>LastTransducer<T> lastTransducer(){
  AtomicReference<T> reference=new AtomicReference<>();
  return receiver -> Receiver.receiver(receiver,item -> {
    reference.set(item);
    return Continue;
  }
,() -> {
    T t=reference.get();
    if (t != null) {
      receiver.next(t);
      receiver.finish();
    }
  }
);
}

Fixed version (ground truth):
static <T>LastTransducer<T> lastTransducer(){
  AtomicReference<T> reference=new AtomicReference<>();
  return receiver -> Receiver.receiver(receiver,item -> {
    reference.set(item);
    return Continue;
  }
,() -> {
    T t=reference.get();
    if (t != null) {
      receiver.next(t);
    }
 else {
      receiver.error(new NoSuchElementException());
    }
    receiver.finish();
  }
);
}
Program: 56773
Project: 56773
Buggy source:
public static Sequence<Number> range(final Number start,final Number end,final Number step){
  if (lessThan(end,start))   return iterate(add(step),start).takeWhile(greaterThanOrEqualTo(end));
  return iterate(add(step),start).takeWhile(lessThanOrEqualTo(end));
}

Fixed version (ground truth):
public static Sequence<Number> range(final Number start,final Number end,final Number step){
  Number absoluteStep=Numbers.absolute(step);
  if (lessThan(end,start))   return iterate(subtract(absoluteStep),start).takeWhile(greaterThanOrEqualTo(end));
  return iterate(add(absoluteStep),start).takeWhile(lessThanOrEqualTo(end));
}
Program: 56774
Project: 56774
Buggy source:
private CompositeRenderer create(String name){
  return compositeRenderer(parent.get(name));
}

Fixed version (ground truth):
private CompositeRenderer create(String name){
  return compositeRenderer(Renderer.lazy(() -> parent.get(name)));
}
Program: 56775
Project: 56775
Buggy source:
private Node children(Node parent) throws XMLStreamException {
  while (reader.hasNext()) {
    XMLEvent event=reader.nextEvent();
    if (event instanceof EndElement)     return parent;
    if (event instanceof StartElement)     children(child(parent,(StartElement)event));
  }
  return parent;
}

Fixed version (ground truth):
private Node children(Node parent) throws XMLStreamException {
  while (reader.hasNext()) {
    XMLEvent event=reader.nextEvent();
    if (event instanceof EndElement)     return parent;
    if (event instanceof CharacterEvent) {
      parent.setTextContent(((CharacterEvent)event).getData());
      return parent;
    }
    if (event instanceof StartElement)     children(child(parent,(StartElement)event));
  }
  return parent;
}
Program: 56776
Project: 56776
Buggy source:
private Node children(Node parent) throws XMLStreamException {
  while (reader.hasNext()) {
    XMLEvent event=reader.nextEvent();
    if (event instanceof EndElement)     return parent;
    if (event instanceof CharacterEvent) {
      parent.setTextContent(((CharacterEvent)event).getData());
      return parent;
    }
    if (event instanceof StartElement)     children(child(parent,(StartElement)event));
  }
  return parent;
}

Fixed version (ground truth):
private Node children(Node parent) throws XMLStreamException {
  while (reader.hasNext()) {
    XMLEvent event=reader.nextEvent();
    if (event instanceof EndElement)     return parent;
    if (event instanceof Characters)     parent.appendChild(parent.getOwnerDocument().createTextNode(((Characters)event).getData()));
    if (event instanceof StartElement)     children(child(parent,(StartElement)event));
  }
  return parent;
}
Program: 56777
Project: 56777
Buggy source:
public static Sequence<String> lines(Reader reader){
  return repeat(readLine(new BufferedReader(reader))).takeWhile(notNullValue(String.class)).memorise();
}

Fixed version (ground truth):
public static Sequence<String> lines(Reader reader){
  return Streams.lines(reader).memorise();
}
Program: 56778
Project: 56778
Buggy source:
public static Function<String> readLine(final BufferedReader reader){
  return new Function<String>(){
    public String call() throws Exception {
      String result=reader.readLine();
      if (result == null) {
        reader.close();
      }
      return result;
    }
  }
;
}

Fixed version (ground truth):
public static Function<String> readLine(final BufferedReader reader){
  return Streams.readLine(reader);
}
Program: 56779
Project: 56779
Buggy source:
public static <T>Sequence<Sequence<T>> windowed(final Iterable<? extends T> sequence,int size){
  return internalWindowed(memorise(sequence),size).toSequence();
}

Fixed version (ground truth):
public static <T>Sequence<Sequence<T>> windowed(final Iterable<? extends T> sequence,int size){
  return new Sequence<Sequence<T>>(){
    @Override public Iterator<Sequence<T>> iterator(){
      return Iterators.<T>windowed(sequence.iterator(),size);
    }
  }
;
}
Program: 56780
Project: 56780
Buggy source:
public static String toString(Iterable<? extends Pair<String,String>> pairs){
  StringBuilder builder=new StringBuilder();
  boolean first=true;
  for (  Pair<String,String> pair : pairs) {
    if (first) {
      first=false;
    }
 else {
      builder.append("String_Node_Str");
    }
    builder.append(encode(pair.first())).append("String_Node_Str").append(encode(pair.second()));
  }
  return builder.toString();
}

Fixed version (ground truth):
public static String toString(Iterable<? extends Pair<String,String>> pairs){
  return sequence(pairs).map(new Mapper<Pair<String,String>,String>(){
    @Override public String call(    Pair<String,String> pair) throws Exception {
      if (pair.second() == null)       return encode(pair.first());
      return encode(pair.first()) + "String_Node_Str" + encode(pair.second());
    }
  }
).toString("String_Node_Str");
}
Program: 56781
Project: 56781
Buggy source:
public static List<Pair<String,String>> parse(String value){
  List<Pair<String,String>> result=new ArrayList<Pair<String,String>>();
  if (Strings.isEmpty(value)) {
    return result;
  }
  for (  String pair : value.split("String_Node_Str")) {
    String[] nameValue=pair.split("String_Node_Str");
    if (nameValue.length == 1) {
      result.add(pair(decode(nameValue[0]),"String_Node_Str"));
    }
    if (nameValue.length == 2) {
      result.add(pair(decode(nameValue[0]),decode(nameValue[1])));
    }
  }
  return result;
}

Fixed version (ground truth):
public static List<Pair<String,String>> parse(String value){
  List<Pair<String,String>> result=new ArrayList<Pair<String,String>>();
  if (Strings.isEmpty(value)) {
    return result;
  }
  for (  String pair : value.split("String_Node_Str")) {
    if (!pair.contains("String_Node_Str")) {
      result.add(Pair.<String,String>pair(decode(pair),null));
      continue;
    }
    String[] nameValue=pair.split("String_Node_Str");
    if (nameValue.length == 1) {
      result.add(Pair.<String,String>pair(decode(nameValue[0]),"String_Node_Str"));
      continue;
    }
    if (nameValue.length == 2) {
      result.add(pair(decode(nameValue[0]),decode(nameValue[1])));
    }
  }
  return result;
}
Program: 56782
Project: 56782
Buggy source:
public Uri dropHost(){
  return dropAuthority();
}

Fixed version (ground truth):
public Uri dropHost(){
  return host(null);
}
Program: 56783
Project: 56783
Buggy source:
public static Mapper<Uri,Uri> host(final String newHost){
  return new Mapper<Uri,Uri>(){
    @Override public Uri call(    Uri uri) throws Exception {
      return uri.host(newHost);
    }
  }
;
}

Fixed version (ground truth):
Authority host(String value){
  return authority(userInfo,value,port);
}
Program: 56784
Project: 56784
Buggy source:
public Uri authority(String value){
  return new Uri(scheme,value,path,query,fragment);
}

Fixed version (ground truth):
static Authority authority(String userInfo,String host,int port){
  return new Authority(userInfo,host,port);
}
Program: 56785
Project: 56785
Buggy source:
@Override public String toString(){
  if (JAR_SCHEME.equals(scheme)) {
    return String.format("String_Node_Str",JAR_SCHEME,authority,path);
  }
  return standardToString();
}

Fixed version (ground truth):
@Override public String toString(){
  if (isEmpty(host))   return null;
  StringBuilder builder=new StringBuilder();
  if (!isEmpty(userInfo)) {
    builder.append(userInfo).append("String_Node_Str");
  }
  builder.append(host);
  if (port != -1) {
    builder.append("String_Node_Str").append(port);
  }
  return builder.toString();
}
Program: 56786
Project: 56786
Buggy source:
@Override public T next(){
  if (!hasNext())   throw new NoSuchElementException();
  if (lastDirection.contains(Direction.next))   zipper.nextOption().each(update);
  lastDirection=some(Direction.next);
  return zipper.value();
}

Fixed version (ground truth):
@Override public T next(){
  if (lastDirection.contains(Direction.next))   zipper=zipper.next();
  lastDirection=some(Direction.next);
  return zipper.value();
}
Program: 56787
Project: 56787
Buggy source:
@Override public T previous(){
  if (!hasPrevious())   throw new NoSuchElementException();
  if (lastDirection.contains(Direction.previous))   zipper.previousOption().each(update);
  lastDirection=some(Direction.previous);
  return zipper.value();
}

Fixed version (ground truth):
@Override public T previous(){
  if (lastDirection.contains(Direction.previous))   zipper=zipper.previous();
  lastDirection=some(Direction.previous);
  return zipper.value();
}
Program: 56788
Project: 56788
Buggy source:
@Override public int nextIndex(){
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public int nextIndex(){
  return zipper.index() + (lastDirection.contains(Direction.next) ? 1 : 0);
}
Program: 56789
Project: 56789
Buggy source:
@Override public int previousIndex(){
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public int previousIndex(){
  return zipper.index() - (lastDirection.contains(Direction.next) ? 0 : 1);
}
Program: 56790
Project: 56790
Buggy source:
@Test public void canGoBackwardsAndForwards() throws Exception {
  PersistentList<Character> values=list('a','b','c','d','e');
  ListIterator<Character> listIterator=new ZipperListIterator<Character>(zipper(values));
  assertThat(listIterator.next(),is('a'));
  assertThat(listIterator.next(),is('b'));
  assertThat(listIterator.next(),is('c'));
  assertThat(listIterator.previous(),is('c'));
  assertThat(listIterator.next(),is('c'));
  assertThat(listIterator.previous(),is('c'));
  assertThat(listIterator.previous(),is('b'));
  assertThat(listIterator.previous(),is('a'));
}

Fixed version (ground truth):
@Test public void canGoBackwardsAndForwards() throws Exception {
  PersistentList<Character> values=list('a','b','c');
  ListIterator<Character> listIterator=new ZipperListIterator<Character>(zipper(values));
  assertThat(listIterator.next(),is('a'));
  assertThat(listIterator.next(),is('b'));
  assertThat(listIterator.next(),is('c'));
  assertThat(listIterator.previous(),is('c'));
  assertThat(listIterator.next(),is('c'));
  assertThat(listIterator.previous(),is('c'));
  assertThat(listIterator.previous(),is('b'));
  assertThat(listIterator.previous(),is('a'));
}
Program: 56791
Project: 56791
Buggy source:
@Test public void canGoBackwards() throws Exception {
  PersistentList<Character> values=list('a','b','c','d','e');
  Iterator<Character> expected=values.reverse().iterator();
  ListIterator<Character> listIterator=new ZipperListIterator<Character>(zipper(values).last());
  for (int i=0; i < values.size(); i++) {
    System.out.println("String_Node_Str" + i);
    assertThat(listIterator.hasPrevious(),is(expected.hasNext()));
    assertThat(listIterator.previous(),is(expected.next()));
  }
  assertThat(listIterator.hasPrevious(),is(expected.hasNext()));
}

Fixed version (ground truth):
@Test public void canGoBackwards() throws Exception {
  PersistentList<Character> values=list('a','b','c','d','e');
  Iterator<Character> expected=values.reverse().iterator();
  ListIterator<Character> listIterator=new ZipperListIterator<Character>(zipper(values).last());
  for (int i=0; i < values.size(); i++) {
    assertThat(listIterator.hasPrevious(),is(expected.hasNext()));
    assertThat(listIterator.previous(),is(expected.next()));
  }
  assertThat(listIterator.hasPrevious(),is(expected.hasNext()));
}