nus-yam/ex-repair huggingface dataset:
Program: 84637
Project: 84637
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ModelAndView getAllFacts(@PathVariable("String_Node_Str") String locationName){
  logger.info("String_Node_Str" + locationName + "String_Node_Str");
  List<Fact> facts=service.getAllFacts(locationName);
  return new ModelAndView("String_Node_Str","String_Node_Str",gson.toJson(facts));
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public ModelMap getAllFacts(@PathVariable("String_Node_Str") String locationName){
  logger.info("String_Node_Str" + locationName + "String_Node_Str");
  ModelMap model=new ModelMap();
  List<Fact> facts=service.getAllFacts(locationName);
  model.addAttribute(facts);
  return model;
}
Program: 84638
Project: 84638
Buggy source:
public List<Fact> getAllFacts(String locationName){
  Map<Integer,Fact> facts=new HashMap<Integer,Fact>();
  jdbcTemplate.query("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",new FactRowMapper(facts),locationName);
  return new ArrayList<Fact>(facts.values());
}

Fixed version (ground truth):
public List<Fact> getAllFacts(String locationName){
  List<Fact> facts=jdbcTemplate.query("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",new FactRowMapper(),locationName);
  return facts;
}
Program: 84639
Project: 84639
Buggy source:
@Override public Fact mapRow(ResultSet rs,int rowNum) throws SQLException {
  Fact fact=new Fact();
  fact.setFactId(rs.getInt("String_Node_Str"));
  fact.setLocationId(rs.getInt("String_Node_Str"));
  fact.setText(rs.getString("String_Node_Str"));
  if (!facts.containsKey(fact.getFactId())) {
    facts.put(fact.getFactId(),fact);
  }
  return fact;
}

Fixed version (ground truth):
public Fact mapRow(ResultSet rs,int rowNum) throws SQLException {
  Fact fact=new Fact();
  fact.setFactId(rs.getInt("String_Node_Str"));
  fact.setLocationId(rs.getInt("String_Node_Str"));
  fact.setText(rs.getString("String_Node_Str"));
  return fact;
}
Program: 84640
Project: 84640
Buggy source:
public void doDispatch(MuleEvent event) throws Exception {
  String evaluatedEndpoint=event.getMuleContext().getExpressionManager().parse(event.getEndpoint().getName(),event.getMessage());
  logger.debug("String_Node_Str" + evaluatedEndpoint);
  String collection=evaluatedEndpoint.split("String_Node_Str",3)[2];
  logger.debug("String_Node_Str" + collection);
  event.transformMessage();
  Object payload=event.getMessage().getPayload();
  BasicDBObject object=null;
  if (payload instanceof String) {
    object=mapper.readValue((String)payload,BasicDBObject.class);
  }
  if (payload instanceof Map) {
    object=new BasicDBObject((Map)payload);
  }
  if (payload instanceof BasicDBObject) {
    object=(BasicDBObject)payload;
  }
  if (object == null) {
    throw new MongoDBException("String_Node_Str" + payload.getClass());
  }
synchronized (this) {
    connector.getDb().getCollection(collection).insert(object);
  }
}

Fixed version (ground truth):
public void doDispatch(MuleEvent event) throws Exception {
  logger.debug("String_Node_Str" + event.getEndpoint().getEndpointURI().toString());
  String evaluatedEndpoint=event.getMuleContext().getExpressionManager().parse(event.getEndpoint().getEndpointURI().toString(),event.getMessage());
  logger.debug("String_Node_Str" + evaluatedEndpoint);
  String collection=evaluatedEndpoint.split("String_Node_Str")[1];
  logger.debug("String_Node_Str" + collection);
  event.transformMessage();
  Object payload=event.getMessage().getPayload();
  BasicDBObject object=null;
  if (payload instanceof String) {
    object=mapper.readValue((String)payload,BasicDBObject.class);
  }
  if (payload instanceof Map) {
    object=new BasicDBObject((Map)payload);
  }
  if (payload instanceof BasicDBObject) {
    object=(BasicDBObject)payload;
  }
  if (object == null) {
    throw new MongoDBException("String_Node_Str" + payload.getClass());
  }
synchronized (this) {
    connector.getDb().getCollection(collection).insert(object);
  }
}
Program: 84641
Project: 84641
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  openAccessory=new OpenAccessory();
  openAccessory.open(this);
  if (openAccessory.isConnected()) {
    adkReceiver=new ADKCommandReceiver(openAccessory);
    adkSender=new ADKCommandSender(openAccessory);
    showControls();
  }
 else {
    hideControls();
  }
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  openAccessory=new OpenAccessory();
  openAccessory.open(this);
  if (openAccessory.isConnected()) {
    adkReceiver=new ADKCommandReceiver(openAccessory);
    adkSender=new ADKCommandSender(openAccessory);
    inputController=new InputController(this);
    adkReceiver.setInputController(inputController);
    outputController=new OutputController(this,adkSender);
    showControls();
  }
 else {
    hideControls();
  }
}
Program: 84642
Project: 84642
Buggy source:
private void showControls(){
  setContentView(R.layout.main);
  inputLabel=(TextView)findViewById(R.id.inputLabel);
  outputLabel=(TextView)findViewById(R.id.outputLabel);
  inputContainer=(LinearLayout)findViewById(R.id.inputContainer);
  outputContainer=(LinearLayout)findViewById(R.id.outputContainer);
  inputLabel.setOnClickListener(this);
  outputLabel.setOnClickListener(this);
  inputController=new InputController(this);
  adkReceiver.setInputController(inputController);
  outputController=new OutputController(this,adkSender);
  showTabContents(true);
}

Fixed version (ground truth):
private void showControls(){
  setContentView(R.layout.main);
  inputLabel=(TextView)findViewById(R.id.inputLabel);
  outputLabel=(TextView)findViewById(R.id.outputLabel);
  inputContainer=(LinearLayout)findViewById(R.id.inputContainer);
  outputContainer=(LinearLayout)findViewById(R.id.outputContainer);
  inputLabel.setOnClickListener(this);
  outputLabel.setOnClickListener(this);
  showTabContents(true);
}
Program: 84643
Project: 84643
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  openAccessory=new OpenAccessory();
  openAccessory.open(this);
  if (openAccessory.isConnected()) {
    adkReceiver=new ADKCommandReceiver(openAccessory);
    adkSender=new ADKCommandSender(openAccessory);
    inputController=new InputController(this);
    adkReceiver.setInputController(inputController);
    outputController=new OutputController(this,adkSender);
    showControls();
  }
 else {
    hideControls();
  }
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  openAccessory=new OpenAccessory();
  openAccessory.open(this);
  if (openAccessory.isConnected()) {
    showControls();
    adkReceiver=new ADKCommandReceiver(openAccessory);
    adkSender=new ADKCommandSender(openAccessory);
    inputController=new InputController(this);
    adkReceiver.setInputController(inputController);
    outputController=new OutputController(this,adkSender);
  }
 else {
    hideControls();
  }
}
Program: 84644
Project: 84644
Buggy source:
@Override public void onListItemClick(ListView l,View v,int position,long id){
  showDetails(position);
}

Fixed version (ground truth):
@Override public void onListItemClick(ListView l,View v,int position,long id){
  position--;
  showDetails(position);
}
Program: 84645
Project: 84645
Buggy source:
@Override protected boolean cacheInBackground(){
  try {
    List<Picture> results;
    if (SearchActivity.pictures.isEmpty()) {
      results=PictureFactory.search(SearchActivity.query);
    }
 else {
      results=PictureFactory.search(SearchActivity.query,page);
    }
    page++;
    if (results.isEmpty()) {
      Log.d("String_Node_Str","String_Node_Str");
      return false;
    }
    SearchActivity.pictures.addAll(results);
    return true;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
@Override protected boolean cacheInBackground(){
  try {
    List<Picture> results;
    if (SearchActivity.pictures.isEmpty()) {
      results=PictureFactory.search(SearchActivity.query);
    }
 else {
      results=PictureFactory.search(SearchActivity.query,page);
    }
    page++;
    if (results.isEmpty()) {
      activity.findViewById(R.id.no_results).setVisibility(View.VISIBLE);
      activity.findViewById(R.id.list_progress).setVisibility(View.GONE);
      return false;
    }
    SearchActivity.pictures.addAll(results);
    return true;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}
Program: 84646
Project: 84646
Buggy source:
protected Boolean doInBackground(Picture... pictures){
  Picture picture=pictures[0];
  WallpaperManager wm=(WallpaperManager)getActivity().getSystemService(Context.WALLPAPER_SERVICE);
  int newWidth=wm.getDesiredMinimumWidth();
  int newHeight=wm.getDesiredMinimumHeight();
  try {
    wm.setStream(getActivity().getContentResolver().openInputStream(picture.uri));
  }
 catch (  Exception e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
protected Boolean doInBackground(Picture... pictures){
  Picture picture=pictures[0];
  WallpaperManager wm=(WallpaperManager)getActivity().getSystemService(Context.WALLPAPER_SERVICE);
  int newWidth=wm.getDesiredMinimumWidth();
  int newHeight=wm.getDesiredMinimumHeight();
  try {
    if (UIUtils.isHoneycombTablet(getActivity())) {
      wm.setBitmap(bitmap);
    }
 else {
      Bitmap resizedBitmap=Bitmap.createScaledBitmap(bitmap,newWidth,newHeight,true);
      wm.setBitmap(resizedBitmap);
    }
  }
 catch (  Exception e) {
    return false;
  }
  return true;
}
Program: 84648
Project: 84648
Buggy source:
public static int getMinute(String time){
  String[] pieces=time.split("String_Node_Str");
  return (Integer.parseInt(pieces[1]));
}

Fixed version (ground truth):
public static int getMinute(String time){
  String[] pieces=time.split("String_Node_Str");
  if (pieces.length == 2) {
    return (Integer.parseInt(pieces[1]));
  }
 else {
    return 0;
  }
}
Program: 84649
Project: 84649
Buggy source:
public static int getHour(String time){
  String[] pieces=time.split("String_Node_Str");
  return (Integer.parseInt(pieces[0]));
}

Fixed version (ground truth):
public static int getHour(String time){
  String[] pieces=time.split("String_Node_Str");
  if (pieces.length == 2) {
    return (Integer.parseInt(pieces[0]));
  }
 else {
    return 0;
  }
}
Program: 84650
Project: 84650
Buggy source:
@Override public boolean onAreaTouched(final TouchEvent pSceneTouchEvent,final float pTouchAreaLocalX,final float pTouchAreaLocalY){
  this.mPhysicsHandler.setEnabled(false);
switch (pSceneTouchEvent.getAction()) {
case TouchEvent.ACTION_DOWN:
    if (!mTimerHandler) {
      mCanAttackCastle=false;
      mMoveDelay=0.0f;
      mInitialMoveX=mX;
      mInitialMoveY=mY;
      mTimeMoved=new TimerHandler(1 / 4.0f,true,new ITimerCallback(){
        @Override public void onTimePassed(        final TimerHandler pTimerHandler){
        }
      }
);
      registerUpdateHandler(this.mTimeMoved);
      mTimerHandler=true;
    }
  break;
case TouchEvent.ACTION_MOVE:
if (pSceneTouchEvent.getY() - getHeight() / 2 < baseY) {
  if (pSceneTouchEvent.getY() - baseY < -5.0f) {
    setPosition(pSceneTouchEvent.getX() - getWidth() / 2,pSceneTouchEvent.getY() - getHeight() / 2);
    mIsAirborne=true;
  }
}
 else mIsAirborne=false;
break;
case TouchEvent.ACTION_UP:
if (mTimerHandler) {
mMoveDelay=mTimeMoved.getTimerSecondsElapsed();
unregisterUpdateHandler(mTimeMoved);
float DiffX=mX - mInitialMoveX;
float DiffY=mY - mInitialMoveY;
DiffX=DiffX / mMoveDelay;
DiffY=DiffY / mMoveDelay;
float mVelocityX=mMoveDelay * (DiffX / 2);
float mVelocityY=mMoveDelay * (DiffY / 2);
if ((DiffY > -10.0f)) {
mVelocityX=0.0f;
mVelocityY=0.0f;
tripEnemy();
}
 else {
mPhysicsHandler.setEnabled(true);
mPhysicsHandler.setVelocity(mVelocityX,mVelocityY);
mTripTracker=true;
}
mTimerHandler=false;
}
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onAreaTouched(final TouchEvent pSceneTouchEvent,final float pTouchAreaLocalX,final float pTouchAreaLocalY){
  this.mPhysicsHandler.setEnabled(false);
switch (pSceneTouchEvent.getAction()) {
case TouchEvent.ACTION_DOWN:
    mGrabbedEnemy=true;
  if (!mTimerHandler) {
    mCanAttackCastle=false;
    mMoveDelay=0.0f;
    mInitialMoveX=mX;
    mInitialMoveY=mY;
    mTimeMoved=new TimerHandler(1 / 4.0f,true,new ITimerCallback(){
      @Override public void onTimePassed(      final TimerHandler pTimerHandler){
      }
    }
);
    registerUpdateHandler(this.mTimeMoved);
    mTimerHandler=true;
  }
break;
case TouchEvent.ACTION_MOVE:
if (pSceneTouchEvent.getY() - getHeight() / 2 < baseY) {
if (pSceneTouchEvent.getY() - baseY < -5.0f) {
  setPosition(pSceneTouchEvent.getX() - getWidth() / 2,pSceneTouchEvent.getY() - getHeight() / 2);
  mIsAirborne=true;
}
}
 else mIsAirborne=false;
break;
case TouchEvent.ACTION_UP:
mGrabbedEnemy=false;
if (mTimerHandler) {
mMoveDelay=mTimeMoved.getTimerSecondsElapsed();
unregisterUpdateHandler(mTimeMoved);
float DiffX=mX - mInitialMoveX;
float DiffY=mY - mInitialMoveY;
DiffX=DiffX / mMoveDelay;
DiffY=DiffY / mMoveDelay;
float mVelocityX=mMoveDelay * (DiffX / 2);
float mVelocityY=mMoveDelay * (DiffY / 2);
if ((DiffY > -10.0f)) {
mVelocityX=0.0f;
mVelocityY=0.0f;
tripEnemy();
}
 else {
mPhysicsHandler.setEnabled(true);
mPhysicsHandler.setVelocity(mVelocityX,mVelocityY);
mTripTracker=true;
}
mTimerHandler=false;
}
break;
}
return true;
}
Program: 84652
Project: 84652
Buggy source:
public void completeReset(){
  this.baseY=0.0f;
  this.mSpeed=0.0f;
  this.mMaxSpeed=0.0f;
  this.mHealth=0.0f;
  this.mAttackDamage=0.0f;
  this.mCashWorth=0;
  this.mMoveDelay=0.0f;
  this.mInitialMoveX=0.0f;
  this.mInitialMoveY=0.0f;
  this.mCanAttackCastle=false;
  this.mIsAirborne=false;
  this.mTripTracker=false;
  this.currentAnimationCycle=0;
  this.mTripping=false;
  this.mXpWorth=0;
  this.mAttackCastle=false;
  this.unregisterUpdateHandler(mPhysicsHandler);
}

Fixed version (ground truth):
public void completeReset(){
  this.baseY=0.0f;
  this.mSpeed=0.0f;
  this.mMaxSpeed=0.0f;
  this.mHealth=0.0f;
  this.mAttackDamage=0.0f;
  this.mCashWorth=0;
  this.mMoveDelay=0.0f;
  this.mInitialMoveX=0.0f;
  this.mInitialMoveY=0.0f;
  this.mCanAttackCastle=false;
  this.mIsAirborne=false;
  this.mTripTracker=false;
  this.currentAnimationCycle=0;
  this.mTripping=false;
  this.mXpWorth=0;
  this.mAttackCastle=false;
  this.mGrabbedEnemy=false;
  this.unregisterUpdateHandler(mPhysicsHandler);
}
Program: 84655
Project: 84655
Buggy source:
public void loadCastle(float X,float Y){
  GestureDefence.this.sCastle.setPosition(X,Y);
  GestureDefence.this.sm.GameScreen.getChild(2).attachChild(sCastle);
}

Fixed version (ground truth):
public void loadCastle(float X,float Y){
  GestureDefence.this.sCastle.setPosition(X,Y);
  GestureDefence.this.sm.GameScreen.attachChild(sCastle);
}
Program: 84656
Project: 84656
Buggy source:
@Override public void onTimePassed(final TimerHandler pTimerHandler){
  GestureDefence.this.sm.GameScreen.unregisterUpdateHandler(pTimerHandler);
  GestureDefence.this.sm.GameScreen.getChild(4).detachChildren();
}

Fixed version (ground truth):
@Override public void onTimePassed(final TimerHandler pTimerHandler){
  for (int i=(GestureDefence.this.line.size() - 1); i >= 0; i--) {
    final Line tempLine=GestureDefence.this.line.get(i);
    GestureDefence.this.sm.GameScreen.detachChild(tempLine);
  }
  GestureDefence.this.line.clear();
  GestureDefence.this.sm.GameScreen.unregisterUpdateHandler(pTimerHandler);
}
Program: 84657
Project: 84657
Buggy source:
public void loadNewEnemy(final float X,final float Y,final int type){
  final Enemy newEnemy;
switch (type) {
case 1:
    newEnemy=GestureDefence.this.getEnemyPool(1).obtainPoolItem();
  newEnemy.setXY(X,Y);
newEnemy.setType1();
break;
case 2:
newEnemy=GestureDefence.this.getEnemyPool(2).obtainPoolItem();
newEnemy.setXY(X,Y);
newEnemy.setType2();
newEnemy.setScale(1.5f);
break;
default :
newEnemy=GestureDefence.this.getEnemyPool(1).obtainPoolItem();
newEnemy.setXY(X,Y);
newEnemy.setType1();
break;
}
if (!newEnemy.hasParent()) GestureDefence.this.sm.GameScreen.getChild(1).attachChild(newEnemy);
if (!newEnemy.isVisible()) newEnemy.setVisible(true);
GestureDefence.this.sm.GameScreen.registerTouchArea(newEnemy);
GestureDefence.this.sm.GameScreen.setTouchAreaBindingEnabled(true);
GestureDefence.this.sEnemyCount++;
GestureDefence.this.mOnScreenEnemies++;
}

Fixed version (ground truth):
public void loadNewEnemy(final float X,final float Y,final int type){
  final Enemy newEnemy;
switch (type) {
case 1:
    newEnemy=GestureDefence.this.getEnemyPool(1).obtainPoolItem();
  newEnemy.setXY(X,Y);
newEnemy.setType1();
break;
case 2:
newEnemy=GestureDefence.this.getEnemyPool(2).obtainPoolItem();
newEnemy.setXY(X,Y);
newEnemy.setType2();
newEnemy.setScale(1.5f);
break;
default :
newEnemy=GestureDefence.this.getEnemyPool(1).obtainPoolItem();
newEnemy.setXY(X,Y);
newEnemy.setType1();
break;
}
if (!newEnemy.hasParent()) GestureDefence.this.sm.GameScreen.attachChild(newEnemy);
if (!newEnemy.isVisible()) newEnemy.setVisible(true);
GestureDefence.this.sm.GameScreen.registerTouchArea(newEnemy);
GestureDefence.this.sm.GameScreen.setTouchAreaBindingEnabled(true);
GestureDefence.this.sEnemyCount++;
GestureDefence.this.mOnScreenEnemies++;
}
Program: 84659
Project: 84659
Buggy source:
public void killEnemy(){
  if (currentAnimationCycle != 3) {
    mPhysicsHandler.setEnabled(false);
    base.sm.GameScreen.unregisterTouchArea(this);
    setAnimationCycle(3);
    base.splat.play();
    if (manaChance.nextInt(7) == 6) {
      Mana mMana=base.getManaPool().obtainPoolItem();
      mMana.setup(mX,mY);
      if (!mMana.hasParent())       base.sm.GameScreen.getChild(3).attachChild(mMana);
      base.sm.GameScreen.registerTouchArea(mMana);
    }
    if ((base.sKillCount - base.sPreviousKillCount) >= (base.theWave.getNumberEnemysToSpawn() - 3)) {
      Gold mGold=base.getGoldPool().obtainPoolItem();
      mGold.setup(mX,mY,111);
      if (!mGold.hasParent())       base.sm.GameScreen.getChild(3).attachChild(mGold);
      base.sm.GameScreen.registerTouchArea(mGold);
    }
    base.increaseXpProgress(mXpWorth);
  }
}

Fixed version (ground truth):
public void killEnemy(){
  if (currentAnimationCycle != 3) {
    mPhysicsHandler.setEnabled(false);
    base.sm.GameScreen.unregisterTouchArea(this);
    setAnimationCycle(3);
    base.splat.play();
    if (manaChance.nextInt(7) == 6) {
      Mana mMana=base.getManaPool().obtainPoolItem();
      mMana.setup(mX,mY);
      if (!mMana.hasParent())       base.sm.GameScreen.attachChild(mMana);
      base.sm.GameScreen.registerTouchArea(mMana);
    }
    if ((base.sKillCount - base.sPreviousKillCount) >= (base.theWave.getNumberEnemysToSpawn() - 3)) {
      Gold mGold=base.getGoldPool().obtainPoolItem();
      mGold.setup(mX,mY,111);
      if (!mGold.hasParent())       base.sm.GameScreen.attachChild(mGold);
      base.sm.GameScreen.registerTouchArea(mGold);
    }
    base.increaseXpProgress(mXpWorth);
  }
}
Program: 84661
Project: 84661
Buggy source:
@Override public void onManagedUpdate(final float pSecondsElapsed){
  if (killIT) {
    base.sm.GameScreen.unregisterTouchArea(this);
    base.getManaPool().recyclePoolItem(this);
  }
 else {
    if (this.mY < this.mInitialY) {
      this.mPhysicsHandler.setVelocityY(this.mPhysicsHandler.getVelocityY() + mGravity);
    }
 else {
      this.mPhysicsHandler.setVelocity(0.0f,0.0f);
    }
  }
  super.onManagedUpdate(pSecondsElapsed);
}

Fixed version (ground truth):
@Override public void onManagedUpdate(final float pSecondsElapsed){
  if (killIT) {
    base.sm.GameScreen.unregisterTouchArea(this);
    base.getManaPool().recyclePoolItem(this);
  }
 else {
    if (this.mY < this.mInitialY) {
      this.mPhysicsHandler.setVelocityY(this.mPhysicsHandler.getVelocityY() + mGravity);
      this.setPosition(mX,mInitialY);
    }
 else {
      this.mPhysicsHandler.setVelocity(0.0f,0.0f);
    }
  }
  super.onManagedUpdate(pSecondsElapsed);
}
Program: 84664
Project: 84664
Buggy source:
public void loadQuitMenu(Scene TheSceneFrom){
  this.QuitMenuCameFrom=TheSceneFrom;
  if (QuitMenu == null) {
    QuitMenu=new Scene(1);
    Text areyouSure=new Text(30,(base.getCameraHeight() / 2) - 10,base.mFont,"String_Node_Str");
    Text YesOption=new Text(areyouSure.getX(),areyouSure.getY() + areyouSure.getHeight(),base.mFont,"String_Node_Str"){
      @Override public boolean onAreaTouched(      TouchEvent pSceneTouchEvent,      float pTouchAreaLocalX,      float pTouchAreaLocalY){
        base.ButtonPress(99);
        return super.onAreaTouched(pSceneTouchEvent,pTouchAreaLocalX,pTouchAreaLocalY);
      }
    }
;
    Text NoOption=new Text(YesOption.getX() + YesOption.getWidth() + 20,areyouSure.getY() + areyouSure.getHeight(),base.mFont,"String_Node_Str"){
      @Override public boolean onAreaTouched(      TouchEvent pSceneTouchEvent,      float pTouchAreaLocalX,      float pTouchAreaLocalY){
        base.getEngine().setScene(QuitMenuCameFrom);
        if (QuitMenuCameFrom == GameScreen)         if (base.CustomHUD.getHud() != null)         base.CustomHUD.HideValues(true);
        return super.onAreaTouched(pSceneTouchEvent,pTouchAreaLocalX,pTouchAreaLocalY);
      }
    }
;
    QuitMenu.attachChild(areyouSure);
    QuitMenu.attachChild(YesOption);
    QuitMenu.attachChild(NoOption);
    QuitMenu.registerTouchArea(YesOption);
    QuitMenu.registerTouchArea(NoOption);
  }
  checkHud();
  base.getEngine().setScene(QuitMenu);
  CameraCheck();
}

Fixed version (ground truth):
public void loadQuitMenu(Scene TheSceneFrom){
  this.QuitMenuCameFrom=TheSceneFrom;
  if (QuitMenu == null) {
    QuitMenu=new Scene();
    Text areyouSure=new Text(30,(base.getCameraHeight() / 2) - 10,base.mFont,"String_Node_Str");
    Text YesOption=new Text(areyouSure.getX(),areyouSure.getY() + areyouSure.getHeight(),base.mFont,"String_Node_Str"){
      @Override public boolean onAreaTouched(      TouchEvent pSceneTouchEvent,      float pTouchAreaLocalX,      float pTouchAreaLocalY){
        base.ButtonPress(99);
        return super.onAreaTouched(pSceneTouchEvent,pTouchAreaLocalX,pTouchAreaLocalY);
      }
    }
;
    Text NoOption=new Text(YesOption.getX() + YesOption.getWidth() + 20,areyouSure.getY() + areyouSure.getHeight(),base.mFont,"String_Node_Str"){
      @Override public boolean onAreaTouched(      TouchEvent pSceneTouchEvent,      float pTouchAreaLocalX,      float pTouchAreaLocalY){
        base.getEngine().setScene(QuitMenuCameFrom);
        if (QuitMenuCameFrom == GameScreen)         if (base.CustomHUD.getHud() != null)         base.CustomHUD.HideValues(true);
        return super.onAreaTouched(pSceneTouchEvent,pTouchAreaLocalX,pTouchAreaLocalY);
      }
    }
;
    QuitMenu.attachChild(areyouSure);
    QuitMenu.attachChild(YesOption);
    QuitMenu.attachChild(NoOption);
    QuitMenu.registerTouchArea(YesOption);
    QuitMenu.registerTouchArea(NoOption);
  }
  checkHud();
  base.getEngine().setScene(QuitMenu);
  CameraCheck();
}
Program: 84669
Project: 84669
Buggy source:
public void CameraSet(){
  if (CameraShakeX != 0.0f || CameraShakeY != 0.0f) {
    base.sCamera.offsetCenter(CameraShakeX,CameraShakeY);
    CameraShakeX=0.0f;
    CameraShakeY=0.0f;
  }
}

Fixed version (ground truth):
public void CameraSet(){
  if (CameraShakeX != 0.0f || CameraShakeY != 0.0f) {
    base.getCamera().offsetCenter(CameraShakeX,CameraShakeY);
    CameraShakeX=0.0f;
    CameraShakeY=0.0f;
  }
}
Program: 84670
Project: 84670
Buggy source:
public void CameraCheck(){
  float checkX=base.sCamera.getCenterX() - (base.sCamera.getWidth() / 2);
  float checkY=base.sCamera.getCenterY() - (base.sCamera.getHeight() / 2);
  if (checkX != 0.0f || checkY != 0.0f) {
    CameraShakeX=checkX;
    CameraShakeY=checkY;
    base.sCamera.setCenter(base.sCamera.getWidth() / 2,base.sCamera.getHeight() / 2);
  }
}

Fixed version (ground truth):
public void CameraCheck(){
  float checkX=base.getCamera().getCenterX() - (base.getCameraWidth() / 2);
  float checkY=base.getCamera().getCenterY() - (base.getCameraHeight() / 2);
  if (checkX != 0.0f || checkY != 0.0f) {
    CameraShakeX=checkX;
    CameraShakeY=checkY;
    base.getCamera().setCenter(base.getCameraWidth() / 2,base.getCameraHeight() / 2);
  }
}
Program: 84671
Project: 84671
Buggy source:
public void ShowNewGameWarning(){
  if (NewGameWarning == null) {
    NewGameWarning=new Scene(1);
    Text areyouSure=new Text(30,(base.getCameraHeight() / 2) - 10,base.mFont2,"String_Node_Str");
    Text YesOption=new Text(areyouSure.getX(),areyouSure.getY() + areyouSure.getHeight(),base.mFont,"String_Node_Str"){
      @Override public boolean onAreaTouched(      TouchEvent pSceneTouchEvent,      float pTouchAreaLocalX,      float pTouchAreaLocalY){
        base.ButtonPress(1);
        return super.onAreaTouched(pSceneTouchEvent,pTouchAreaLocalX,pTouchAreaLocalY);
      }
    }
;
    Text NoOption=new Text(YesOption.getX() + YesOption.getWidth() + 20,areyouSure.getY() + areyouSure.getHeight(),base.mFont,"String_Node_Str"){
      @Override public boolean onAreaTouched(      TouchEvent pSceneTouchEvent,      float pTouchAreaLocalX,      float pTouchAreaLocalY){
        base.getEngine().setScene(MainMenu);
        return super.onAreaTouched(pSceneTouchEvent,pTouchAreaLocalX,pTouchAreaLocalY);
      }
    }
;
    NewGameWarning.attachChild(areyouSure);
    NewGameWarning.attachChild(YesOption);
    NewGameWarning.attachChild(NoOption);
    NewGameWarning.registerTouchArea(YesOption);
    NewGameWarning.registerTouchArea(NoOption);
  }
  checkHud();
  base.getEngine().setScene(NewGameWarning);
  CameraCheck();
}

Fixed version (ground truth):
public void ShowNewGameWarning(){
  if (NewGameWarning == null) {
    NewGameWarning=new Scene();
    Text areyouSure=new Text(30,(base.getCameraHeight() / 2) - 10,base.mFont2,"String_Node_Str");
    Text YesOption=new Text(areyouSure.getX(),areyouSure.getY() + areyouSure.getHeight(),base.mFont,"String_Node_Str"){
      @Override public boolean onAreaTouched(      TouchEvent pSceneTouchEvent,      float pTouchAreaLocalX,      float pTouchAreaLocalY){
        base.ButtonPress(1);
        return super.onAreaTouched(pSceneTouchEvent,pTouchAreaLocalX,pTouchAreaLocalY);
      }
    }
;
    Text NoOption=new Text(YesOption.getX() + YesOption.getWidth() + 20,areyouSure.getY() + areyouSure.getHeight(),base.mFont,"String_Node_Str"){
      @Override public boolean onAreaTouched(      TouchEvent pSceneTouchEvent,      float pTouchAreaLocalX,      float pTouchAreaLocalY){
        base.getEngine().setScene(MainMenu);
        return super.onAreaTouched(pSceneTouchEvent,pTouchAreaLocalX,pTouchAreaLocalY);
      }
    }
;
    NewGameWarning.attachChild(areyouSure);
    NewGameWarning.attachChild(YesOption);
    NewGameWarning.attachChild(NoOption);
    NewGameWarning.registerTouchArea(YesOption);
    NewGameWarning.registerTouchArea(NoOption);
  }
  checkHud();
  base.getEngine().setScene(NewGameWarning);
  CameraCheck();
}
Program: 84672
Project: 84672
Buggy source:
public void NewWaveScreen(){
  if (NewWaveScene == null) {
    NewWaveScene=new Scene(1);
    base.theWave.mWaveNumberMenuItem=new ChangeableTextMenuItem(GestureDefence.MENU_WAVE_NUMBER,base.mFont,"String_Node_Str" + base.theWave.getWaveNumber(),("String_Node_Str").length());
    NewWaveScene.attachChild(base.theWave.mWaveNumberMenuItem);
  }
  base.theWave.mWaveNumberMenuItem.setPosition((base.getCameraWidth() / 2) - (base.theWave.mWaveNumberMenuItem.getWidth() / 2),(base.getCameraHeight() / 2) - (base.theWave.mWaveNumberMenuItem.getHeight() / 2));
  checkHud();
  base.getEngine().setScene(NewWaveScene);
  CameraCheck();
}

Fixed version (ground truth):
public void NewWaveScreen(){
  if (NewWaveScene == null) {
    NewWaveScene=new Scene();
    base.theWave.mWaveNumberMenuItem=new ChangeableTextMenuItem(GestureDefence.MENU_WAVE_NUMBER,base.mFont,"String_Node_Str" + base.theWave.getWaveNumber(),("String_Node_Str").length());
    NewWaveScene.attachChild(base.theWave.mWaveNumberMenuItem);
  }
  base.theWave.mWaveNumberMenuItem.setPosition((base.getCameraWidth() / 2) - (base.theWave.mWaveNumberMenuItem.getWidth() / 2),(base.getCameraHeight() / 2) - (base.theWave.mWaveNumberMenuItem.getHeight() / 2));
  checkHud();
  base.getEngine().setScene(NewWaveScene);
  CameraCheck();
}
Program: 84675
Project: 84675
Buggy source:
public void onGesturePerformed(GestureOverlayView overlay,Gesture gesture){
  ArrayList<Prediction> predictions=mLibrary.recognize(gesture);
  if (GestureDefence.this.getEngine().getScene() == GestureDefence.this.sm.GameScreen) {
    if (predictions.size() > 0) {
      Prediction prediction=predictions.get(0);
      if (prediction.score > 1.0) {
        if ((GestureDefence.this.mana - 1000) >= 0) {
          GestureDefence.this.mana-=1000;
          GestureDefence.this.ligtningStrike.play();
          RectF tempThing=gesture.getBoundingBox();
          float posX=tempThing.left;
          float posY=tempThing.bottom - 330;
          lightning=new AnimatedSprite(posX,posY,GestureDefence.this.mLightningTextureRegion.clone());
          lightning.animate(new long[]{50,50,50,50,50,50},new int[]{0,1,2,3,4,5},0);
          GestureDefence.this.sm.GameScreen.attachChild(lightning);
          GestureDefence.this.mLightningBoltX=tempThing.left + (tempThing.width() / 2);
          GestureDefence.this.mLightningBoltY=tempThing.bottom;
          GestureDefence.this.mLightningBolt=true;
          GestureDefence.this.updateManaValue();
        }
      }
    }
  }
}

Fixed version (ground truth):
public void onGesturePerformed(GestureOverlayView overlay,Gesture gesture){
  ArrayList<Prediction> predictions=mLibrary.recognize(gesture);
  if (GestureDefence.this.getEngine().getScene() == GestureDefence.this.sm.GameScreen) {
    if (predictions.size() > 0) {
      Prediction prediction=predictions.get(0);
      if (prediction.score > 1.0) {
        if ((GestureDefence.this.mana - 1000) >= 0) {
          GestureDefence.this.mana-=1000;
          GestureDefence.this.ligtningStrike.play();
          RectF tempThing=gesture.getBoundingBox();
          float posX;
          float posY;
          float lightningPosX;
          float lightningPosY;
          if (tempThing.left < tempThing.right) {
            posX=tempThing.left;
            lightningPosX=posX + ((tempThing.right - tempThing.left) / 2);
          }
 else {
            posX=tempThing.right;
            lightningPosX=posX + ((tempThing.left - tempThing.left) / 2);
          }
          if (tempThing.bottom > tempThing.top) {
            posY=tempThing.bottom - 330;
            lightningPosY=tempThing.bottom;
          }
 else {
            posY=tempThing.top - 330;
            lightningPosY=tempThing.top;
          }
          lightning=new AnimatedSprite(posX,posY,GestureDefence.this.mLightningTextureRegion.clone());
          lightning.animate(new long[]{50,50,50,50,50,50},new int[]{0,1,2,3,4,5},0);
          GestureDefence.this.sm.GameScreen.attachChild(lightning);
          GestureDefence.this.mLightningBoltX=lightningPosX;
          GestureDefence.this.mLightningBoltY=lightningPosY;
          GestureDefence.this.mLightningBolt=true;
          GestureDefence.this.updateManaValue();
        }
      }
    }
  }
}
Program: 84677
Project: 84677
Buggy source:
public boolean increaseMaxHealth(int amount){
  Castle.mMaxHealth+=amount;
  return true;
}

Fixed version (ground truth):
public boolean increaseMaxHealth(int amount){
  Castle.mMaxHealth+=amount;
  Castle.mHealth+=amount;
  return true;
}
Program: 84678
Project: 84678
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  GestureDefence.this.mLibrary=GestureLibraries.fromRawResource(GestureDefence.this,R.raw.spells);
  if (!mLibrary.load()) {
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
  ;
  gestures=(GestureOverlayView)findViewById(R.id.gestures);
  gestures.setWillNotDraw(true);
  gestures.setWillNotCacheDrawing(true);
  gestures.addOnGesturePerformedListener(this);
  final String OFgameName="String_Node_Str";
  final String OFgameId="String_Node_Str";
  final String OFgameKey="String_Node_Str";
  final String OFgameSecret="String_Node_Str";
  OpenFeintSettings settings=new OpenFeintSettings(OFgameName,OFgameKey,OFgameSecret,OFgameId);
  OpenFeint.initialize(this,settings,new OpenFeintDelegate(){
  }
);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  GestureDefence.this.mLibrary=GestureLibraries.fromRawResource(GestureDefence.this,R.raw.spells);
  if (!mLibrary.load()) {
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
  ;
  gestures=(GestureOverlayView)findViewById(R.id.gestures);
  gestures.setWillNotDraw(true);
  gestures.setWillNotCacheDrawing(true);
  gestures.addOnGesturePerformedListener(this);
  OpenFeintSettings settings=new OpenFeintSettings(OFgameName,OFgameKey,OFgameSecret,OFgameId);
  OpenFeint.initialize(this,settings,new OpenFeintDelegate(){
  }
);
}
Program: 84680
Project: 84680
Buggy source:
public void loadCastle(float X,float Y){
  GestureDefence.this.sCastle.setPosition(X,Y);
  GestureDefence.this.sm.GameScreen.getChild(3).attachChild(sCastle);
}

Fixed version (ground truth):
public void loadCastle(float X,float Y){
  GestureDefence.this.sCastle.setPosition(X,Y);
  GestureDefence.this.sm.GameScreen.getChild(2).attachChild(sCastle);
}
Program: 84683
Project: 84683
Buggy source:
@Override public void pause(){
  if (state == GameState.Running)   state=GameState.Paused;
  if (world.gameOver) {
    if (world.score > Settings.highscores[4]) {
      Settings.addScore(world.score,playerName);
    }
    Settings.save(game.getFileIO());
  }
}

Fixed version (ground truth):
@Override public void pause(){
  if (state == GameState.Running)   state=GameState.Paused;
  if (world.gameOver) {
    if (world.score > Settings.highscores[4]) {
      Settings.addScore(world.score,playerName);
      world.score=0;
      playerName=null;
    }
    Settings.save(game.getFileIO());
  }
}
Program: 84684
Project: 84684
Buggy source:
@Override public void update(float deltaTime){
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  int len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == kevent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  if (state == GameState.Ready)   updateReady(touchEvents);
  if (state == GameState.Running)   updateRunning(touchEvents,keyEvents,deltaTime);
  if (state == GameState.Paused)   updatePaused(touchEvents);
  if (state == GameState.GameOver)   updateGameOver(touchEvents);
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  int len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == KeyEvent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  if (state == GameState.Ready)   updateReady(touchEvents);
  if (state == GameState.Running)   updateRunning(touchEvents,keyEvents,deltaTime);
  if (state == GameState.Paused)   updatePaused(touchEvents);
  if (state == GameState.GameOver)   updateGameOver(touchEvents);
}
Program: 84685
Project: 84685
Buggy source:
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == kevent.KEY_UP)     screenNumber--;
    if (screenNumber < 1)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=touchEvents.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=touchEvents.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x > g.getWidth() - Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        screenNumber++;
        if (screenNumber > 3) {
          game.setScreen(new MainMenuScreen(game));
        }
        if (Settings.soundEnabled)         Assets.click.play(1);
        return;
      }
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        screenNumber--;
        if (screenNumber < 1) {
          game.setScreen(new MainMenuScreen(game));
        }
        if (Settings.soundEnabled)         Assets.click.play(1);
        return;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == KeyEvent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=touchEvents.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=touchEvents.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x > g.getWidth() - Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        screenNumber++;
        if (screenNumber > 3) {
          game.setScreen(new MainMenuScreen(game));
        }
        if (Settings.soundEnabled)         Assets.click.play(1);
        return;
      }
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        screenNumber--;
        if (screenNumber < 1) {
          game.setScreen(new MainMenuScreen(game));
        }
        if (Settings.soundEnabled)         Assets.click.play(1);
        return;
      }
    }
  }
}
Program: 84686
Project: 84686
Buggy source:
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == kevent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=touchEvents.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=touchEvents.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        if (Settings.soundEnabled)         Assets.click.play(1);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == KeyEvent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=touchEvents.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=touchEvents.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        if (Settings.soundEnabled)         Assets.click.play(1);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
  }
}
Program: 84688
Project: 84688
Buggy source:
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> events=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == kevent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=events.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=events.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        if (Settings.soundEnabled)         Assets.click.play(1);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
    int y=g.getHeight() / 2;
    for (int j=1; j <= 5; j++) {
      if (event.type == TouchEvent.TOUCH_UP) {
        int x=j * (g.getWidth() - 30) / 5 - Assets.NUMBER_WIDTH;
        if (event.x > x && event.x < x + Assets.NUMBER_WIDTH && event.y > y && event.y < y + Assets.NUMBER_HEIGHT) {
          if (Settings.soundEnabled)           Assets.click.play(1);
          Settings.gameSpeed=j;
          return;
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  int len;
  List<TouchEvent> events=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == KeyEvent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  Graphics g=game.getGraphics();
  len=events.size();
  for (int i=0; i < len; i++) {
    TouchEvent event=events.get(i);
    if (event.type == TouchEvent.TOUCH_UP) {
      if (event.x < Assets.BUTTON_WIDTH && event.y > g.getHeight() - Assets.BUTTON_HEIGHT) {
        if (Settings.soundEnabled)         Assets.click.play(1);
        game.setScreen(new MainMenuScreen(game));
        return;
      }
    }
    int y=g.getHeight() / 2;
    for (int j=1; j <= 5; j++) {
      if (event.type == TouchEvent.TOUCH_UP) {
        int x=j * (g.getWidth() - 30) / 5 - Assets.NUMBER_WIDTH;
        if (event.x > x && event.x < x + Assets.NUMBER_WIDTH && event.y > y && event.y < y + Assets.NUMBER_HEIGHT) {
          if (Settings.soundEnabled)           Assets.click.play(1);
          Settings.gameSpeed=j;
          return;
        }
      }
    }
  }
}
Program: 84690
Project: 84690
Buggy source:
@Override public void update(float deltaTime){
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  game.getInput().getKeyEvents();
  if (state == GameState.Ready)   updateReady(touchEvents);
  if (state == GameState.Running)   updateRunning(touchEvents,deltaTime);
  if (state == GameState.Paused)   updatePaused(touchEvents);
  if (state == GameState.GameOver)   updateGameOver(touchEvents);
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  if (state == GameState.Ready)   updateReady(touchEvents);
  if (state == GameState.Running)   updateRunning(touchEvents,keyEvents,deltaTime);
  if (state == GameState.Paused)   updatePaused(touchEvents);
  if (state == GameState.GameOver)   updateGameOver(touchEvents);
}
Program: 84692
Project: 84692
Buggy source:
public void turnUp(){
  direction=UP;
  already_turned=true;
}

Fixed version (ground truth):
public void turnUp(){
  if (direction != DOWN)   direction=UP;
  already_turned=true;
}
Program: 84693
Project: 84693
Buggy source:
public void turnRight(){
  direction=RIGHT;
  already_turned=true;
}

Fixed version (ground truth):
public void turnRight(){
  if (direction != LEFT)   direction=RIGHT;
  already_turned=true;
}
Program: 84694
Project: 84694
Buggy source:
public void turnDown(){
  direction=DOWN;
  already_turned=true;
}

Fixed version (ground truth):
public void turnDown(){
  if (direction != UP)   direction=DOWN;
  already_turned=true;
}
Program: 84695
Project: 84695
Buggy source:
public void turnLeft(){
  direction=LEFT;
  already_turned=true;
}

Fixed version (ground truth):
public void turnLeft(){
  if (direction != RIGHT)   direction=LEFT;
  already_turned=true;
}
Program: 84696
Project: 84696
Buggy source:
private void updateReady(List<TouchEvent> touchEvents){
  if (touchEvents.size() > 0)   state=GameState.Running;
}

Fixed version (ground truth):
private void updateReady(List<TouchEvent> touchEvents){
  if (touchEvents.size() > 0) {
    state=GameState.Running;
    World.tick=World.TICK_INITIAL;
  }
}
Program: 84697
Project: 84697
Buggy source:
public void eat(){
  SnakePart end=parts.get(parts.size() - 1);
  parts.add(new SnakePart(end.x,end.y));
}

Fixed version (ground truth):
public void eat(){
  Log.e("String_Node_Str","String_Node_Str" + World.tick);
  SnakePart end=parts.get(parts.size() - 1);
  parts.add(new SnakePart(end.x,end.y));
}
Program: 84698
Project: 84698
Buggy source:
public void update(float deltaTime){
  if (gameOver)   return;
  tickTime+=deltaTime;
  while (tickTime > tick) {
    tickTime-=tick;
    snake.advance();
    if (snake.checkBitten()) {
      gameOver=true;
      return;
    }
    SnakePart head=snake.parts.get(0);
    if (head.x == stain.x && head.y == stain.y) {
      score+=SCORE_INCREMENT;
      stainsEaten++;
      snake.eat();
      if (snake.parts.size() == WORLD_WIDTH * WORLD_HEIGHT) {
        gameOver=true;
        return;
      }
 else {
        placeStain();
      }
      if (score % 100 == 0 && tick - TICK_DECREMENT > 0) {
        tick-=TICK_DECREMENT;
      }
    }
    if (extraStain != null) {
      if (head.x == extraStain.x && head.y == extraStain.y) {
        snake.shrink();
        extraStain=null;
      }
      if (deltaTick >= 20) {
        extraStain=null;
        deltaTick=0;
      }
 else {
        deltaTick++;
      }
    }
  }
}

Fixed version (ground truth):
public void update(float deltaTime){
  if (gameOver)   return;
  tickTime+=deltaTime;
  while (tickTime > tick) {
    tickTime-=tick;
    snake.advance();
    if (snake.checkBitten()) {
      gameOver=true;
      return;
    }
    SnakePart head=snake.parts.get(0);
    if (head.x == stain.x && head.y == stain.y) {
      score+=SCORE_INCREMENT;
      stainsEaten++;
      snake.eat();
      if (snake.parts.size() == WORLD_WIDTH * WORLD_HEIGHT) {
        gameOver=true;
        return;
      }
 else {
        placeStain();
      }
      if (score % 100 == 0 && tick - TICK_DECREMENT > 0) {
        tick-=TICK_DECREMENT;
      }
    }
    if (extraStain != null) {
      if (head.x == extraStain.x && head.y == extraStain.y) {
        score+=5 * SCORE_INCREMENT;
        snake.shrink();
        extraStain=null;
        deltaTick=0;
      }
 else {
        if (deltaTick >= 20) {
          extraStain=null;
          deltaTick=0;
        }
 else {
          deltaTick++;
        }
      }
    }
  }
}
Program: 84700
Project: 84700
Buggy source:
public List<SchemaInfo> getDefaultSchemasByServer(String serverId){
  if (serverId == null || serverId.length() == 0)   return new ArrayList<SchemaInfo>();
  if (schemas == null)   schemas=new ServersUtil(LiveRebelDeployBuilder.DescriptorImpl.newCommandCenter(),null).getSchemas();
  List<SchemaInfo> schemasByServer=new ArrayList<SchemaInfo>();
  for (  SchemaInfo schemaInfo : schemas) {
    if (schemaInfo.getServerId().equalsIgnoreCase(serverId))     schemasByServer.add(schemaInfo);
  }
  return schemasByServer;
}

Fixed version (ground truth):
public List<SchemaInfo> getDefaultSchemasByServer(String serverId){
  if (serverId == null || serverId.length() == 0)   return new ArrayList<SchemaInfo>();
  schemas=new ServersUtil(LiveRebelDeployBuilder.DescriptorImpl.newCommandCenter(),null).getSchemas();
  List<SchemaInfo> schemasByServer=new ArrayList<SchemaInfo>();
  for (  SchemaInfo schemaInfo : schemas) {
    if (schemaInfo.getServerId().equalsIgnoreCase(serverId))     schemasByServer.add(schemaInfo);
  }
  return schemasByServer;
}
Program: 84701
Project: 84701
Buggy source:
public List<SchemaInfo> getDefaultSchemas(){
  if (schemas == null)   schemas=new ServersUtil(LiveRebelDeployBuilder.DescriptorImpl.newCommandCenter(),null).getSchemas();
  return schemas;
}

Fixed version (ground truth):
public List<SchemaInfo> getDefaultSchemas(){
  schemas=new ServersUtil(LiveRebelDeployBuilder.DescriptorImpl.newCommandCenter(),null).getSchemas();
  return schemas;
}