nus-yam/ex-repair huggingface dataset:
Program: 40032
Project: 40032
Buggy source:
public void adminEditLand(CommandSender sender,Integer id,String category,String tags){
  Messaging mess=new Messaging(sender);
  if (category.equals("String_Node_Str")) {
    editLand((Player)sender,id,category,tags);
  }
 else   if (category.equalsIgnoreCase("String_Node_Str")) {
    editLand((Player)sender,id,category,tags);
  }
 else   if (category.equalsIgnoreCase("String_Node_Str")) {
    if (iCoLand.landMgr.updateOwner(id,tags))     mess.send("String_Node_Str");
 else     mess.send("String_Node_Str");
  }
 else   if (category.equalsIgnoreCase("String_Node_Str")) {
    if (iCoLand.landMgr.toggleAddons(id,tags))     mess.send("String_Node_Str");
 else     mess.send("String_Node_Str");
  }
}

Fixed version (ground truth):
public void adminEditLand(CommandSender sender,Integer id,String category,String tags){
  Messaging mess=new Messaging(sender);
  if (category.equals("String_Node_Str")) {
    if (iCoLand.landMgr.modifyPermTags(id,tags))     mess.send("String_Node_Str");
 else     mess.send("String_Node_Str");
  }
 else   if (category.equalsIgnoreCase("String_Node_Str")) {
    if (iCoLand.landMgr.updateOwner(id,tags))     mess.send("String_Node_Str");
 else     mess.send("String_Node_Str");
  }
 else   if (category.equalsIgnoreCase("String_Node_Str")) {
    if (iCoLand.landMgr.toggleAddons(id,tags))     mess.send("String_Node_Str");
 else     mess.send("String_Node_Str");
  }
 else   if (category.equalsIgnoreCase("String_Node_Str")) {
    if (iCoLand.landMgr.updateName(id,tags.substring(0,(tags.length() > 35) ? 35 : tags.length())))     mess.send("String_Node_Str");
 else     mess.send("String_Node_Str");
  }
 else {
    mess.send("String_Node_Str");
  }
}
Program: 40034
Project: 40034
Buggy source:
public void showLandInfo(CommandSender sender,String... args){
  Messaging mess=new Messaging(sender);
  if (args.length == 0) {
    showHelp(sender,"String_Node_Str");
  }
 else {
    Integer id=0;
    if (args[0].equalsIgnoreCase("String_Node_Str")) {
      id=iCoLand.landMgr.getLandId(((Player)sender).getLocation());
      if (id > 0) {
        showSelectLandInfo((CommandSender)sender,id);
      }
 else {
        mess.send("String_Node_Str");
      }
    }
 else {
      try {
        id=Integer.parseInt(args[0]);
      }
 catch (      NumberFormatException e) {
        id=0;
      }
      if (id > 0) {
        if (iCoLand.landMgr.landIdExists(id)) {
          showSelectLandInfo((CommandSender)sender,id);
        }
 else {
          mess.send("String_Node_Str" + id + "String_Node_Str");
        }
      }
 else {
        if (sender instanceof Player)         showLandInfo((Player)sender,args);
 else         showHelp(sender,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void showLandInfo(CommandSender sender,String... args){
  Messaging mess=new Messaging(sender);
  if (args.length == 0) {
    showHelp(sender,"String_Node_Str");
  }
 else {
    Integer id=0;
    if (args[0].equalsIgnoreCase("String_Node_Str")) {
      if (sender instanceof Player) {
        id=iCoLand.landMgr.getLandId(((Player)sender).getLocation());
        if (id > 0) {
          showSelectLandInfo((CommandSender)sender,id);
        }
 else {
          mess.send("String_Node_Str");
        }
      }
 else {
        mess.send("String_Node_Str");
      }
    }
 else {
      try {
        id=Integer.parseInt(args[0]);
      }
 catch (      NumberFormatException e) {
        id=0;
      }
      if (id > 0) {
        if (iCoLand.landMgr.landIdExists(id)) {
          showSelectLandInfo((CommandSender)sender,id);
        }
 else {
          mess.send("String_Node_Str" + id + "String_Node_Str");
        }
      }
 else {
        if (sender instanceof Player)         showLandInfo((Player)sender,args);
 else         showHelp(sender,"String_Node_Str");
      }
    }
  }
}
Program: 40035
Project: 40035
Buggy source:
public boolean canBuild(Player player,Location loc){
  String playerName=player.getName();
  Integer id=getLandId(loc);
  if (id > 0) {
    return getLandById(id).hasPermission(playerName);
  }
 else {
    if (Config.preventGlobalBuildWithoutPerm && iCoLand.hasPermission(player,"String_Node_Str")) {
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
public boolean canBuild(Player player,Location loc){
  String playerName=player.getName();
  Integer id=getLandId(loc);
  if (id > 0) {
    return getLandById(id).hasPermission(playerName);
  }
 else {
    if (Config.preventGlobalBuildWithoutPerm) {
      return iCoLand.hasPermission(player,"String_Node_Str");
    }
 else {
      return true;
    }
  }
}
Program: 40038
Project: 40038
Buggy source:
public void showExistingLandInfo(CommandSender sender,Land land){
  Messaging mess=new Messaging(sender);
  mess.send(Misc.headerify("String_Node_Str" + land.getID() + "String_Node_Str"));
  mess.send("String_Node_Str" + land.owner);
  if (!(sender instanceof Player) || land.owner.equals(((Player)sender).getName())) {
    mess.send("String_Node_Str" + land.perms);
    mess.send("String_Node_Str" + land.addons);
    mess.send("String_Node_Str" + land.dateCreated);
    mess.send("String_Node_Str" + land.dateTaxed);
  }
}

Fixed version (ground truth):
public void showExistingLandInfo(CommandSender sender,Land land){
  Messaging mess=new Messaging(sender);
  mess.send("String_Node_Str" + Misc.headerify("String_Node_Str" + land.getID() + "String_Node_Str"));
  mess.send("String_Node_Str" + land.owner);
  if (!(sender instanceof Player) || land.owner.equals(((Player)sender).getName())) {
    mess.send("String_Node_Str" + land.perms);
    mess.send("String_Node_Str" + land.addons);
    mess.send("String_Node_Str" + land.dateCreated);
    mess.send("String_Node_Str" + land.dateTaxed);
  }
}
Program: 40039
Project: 40039
Buggy source:
@Override public void onBlockRightClick(BlockRightClickEvent event){
  Player player=event.getPlayer();
  String playerName=player.getName();
  if (iConomyLand.cmdMap.containsKey(playerName) && iConomyLand.cmdMap.get(playerName).equals("String_Node_Str")) {
    Cuboid newCuboid;
    Location loc=event.getBlock().getLocation();
    if (iConomyLand.tmpCuboidMap.containsKey(playerName)) {
      newCuboid=iConomyLand.tmpCuboidMap.get(playerName);
      newCuboid.setLocation(loc);
    }
 else {
      newCuboid=new Cuboid(loc);
    }
    Messaging mess=new Messaging((CommandSender)player);
    if (newCuboid.isValid()) {
      mess.send("String_Node_Str");
      iConomyLand.landMgr.showSelectLandInfo(player,newCuboid);
      if (iConomyLand.landMgr.add(newCuboid,playerName,"String_Node_Str","String_Node_Str")) {
        iConomyLand.cmdMap.remove(playerName);
      }
    }
 else {
      iConomyLand.tmpCuboidMap.put(playerName,newCuboid);
      mess.send("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void onBlockRightClick(BlockRightClickEvent event){
  Player player=event.getPlayer();
  String playerName=player.getName();
  if (iConomyLand.cmdMap.containsKey(playerName) && iConomyLand.cmdMap.get(playerName).equals("String_Node_Str")) {
    Cuboid newCuboid;
    Location loc=event.getBlock().getLocation();
    if (iConomyLand.tmpCuboidMap.containsKey(playerName)) {
      newCuboid=iConomyLand.tmpCuboidMap.get(playerName);
      newCuboid.setLocation(loc);
    }
 else {
      newCuboid=new Cuboid(loc);
    }
    Messaging mess=new Messaging((CommandSender)player);
    if (newCuboid.isValid()) {
      mess.send("String_Node_Str");
      iConomyLand.landMgr.showSelectLandInfo(player,newCuboid);
    }
 else {
      iConomyLand.tmpCuboidMap.put(playerName,newCuboid);
      mess.send("String_Node_Str");
    }
  }
}
Program: 40042
Project: 40042
Buggy source:
public void showLandInfo(CommandSender sender,String... args){
}

Fixed version (ground truth):
public void showLandInfo(CommandSender sender,String... args){
  if (args.length == 0) {
    showHelp(sender,"String_Node_Str");
  }
 else {
    Integer id;
    try {
      id=Integer.parseInt(args[0]);
    }
 catch (    NumberFormatException e) {
      id=-1;
    }
    if (id > 0) {
      iConomyLand.landMgr.showSelectLandInfo((CommandSender)sender,id);
    }
 else {
      showHelp(sender,"String_Node_Str");
    }
  }
}
Program: 40043
Project: 40043
Buggy source:
public boolean selectArea(Player player){
  String playerName=player.getName();
  Messaging mess=new Messaging((CommandSender)player);
  if (iConomyLand.cmdMap.containsKey(playerName)) {
    String action=iConomyLand.cmdMap.get(playerName);
    if (action.equals("String_Node_Str")) {
      mess.send("String_Node_Str");
      iConomyLand.cmdMap.remove(playerName);
      iConomyLand.tmpCuboidMap.remove(playerName);
    }
  }
  mess.send("String_Node_Str");
  iConomyLand.cmdMap.put(playerName,"String_Node_Str");
  return true;
}

Fixed version (ground truth):
public boolean selectArea(Player player){
  String playerName=player.getName();
  Messaging mess=new Messaging((CommandSender)player);
  if (iConomyLand.cmdMap.containsKey(playerName)) {
    String action=iConomyLand.cmdMap.get(playerName);
    if (action.equals("String_Node_Str")) {
      mess.send("String_Node_Str");
      iConomyLand.cmdMap.remove(playerName);
      iConomyLand.tmpCuboidMap.remove(playerName);
    }
 else {
      mess.send("String_Node_Str" + action);
      iConomyLand.cmdMap.remove(playerName);
    }
  }
  mess.send("String_Node_Str");
  iConomyLand.cmdMap.put(playerName,"String_Node_Str");
  return true;
}
Program: 40044
Project: 40044
Buggy source:
@Override public void onPlayerMove(PlayerMoveEvent event){
  Player player=event.getPlayer();
  if (!checkNow(player))   return;
  String playerName=player.getName();
  if (iConomyLand.debugMode)   iConomyLand.info("String_Node_Str" + playerName);
  if (!locMap.containsKey(playerName))   locMap.put(playerName,iConomyLand.landMgr.getLandID(player.getLocation()));
  int locFrom=locMap.get(playerName);
  int locTo=iConomyLand.landMgr.getLandID(player.getLocation());
  locMap.put(playerName,locTo);
  if (locFrom != locTo) {
    if (locFrom != 0) {
      player.sendMessage("String_Node_Str");
    }
    if (locTo != 0) {
      player.sendMessage("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerMove(PlayerMoveEvent event){
  Player player=event.getPlayer();
  if (!checkNow(player))   return;
  String playerName=player.getName();
  if (!locMap.containsKey(playerName))   locMap.put(playerName,iConomyLand.landMgr.getLandID(player.getLocation()));
  int locFrom=locMap.get(playerName);
  int locTo=iConomyLand.landMgr.getLandID(player.getLocation());
  locMap.put(playerName,locTo);
  if (locFrom != locTo) {
    if (locFrom != 0) {
      player.sendMessage("String_Node_Str");
    }
    if (locTo != 0) {
      player.sendMessage("String_Node_Str");
    }
  }
}
Program: 40045
Project: 40045
Buggy source:
private static void gameLoop(){
  Log.info("String_Node_Str","String_Node_Str");
  long lastTime=System.nanoTime();
  while (true) {
    long currentTime=System.nanoTime();
    game.update((currentTime - lastTime) * 1.0e-9);
    try {
      GameCanvas.startDrawing(game.getMap().getSizeX(),game.getMap().getSizeY());
      game.render();
    }
  finally {
      GameCanvas.stopDrawing();
    }
    long millisToNextUpdate=Math.max(0,(1000 / 60) - ((System.nanoTime() - currentTime) / 1000000));
    lastTime=currentTime;
    try {
      Thread.sleep(millisToNextUpdate);
    }
 catch (    InterruptedException e) {
      break;
    }
  }
}

Fixed version (ground truth):
private static void gameLoop(){
  Log.info("String_Node_Str","String_Node_Str");
  long lastTime=System.nanoTime();
  while (true) {
    boolean loadedMap=false;
    long currentTime=System.nanoTime();
    try {
      game.update((currentTime - lastTime) * 1.0e-9);
    }
 catch (    mapLoadedException e) {
      loadedMap=true;
      ui.dispose();
      ui=new RavenUI(game);
    }
    try {
      GameCanvas.startDrawing(game.getMap().getSizeX(),game.getMap().getSizeY(),loadedMap);
      loadedMap=false;
      game.render();
    }
  finally {
      GameCanvas.stopDrawing();
    }
    long millisToNextUpdate=Math.max(0,(1000 / 60) - ((System.nanoTime() - currentTime) / 1000000));
    lastTime=currentTime;
    try {
      Thread.sleep(millisToNextUpdate);
    }
 catch (    InterruptedException e) {
      break;
    }
  }
}
Program: 40047
Project: 40047
Buggy source:
protected void create(int width,int height){
  setIgnoreRepaint(true);
  setFocusable(true);
  requestFocus();
  if (getBufferStrategy() == null) {
    createBufferStrategy(2);
    setBounds(0,0,width,height);
  }
  if (g2d != null) {
    g2d.dispose();
    System.err.println("String_Node_Str");
  }
  g2d=(Graphics2D)getBufferStrategy().getDrawGraphics();
  RenderingHints renderHints=new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  renderHints.put(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
  g2d.setRenderingHints(renderHints);
  g2d.setColor(Color.WHITE);
  g2d.fillRect(0,0,getWidth(),getHeight());
}

Fixed version (ground truth):
protected void create(int width,int height,boolean loadedMap){
  setIgnoreRepaint(true);
  setFocusable(true);
  requestFocus();
  if (getBufferStrategy() == null || loadedMap == true) {
    createBufferStrategy(2);
    setBounds(0,0,width,height);
  }
  if (g2d != null) {
    g2d.dispose();
    System.err.println("String_Node_Str");
  }
  g2d=(Graphics2D)getBufferStrategy().getDrawGraphics();
  RenderingHints renderHints=new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  renderHints.put(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
  g2d.setRenderingHints(renderHints);
  g2d.setColor(Color.WHITE);
  g2d.fillRect(0,0,getWidth(),getHeight());
}
Program: 40048
Project: 40048
Buggy source:
public static void startDrawing(int width,int height){
  getInstance().create(width,height);
}

Fixed version (ground truth):
public static void startDrawing(int width,int height,boolean loadedMap){
  getInstance().create(width,height,loadedMap);
}
Program: 40049
Project: 40049
Buggy source:
private static void discharge(BaseGameEntity receiver,Telegram msg){
  if (!receiver.handleMessage(msg)) {
    Log.error("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
private static void discharge(IRavenBot receiver,Telegram msg){
  if (!receiver.handleMessage(msg)) {
    Log.error("String_Node_Str","String_Node_Str");
  }
}
Program: 40050
Project: 40050
Buggy source:
/** 
 * send a message to another agent. Receiving agent is referenced by ID.
 * @param delay Delay in seconds until the message should be sent
 * @param senderID the ID of the sender
 * @param receiverID the ID of the sender 
 * @param msg the type of the message to send
 * @param extraInfo optional object to attach to the message
 */
public static void dispatchMsg(double delay,int senderID,int receiverID,RavenMessage msg,Object extraInfo){
  BaseGameEntity receiver=EntityManager.getEntityFromID(receiverID);
  if (receiver == null) {
    System.err.println("String_Node_Str" + receiverID + "String_Node_Str");
    return;
  }
  Telegram telegram=new Telegram(0,senderID,receiverID,msg,extraInfo);
  if (delay <= 0.0) {
    discharge(receiver,telegram);
  }
 else {
    telegram.dispatchDelay=delay;
    getInstance().priorityQueue.add(telegram);
  }
}

Fixed version (ground truth):
/** 
 * send a message to another agent. Receiving agent is referenced by ID.
 * @param delay Delay in seconds until the message should be sent
 * @param senderID the ID of the sender
 * @param receiverID the ID of the sender 
 * @param msg the type of the message to send
 * @param extraInfo optional object to attach to the message
 */
public static void dispatchMsg(double delay,int senderID,int receiverID,RavenMessage msg,Object extraInfo){
  BaseGameEntity receiver=EntityManager.getEntityFromID(receiverID);
  IRavenBot bot=null;
  if (receiver == null) {
    bot=EntityManager.getBotFromID(receiverID);
  }
  if (bot == null)   System.err.println("String_Node_Str" + receiverID + "String_Node_Str");
  Telegram telegram=new Telegram(0,senderID,receiverID,msg,extraInfo);
  if (delay <= 0.0) {
    if (receiver != null)     discharge(receiver,telegram);
 else     discharge(bot,telegram);
  }
 else {
    telegram.dispatchDelay=delay;
    getInstance().priorityQueue.add(telegram);
  }
}
Program: 40051
Project: 40051
Buggy source:
protected BaseGameEntity(int id,RavenObject type){
  setID(id);
  this.type=type;
}

Fixed version (ground truth):
protected BaseGameEntity(int id,RavenObject type){
  LogManager.GetInstance().Info("String_Node_Str" + type + "String_Node_Str"+ id);
  setID(id);
  this.type=type;
}
Program: 40052
Project: 40052
Buggy source:
public static void reset(){
  getInstance().entityMap.clear();
}

Fixed version (ground truth):
public static void reset(){
  LogManager.GetInstance().Info("String_Node_Str");
  getInstance().entityMap.clear();
}
Program: 40053
Project: 40053
Buggy source:
public static void registerEntity(BaseGameEntity entity){
  getInstance().entityMap.put(entity.ID(),entity);
}

Fixed version (ground truth):
public static void registerEntity(BaseGameEntity entity){
  LogManager.GetInstance().Info("String_Node_Str" + entity.entityType() + "String_Node_Str"+ entity.ID());
  getInstance().entityMap.put(entity.ID(),entity);
}
Program: 40054
Project: 40054
Buggy source:
public static void removeEntity(BaseGameEntity entity){
  getInstance().entityMap.remove(entity);
}

Fixed version (ground truth):
public static void removeEntity(BaseGameEntity entity){
  getInstance().entityMap.remove(entity);
  LogManager.GetInstance().Info("String_Node_Str" + entity.entityType() + "String_Node_Str"+ entity.ID());
}
Program: 40055
Project: 40055
Buggy source:
public static int getAvailableID(){
  return 0;
}

Fixed version (ground truth):
public static synchronized int getAvailableID(){
  int toReturn=availableID;
  availableID++;
  return toReturn;
}
Program: 40056
Project: 40056
Buggy source:
private boolean attemptToAddBot(RavenBot bot){
  LogManager.GetInstance().Info("String_Node_Str" + bot.ID());
  if (map.getSpawnPoints().size() <= 0) {
    LogManager.GetInstance().Error("String_Node_Str");
    return false;
  }
  int attempts=map.getSpawnPoints().size();
  while (--attempts >= 0) {
    Vector2D pos=map.getRandomSpawnPoint();
    boolean available=true;
    for (    RavenBot other : bots) {
      if (pos.distance(other.pos()) < other.getBRadius()) {
        available=false;
      }
    }
    if (available) {
      LogManager.GetInstance().Info("String_Node_Str" + bot.ID() + "String_Node_Str"+ pos);
      bot.spawn(pos);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean attemptToAddBot(RavenBot bot){
  LogManager.GetInstance().Info("String_Node_Str" + bot.ID());
  if (map.getSpawnPoints().size() <= 0) {
    LogManager.GetInstance().Error("String_Node_Str");
    return false;
  }
  int attempts=map.getSpawnPoints().size();
  while (--attempts >= 0) {
    Vector2D pos=map.getRandomSpawnPoint();
    boolean available=true;
    for (    RavenBot other : bots) {
      if (pos.distance(other.pos()) < other.getBRadius()) {
        available=false;
      }
    }
    if (available) {
      LogManager.GetInstance().Info("String_Node_Str" + bot.ID() + "String_Node_Str"+ pos);
      bot.spawn(pos);
      int nodeID=bot.getPathPlanner().getClosestNodeToPosition(bot.pos());
      Vector2D posNode=bot.getPathPlanner().getNodePosition(nodeID);
      if (posNode == null)       return true;
      bot.getPathPlanner().RequestPathToPosition(posNode);
      return true;
    }
  }
  return false;
}
Program: 40057
Project: 40057
Buggy source:
public void addBots(int numBotsToAdd){
  LogManager.GetInstance().Info("String_Node_Str" + numBotsToAdd + "String_Node_Str");
  while (--numBotsToAdd > 0) {
    RavenBot bot=new RavenBot(this,new Vector2D());
    bot.getSteering().wallAvoidanceOn();
    bot.getSteering().separationOn();
    bots.add(bot);
    LogManager.GetInstance().Info("String_Node_Str" + bot.ID() + "String_Node_Str");
    EntityManager.registerEntity(bot);
  }
}

Fixed version (ground truth):
public void addBots(int numBotsToAdd){
  LogManager.GetInstance().Info("String_Node_Str" + numBotsToAdd + "String_Node_Str");
  while (--numBotsToAdd > 0) {
    RavenBot bot=new RavenBot(this,new Vector2D());
    bot.getSteering().wallAvoidanceOn();
    bot.getSteering().separationOn();
    bots.add(bot);
    LogManager.GetInstance().Info("String_Node_Str" + bot.ID() + "String_Node_Str");
    EntityManager.registerEntity(bot);
    bot.getBrain().addGoal_explore();
    bot.getBrain().activate();
  }
}
Program: 40058
Project: 40058
Buggy source:
public Vector2D getNodePosition(int idx){
  return graph.getNode(idx).pos();
}

Fixed version (ground truth):
public Vector2D getNodePosition(int idx){
  GraphNode node=graph.getNode(idx);
  if (node != null) {
    return node.pos();
  }
 else   return null;
}
Program: 40059
Project: 40059
Buggy source:
public boolean requestPathToItem(int ItemType){
  GetReadyForNewSearch();
  int ClosestNodeToBot=getClosestNodeToPosition(ravenBot.pos());
  if (ClosestNodeToBot == 0) {
    return false;
  }
  TriggerSystem<Trigger<RavenBot>> t_con;
  GraphSearchDijkstra DijSearch;
  currentSearch=new GraphSearchDijkstra(graph,ClosestNodeToBot,ItemType);
  ravenBot.getWorld().getPathManager().Register(this);
  return true;
}

Fixed version (ground truth):
public boolean requestPathToItem(int ItemType){
  GetReadyForNewSearch();
  int ClosestNodeToBot=getClosestNodeToPosition(ravenBot.pos());
  if (ClosestNodeToBot == 0) {
    return false;
  }
  currentSearch=new GraphSearchDijkstra(graph,ClosestNodeToBot,ItemType);
  ravenBot.getWorld().getPathManager().Register(this);
  return true;
}
Program: 40060
Project: 40060
Buggy source:
public RavenPathPlanner(RavenBot ravenBot){
  this.ravenBot=ravenBot;
}

Fixed version (ground truth):
public RavenPathPlanner(RavenBot ravenBot){
  this.ravenBot=ravenBot;
  path=new ArrayList<PathEdge>();
}
Program: 40061
Project: 40061
Buggy source:
public GoalComposite(T PE,raven.goals.Goal.GoalType type){
  super(PE,type);
}

Fixed version (ground truth):
public GoalComposite(T PE,raven.goals.Goal.GoalType type){
  super(PE,type);
  m_SubGoals=new ArrayList<Goal<T>>();
}
Program: 40062
Project: 40062
Buggy source:
public raven.goals.Goal.CurrentStatus ProcessSubgoals(){
  while (!m_SubGoals.isEmpty() && (m_SubGoals.get(0).isComplete() || m_SubGoals.get(0).hasFailed())) {
    m_SubGoals.get(0).Terminate();
    m_SubGoals.remove(0);
  }
  if (!m_SubGoals.isEmpty()) {
    raven.goals.Goal.CurrentStatus StatusOfSubGoals=m_SubGoals.get(0).Process();
    if (StatusOfSubGoals == Goal.CurrentStatus.completed && m_SubGoals.size() > 1) {
      return Goal.CurrentStatus.active;
    }
    return StatusOfSubGoals;
  }
 else {
    return Goal.CurrentStatus.completed;
  }
}

Fixed version (ground truth):
public CurrentStatus ProcessSubgoals(){
  while (!m_SubGoals.isEmpty() && (m_SubGoals.get(0).isComplete() || m_SubGoals.get(0).hasFailed())) {
    m_SubGoals.get(0).Terminate();
    m_SubGoals.remove(0);
  }
  if (!m_SubGoals.isEmpty()) {
    raven.goals.Goal.CurrentStatus StatusOfSubGoals=m_SubGoals.get(0).Process();
    if (StatusOfSubGoals == Goal.CurrentStatus.completed && m_SubGoals.size() > 1) {
      return Goal.CurrentStatus.active;
    }
    return StatusOfSubGoals;
  }
 else {
    return Goal.CurrentStatus.completed;
  }
}
Program: 40063
Project: 40063
Buggy source:
protected void addDrawingPoint(Vector2D point){
  if (drawingPoints == null)   drawingPoints=new ArrayList<Vector2D>();
  drawingPoints.add(point);
  delegate.updateStatus("String_Node_Str" + point.x + "String_Node_Str"+ point.y+ "String_Node_Str");
  if (isSnapped)   commitDrawing();
}

Fixed version (ground truth):
protected void addDrawingPoint(Vector2D point){
  if (drawingPoints == null)   drawingPoints=new ArrayList<Vector2D>();
  drawingPoints.add(point);
  delegate.updateStatus("String_Node_Str" + point.x + "String_Node_Str"+ point.y+ "String_Node_Str");
  if (isSnapped && drawingPoints.size() > 1)   commitDrawing();
}
Program: 40064
Project: 40064
Buggy source:
protected void commitDrawing(){
  isDrawing=false;
  if (drawingPoints == null)   return;
  delegate.addWalls(drawingPoints.toArray(new Vector2D[drawingPoints.size()]));
  delegate.updateStatus("String_Node_Str" + (drawingPoints.size() - 1) + "String_Node_Str");
  drawingPoints=null;
  updateCursorSnap();
}

Fixed version (ground truth):
protected void commitDrawing(){
  isDrawing=false;
  isSnapped=false;
  if (drawingPoints == null)   return;
  delegate.addWalls(drawingPoints.toArray(new Vector2D[drawingPoints.size()]));
  delegate.updateStatus("String_Node_Str" + (drawingPoints.size() - 1) + "String_Node_Str");
  drawingPoints=null;
  updateCursorSnap();
  viewport.repaint();
}
Program: 40065
Project: 40065
Buggy source:
@Override public void paintComponent(Graphics g){
  Graphics2D g2d=(Graphics2D)g;
  Line2D line;
  g2d.setColor(Color.LIGHT_GRAY);
  if (isDrawing) {
    for (int i=0; i < drawingPoints.size() - 1; i++) {
      line=new Line2D.Float(levelToView(drawingPoints.get(i)),levelToView(drawingPoints.get(i + 1)));
      g2d.draw(line);
    }
    line=new Line2D.Float(levelToView(drawingPoints.get(drawingPoints.size() - 1)),levelToView(levelCursor));
    g2d.draw(line);
  }
  if (isSnapped) {
    Ellipse2D highlight=new Ellipse2D.Double(levelToView(levelCursor).getX() - snapDistance / 2,levelToView(levelCursor).getY() - snapDistance / 2,snapDistance,snapDistance);
    g2d.setColor(Color.YELLOW);
    g2d.draw(highlight);
  }
  if (levelCursor != null) {
    FontMetrics fm=g2d.getFontMetrics(font);
    String coordString=new String("String_Node_Str" + levelCursor.x + "String_Node_Str"+ levelCursor.y+ "String_Node_Str");
    int width=fm.stringWidth(coordString);
    g2d.setFont(font);
    g2d.setColor(Color.BLACK);
    g2d.drawString(coordString,0,10);
  }
}

Fixed version (ground truth):
@Override public void paintComponent(Graphics g){
  Graphics2D g2d=(Graphics2D)g;
  Line2D line;
  g2d.setColor(Color.LIGHT_GRAY);
  if (isDrawing) {
    for (int i=0; i < drawingPoints.size() - 1; i++) {
      line=new Line2D.Float(levelToView(drawingPoints.get(i)),levelToView(drawingPoints.get(i + 1)));
      g2d.draw(line);
    }
    line=new Line2D.Float(levelToView(drawingPoints.get(drawingPoints.size() - 1)),levelToView(levelCursor));
    g2d.draw(line);
  }
  if (levelCursor != null) {
    Ellipse2D highlight=new Ellipse2D.Double(levelToView(levelCursor).getX() - snapDistance,levelToView(levelCursor).getY() - snapDistance,2 * snapDistance,2 * snapDistance);
    g2d.setColor(Color.ORANGE);
    g2d.draw(highlight);
  }
  if (levelCursor != null) {
    FontMetrics fm=g2d.getFontMetrics(font);
    String coordString=new String("String_Node_Str" + levelCursor.x + "String_Node_Str"+ levelCursor.y+ "String_Node_Str");
    int width=fm.stringWidth(coordString);
    g2d.setFont(font);
    g2d.setColor(Color.BLACK);
    g2d.drawString(coordString,0,10);
  }
}
Program: 40066
Project: 40066
Buggy source:
@Override public void mouseMoved(MouseEvent e){
  if (isDrawing) {
    mouseLocation=e.getPoint();
    levelCursor=viewToLevel(mouseLocation);
  }
  updateCursorSnap();
  viewport.repaint();
  e.consume();
}

Fixed version (ground truth):
@Override public void mouseMoved(MouseEvent e){
  mouseLocation=e.getPoint();
  levelCursor=viewToLevel(mouseLocation);
  updateCursorSnap();
  viewport.repaint();
  e.consume();
}
Program: 40067
Project: 40067
Buggy source:
protected void updateCursorSnap(){
  if (levelCursor == null) {
    isSnapped=false;
    return;
  }
  Vector2D nearestPoint=null;
  double closestSq=Double.MAX_VALUE;
  for (  Wall2D wall : level.getWalls()) {
    double dist=wall.from().distanceSq(levelCursor);
    if (dist < closestSq && dist < snapDistance) {
      nearestPoint=wall.from();
      closestSq=dist;
    }
    dist=wall.to().distanceSq(levelCursor);
    if (dist < closestSq && dist < snapDistance) {
      nearestPoint=wall.to();
      closestSq=dist;
    }
  }
  if (isDrawing && drawingPoints.size() > 2 && levelToView(levelCursor).distance(levelToView(drawingPoints.get(0))) < snapDistance) {
    nearestPoint=drawingPoints.get(0);
  }
  if (nearestPoint != null) {
    isSnapped=true;
    levelCursor=nearestPoint;
  }
 else {
    isSnapped=false;
  }
}

Fixed version (ground truth):
protected void updateCursorSnap(){
  if (levelCursor == null) {
    isSnapped=false;
    return;
  }
  Vector2D nearestPoint=null;
  double closestSq=Double.MAX_VALUE;
  for (  Wall2D wall : level.getWalls()) {
    double dist=wall.from().distanceSq(levelCursor);
    if (dist < closestSq && dist < snapDistance * snapDistance) {
      nearestPoint=wall.from();
      closestSq=dist;
    }
    dist=wall.to().distanceSq(levelCursor);
    if (dist < closestSq && dist < snapDistance * snapDistance) {
      nearestPoint=wall.to();
      closestSq=dist;
    }
  }
  if (isDrawing && drawingPoints.size() > 2 && levelToView(levelCursor).distance(levelToView(drawingPoints.get(0))) < snapDistance) {
    nearestPoint=drawingPoints.get(0);
  }
  if (nearestPoint != null) {
    isSnapped=true;
    levelCursor=nearestPoint;
  }
 else {
    isSnapped=false;
  }
}
Program: 40068
Project: 40068
Buggy source:
protected void calculateNormal(){
  Vector2D temp=vB.sub(vA);
  temp.normalize();
  vN.x=-temp.x;
  vN.y=temp.y;
}

Fixed version (ground truth):
protected void calculateNormal(){
  Vector2D temp=vB.sub(vA);
  temp.normalize();
  vN=new Vector2D(-temp.x,temp.y);
}
Program: 40069
Project: 40069
Buggy source:
public void RequestPathToPosition(Vector2D m_CurrentDestination){
}

Fixed version (ground truth):
public boolean RequestPathToPosition(Vector2D m_CurrentDestination){
  return false;
}
Program: 40070
Project: 40070
Buggy source:
public void activateIfInactive(){
  if (isInactive()) {
    Activate();
  }
}

Fixed version (ground truth):
public void activateIfInactive(){
  if (isInactive()) {
    activate();
  }
}
Program: 40071
Project: 40071
Buggy source:
abstract public void renderAtPos(Vector2D p);

Fixed version (ground truth):
public void renderAtPos(Vector2D pos,String tts){
  renderAtPos(pos,tts);
  pos.x+=10;
  GameCanvas.transparentText();
  for (int it=0; it < m_SubGoals.size() - 1; it++) {
    m_SubGoals.get(it).renderAtPos(pos,tts);
  }
  pos.x-=10;
}
Program: 40072
Project: 40072
Buggy source:
abstract public void render();

Fixed version (ground truth):
public void render(){
  if (!m_SubGoals.isEmpty()) {
    m_SubGoals.get(0).render();
  }
}
Program: 40073
Project: 40073
Buggy source:
public void activateIfInactive(){
  if (isInactive()) {
    Activate();
  }
}

Fixed version (ground truth):
public void activateIfInactive(){
  if (isInactive()) {
    activate();
  }
}
Program: 40074
Project: 40074
Buggy source:
public raven.goals.Goal.curStatus process(){
  activateIfInactive();
  m_iStatus=ProcessSubgoals();
  if (m_iStatus == Goal.curStatus.completed && !m_Path.isEmpty()) {
    Activate();
  }
  return m_iStatus;
}

Fixed version (ground truth):
public raven.goals.Goal.curStatus process(){
  activateIfInactive();
  m_iStatus=ProcessSubgoals();
  if (m_iStatus == Goal.curStatus.completed && !m_Path.isEmpty()) {
    activate();
  }
  return m_iStatus;
}
Program: 40075
Project: 40075
Buggy source:
void activate(){
  m_iStatus=Goal.curStatus.active;
  GraphEdge edge=m_Path.get(0);
  m_Path.remove(0);
switch (edge.behavior()) {
case normal:
{
      AddSubgoal(new Goal_TraverseEdge(getM_pOwner(),edge,m_Path.isEmpty()));
    }
  break;
case GraphEdge.goesThroughDoor:
{
  AddSubgoal(new Goal_NegotiateDoor(getM_pOwner(),edge,m_Path.isEmpty()));
}
break;
case GraphEdge.jump:
{
}
break;
case GraphEdge.grapple:
{
}
break;
default :
throw new Exception("String_Node_Str");
}
}

Fixed version (ground truth):
public void activate(){
  m_iStatus=Goal.curStatus.active;
  GraphEdge edge=m_Path.get(0);
  m_Path.remove(0);
switch (edge.behavior()) {
case normal:
{
      AddSubgoal(new Goal_TraverseEdge(getM_pOwner(),edge,m_Path.isEmpty()));
    }
  break;
case GraphEdge.goesThroughDoor:
{
  AddSubgoal(new Goal_NegotiateDoor(getM_pOwner(),edge,m_Path.isEmpty()));
}
break;
case GraphEdge.jump:
{
}
break;
case GraphEdge.grapple:
{
}
break;
default :
throw new Exception("String_Node_Str");
}
}
Program: 40076
Project: 40076
Buggy source:
void activate(){
  m_iStatus=Goal.curStatus.active;
  removeAllSubgoals();
  if (getM_pOwner().getTargetSys().isTargetPresent()) {
    Vector2D lrp=getM_pOwner().getTargetSys().getLastRecordedPosition();
    if (lrp.isZero() || getM_pOwner().isAtPosition(lrp)) {
      AddSubgoal(new Goal_Explore(getM_pOwner()));
    }
 else {
      AddSubgoal(new Goal_MoveToPosition(getM_pOwner(),lrp));
    }
  }
 else {
    m_iStatus=Goal.curStatus.completed;
  }
}

Fixed version (ground truth):
public void activate(){
  m_iStatus=Goal.curStatus.active;
  removeAllSubgoals();
  if (getM_pOwner().getTargetSys().isTargetPresent()) {
    Vector2D lrp=getM_pOwner().getTargetSys().getLastRecordedPosition();
    if (lrp.isZero() || getM_pOwner().isAtPosition(lrp)) {
      AddSubgoal(new Goal_Explore(getM_pOwner()));
    }
 else {
      AddSubgoal(new Goal_MoveToPosition(getM_pOwner(),lrp));
    }
  }
 else {
    m_iStatus=Goal.curStatus.completed;
  }
}
Program: 40077
Project: 40077
Buggy source:
@Override public void render(){
  if (getM_pOwner().getTargetSys().isTargetPresent()) {
    GameCanvas.greenBrush();
    GameCanvas.redBrush();
    GameCanvas.circle(getM_pOwner().getTargetSys().getLastRecordedPosition(),3);
  }
}

Fixed version (ground truth):
@Override public void render(){
  if (getM_pOwner().getTargetSys().isTargetPresent()) {
    GameCanvas.greenBrush();
    GameCanvas.redBrush();
    GameCanvas.circle(getM_pOwner().getTargetSys().getLastRecordedPosition(),3);
  }
  if (!m_SubGoals.isEmpty()) {
    m_SubGoals.get(0).render();
  }
}
Program: 40078
Project: 40078
Buggy source:
public void activate(){
  m_iStatus=Goal.curStatus.active;
  GraphEdge edge=m_Path.get(0);
  m_Path.remove(0);
switch (edge.behavior()) {
case normal:
{
      AddSubgoal(new Goal_TraverseEdge(getM_pOwner(),edge,m_Path.isEmpty()));
    }
  break;
case GraphEdge.goesThroughDoor:
{
  AddSubgoal(new Goal_NegotiateDoor(getM_pOwner(),edge,m_Path.isEmpty()));
}
break;
case GraphEdge.jump:
{
}
break;
case GraphEdge.grapple:
{
}
break;
default :
throw new Exception("String_Node_Str");
}
}

Fixed version (ground truth):
public void activate(){
  m_iStatus=Goal.curStatus.active;
  NavGraphEdge edge=m_Path.get(0);
  m_Path.remove(0);
switch (edge.flags()) {
case NavGraphEdge.NORMAL:
{
      AddSubgoal(new Goal_TraverseEdge(getM_pOwner(),edge,m_Path.isEmpty()));
    }
  break;
case NavGraphEdge.GOES_THROUGH_DOOR:
{
  AddSubgoal(new Goal_NegotiateDoor(getM_pOwner(),edge,m_Path.isEmpty()));
}
break;
case NavGraphEdge.JUMP:
{
}
break;
case NavGraphEdge.GRAPPLE:
{
}
break;
default :
try {
throw new Exception("String_Node_Str");
}
 catch (Exception e) {
e.printStackTrace();
}
}
}
Program: 40079
Project: 40079
Buggy source:
boolean isStuck(){
  double TimeTaken=Clock.GetCurrentTime() - m_dStartTime;
  if (TimeTaken > m_dTimeToReachPos) {
    System.out.println("String_Node_Str" + getM_pOwner().ID() + "String_Node_Str");
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isStuck(){
  double TimeTaken=System.nanoTime() * 1000 - m_dStartTime;
  if (TimeTaken > m_dTimeToReachPos) {
    System.out.println("String_Node_Str" + getM_pOwner().ID() + "String_Node_Str");
    return true;
  }
  return false;
}
Program: 40080
Project: 40080
Buggy source:
@Override public void activate(){
  m_iStatus=Goal.curStatus.active;
  m_dStartTime=Clock.GetCurrentTime();
  m_dTimeToReachPos=getM_pOwner().calculateTimeToReachPosition(m_vPosition);
  double MarginOfError=1.0;
  m_dTimeToReachPos+=MarginOfError;
  getM_pOwner().getSteering().SetTarget(m_vPosition);
  getM_pOwner().getSteering().SeekOn();
}

Fixed version (ground truth):
@Override public void activate(){
  m_iStatus=Goal.curStatus.active;
  m_dStartTime=System.nanoTime() * 1000;
  m_dTimeToReachPos=getM_pOwner().calculateTimeToReachPosition(m_vPosition);
  double MarginOfError=1.0;
  m_dTimeToReachPos+=MarginOfError;
  getM_pOwner().getSteering().SetTarget(m_vPosition);
  getM_pOwner().getSteering().SeekOn();
}
Program: 40081
Project: 40081
Buggy source:
boolean isStuck(){
  double TimeTaken=Clock.GetCurrentTime() - m_dStartTime;
  if (TimeTaken > m_dTimeExpected) {
    System.out.println("String_Node_Str" + getM_pOwner().ID() + "String_Node_Str");
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isStuck(){
  double TimeTaken=System.nanoTime() * 1000 - m_dStartTime;
  if (TimeTaken > m_dTimeExpected) {
    System.out.println("String_Node_Str" + getM_pOwner().ID() + "String_Node_Str");
    return true;
  }
  return false;
}
Program: 40082
Project: 40082
Buggy source:
public Goal_TraverseEdge(RavenBot ravenBot,GraphEdge edge,boolean lastedgeinpath){
  super(ravenBot,Goal.goalType.goal_traverse_edge);
  m_Edge=edge;
  m_dTimeExpected=0.0;
  m_bLastEdgeInPath=lastedgeinpath;
}

Fixed version (ground truth):
public Goal_TraverseEdge(RavenBot ravenBot,NavGraphEdge edge,boolean lastedgeinpath){
  super(ravenBot,Goal.goalType.goal_traverse_edge);
  m_Edge=edge;
  m_dTimeExpected=0.0;
  m_bLastEdgeInPath=lastedgeinpath;
}
Program: 40083
Project: 40083
Buggy source:
@Override public void activate(){
  m_iStatus=Goal.curStatus.active;
switch (m_Edge.behavior()) {
case swim:
{
      getM_pOwner().SetMaxSpeed(script.GetDouble("String_Node_Str"));
    }
  break;
case crawl:
{
  getM_pOwner().SetMaxSpeed(script.GetDouble("String_Node_Str"));
}
break;
}
m_dStartTime=Clock.GetCurrentTime();
m_dTimeExpected=getM_pOwner().calculateTimeToReachPosition(m_Edge.destination());
double MarginOfError=2.0;
m_dTimeExpected+=MarginOfError;
getM_pOwner().getSteering().SetTarget(m_Edge.destination());
if (m_bLastEdgeInPath) {
getM_pOwner().getSteering().ArriveOn();
}
 else {
getM_pOwner().getSteering().SeekOn();
}
}

Fixed version (ground truth):
@Override public void activate(){
  m_iStatus=Goal.curStatus.active;
switch (m_Edge.flags()) {
case NavGraphEdge.SWIM:
{
      getM_pOwner().setMaxSpeed(RavenScript.getDouble("String_Node_Str"));
    }
  break;
case NavGraphEdge.CRAWL:
{
  getM_pOwner().setMaxSpeed(RavenScript.getDouble("String_Node_Str"));
}
break;
}
m_dStartTime=System.nanoTime() * 1000;
m_dTimeExpected=getM_pOwner().calculateTimeToReachPosition(m_Edge.destination());
double MarginOfError=2.0;
m_dTimeExpected+=MarginOfError;
getM_pOwner().getSteering().SetTarget(m_Edge.destination());
if (m_bLastEdgeInPath) {
getM_pOwner().getSteering().ArriveOn();
}
 else {
getM_pOwner().getSteering().SeekOn();
}
}
Program: 40084
Project: 40084
Buggy source:
public void terminate(){
  getM_pOwner().getSteering().SeekOff();
  getM_pOwner().getSteering().ArriveOff();
  getM_pOwner().SetMaxSpeed(script.GetDouble("String_Node_Str"));
}

Fixed version (ground truth):
public void terminate(){
  getM_pOwner().getSteering().SeekOff();
  getM_pOwner().getSteering().ArriveOff();
  getM_pOwner().setMaxSpeed(RavenScript.getDouble("String_Node_Str"));
}
Program: 40085
Project: 40085
Buggy source:
public void RequestPathToPosition(Vector2D m_CurrentDestination){
}

Fixed version (ground truth):
public boolean RequestPathToPosition(Vector2D m_CurrentDestination){
  return false;
}
Program: 40086
Project: 40086
Buggy source:
public void activateIfInactive(){
  if (isInactive()) {
    Activate();
  }
}

Fixed version (ground truth):
public void activateIfInactive(){
  if (isInactive()) {
    activate();
  }
}
Program: 40087
Project: 40087
Buggy source:
abstract public void renderAtPos(Vector2D p);

Fixed version (ground truth):
public void renderAtPos(Vector2D pos,String tts){
  renderAtPos(pos,tts);
  pos.x+=10;
  GameCanvas.transparentText();
  for (int it=0; it < m_SubGoals.size() - 1; it++) {
    m_SubGoals.get(it).renderAtPos(pos,tts);
  }
  pos.x-=10;
}
Program: 40088
Project: 40088
Buggy source:
abstract public void render();

Fixed version (ground truth):
public void render(){
  if (!m_SubGoals.isEmpty()) {
    m_SubGoals.get(0).render();
  }
}
Program: 40089
Project: 40089
Buggy source:
public void activateIfInactive(){
  if (isInactive()) {
    Activate();
  }
}

Fixed version (ground truth):
public void activateIfInactive(){
  if (isInactive()) {
    activate();
  }
}
Program: 40090
Project: 40090
Buggy source:
public raven.goals.Goal.curStatus process(){
  activateIfInactive();
  m_iStatus=ProcessSubgoals();
  if (m_iStatus == Goal.curStatus.completed && !m_Path.isEmpty()) {
    Activate();
  }
  return m_iStatus;
}

Fixed version (ground truth):
public raven.goals.Goal.curStatus process(){
  activateIfInactive();
  m_iStatus=ProcessSubgoals();
  if (m_iStatus == Goal.curStatus.completed && !m_Path.isEmpty()) {
    activate();
  }
  return m_iStatus;
}
Program: 40091
Project: 40091
Buggy source:
void activate(){
  m_iStatus=Goal.curStatus.active;
  GraphEdge edge=m_Path.get(0);
  m_Path.remove(0);
switch (edge.behavior()) {
case normal:
{
      AddSubgoal(new Goal_TraverseEdge(getM_pOwner(),edge,m_Path.isEmpty()));
    }
  break;
case GraphEdge.goesThroughDoor:
{
  AddSubgoal(new Goal_NegotiateDoor(getM_pOwner(),edge,m_Path.isEmpty()));
}
break;
case GraphEdge.jump:
{
}
break;
case GraphEdge.grapple:
{
}
break;
default :
throw new Exception("String_Node_Str");
}
}

Fixed version (ground truth):
public void activate(){
  m_iStatus=Goal.curStatus.active;
  GraphEdge edge=m_Path.get(0);
  m_Path.remove(0);
switch (edge.behavior()) {
case normal:
{
      AddSubgoal(new Goal_TraverseEdge(getM_pOwner(),edge,m_Path.isEmpty()));
    }
  break;
case GraphEdge.goesThroughDoor:
{
  AddSubgoal(new Goal_NegotiateDoor(getM_pOwner(),edge,m_Path.isEmpty()));
}
break;
case GraphEdge.jump:
{
}
break;
case GraphEdge.grapple:
{
}
break;
default :
throw new Exception("String_Node_Str");
}
}
Program: 40092
Project: 40092
Buggy source:
void activate(){
  m_iStatus=Goal.curStatus.active;
  removeAllSubgoals();
  if (getM_pOwner().getTargetSys().isTargetPresent()) {
    Vector2D lrp=getM_pOwner().getTargetSys().getLastRecordedPosition();
    if (lrp.isZero() || getM_pOwner().isAtPosition(lrp)) {
      AddSubgoal(new Goal_Explore(getM_pOwner()));
    }
 else {
      AddSubgoal(new Goal_MoveToPosition(getM_pOwner(),lrp));
    }
  }
 else {
    m_iStatus=Goal.curStatus.completed;
  }
}

Fixed version (ground truth):
public void activate(){
  m_iStatus=Goal.curStatus.active;
  removeAllSubgoals();
  if (getM_pOwner().getTargetSys().isTargetPresent()) {
    Vector2D lrp=getM_pOwner().getTargetSys().getLastRecordedPosition();
    if (lrp.isZero() || getM_pOwner().isAtPosition(lrp)) {
      AddSubgoal(new Goal_Explore(getM_pOwner()));
    }
 else {
      AddSubgoal(new Goal_MoveToPosition(getM_pOwner(),lrp));
    }
  }
 else {
    m_iStatus=Goal.curStatus.completed;
  }
}
Program: 40093
Project: 40093
Buggy source:
@Override public void render(){
  if (getM_pOwner().getTargetSys().isTargetPresent()) {
    GameCanvas.greenBrush();
    GameCanvas.redBrush();
    GameCanvas.circle(getM_pOwner().getTargetSys().getLastRecordedPosition(),3);
  }
}

Fixed version (ground truth):
@Override public void render(){
  if (getM_pOwner().getTargetSys().isTargetPresent()) {
    GameCanvas.greenBrush();
    GameCanvas.redBrush();
    GameCanvas.circle(getM_pOwner().getTargetSys().getLastRecordedPosition(),3);
  }
  if (!m_SubGoals.isEmpty()) {
    m_SubGoals.get(0).render();
  }
}
Program: 40094
Project: 40094
Buggy source:
public void activate(){
  m_iStatus=Goal.curStatus.active;
  GraphEdge edge=m_Path.get(0);
  m_Path.remove(0);
switch (edge.behavior()) {
case normal:
{
      AddSubgoal(new Goal_TraverseEdge(getM_pOwner(),edge,m_Path.isEmpty()));
    }
  break;
case GraphEdge.goesThroughDoor:
{
  AddSubgoal(new Goal_NegotiateDoor(getM_pOwner(),edge,m_Path.isEmpty()));
}
break;
case GraphEdge.jump:
{
}
break;
case GraphEdge.grapple:
{
}
break;
default :
throw new Exception("String_Node_Str");
}
}

Fixed version (ground truth):
public void activate(){
  m_iStatus=Goal.curStatus.active;
  NavGraphEdge edge=m_Path.get(0);
  m_Path.remove(0);
switch (edge.flags()) {
case NavGraphEdge.NORMAL:
{
      AddSubgoal(new Goal_TraverseEdge(getM_pOwner(),edge,m_Path.isEmpty()));
    }
  break;
case NavGraphEdge.GOES_THROUGH_DOOR:
{
  AddSubgoal(new Goal_NegotiateDoor(getM_pOwner(),edge,m_Path.isEmpty()));
}
break;
case NavGraphEdge.JUMP:
{
}
break;
case NavGraphEdge.GRAPPLE:
{
}
break;
default :
try {
throw new Exception("String_Node_Str");
}
 catch (Exception e) {
e.printStackTrace();
}
}
}
Program: 40095
Project: 40095
Buggy source:
boolean isStuck(){
  double TimeTaken=Clock.GetCurrentTime() - m_dStartTime;
  if (TimeTaken > m_dTimeToReachPos) {
    System.out.println("String_Node_Str" + getM_pOwner().ID() + "String_Node_Str");
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isStuck(){
  double TimeTaken=System.nanoTime() * 1000 - m_dStartTime;
  if (TimeTaken > m_dTimeToReachPos) {
    System.out.println("String_Node_Str" + getM_pOwner().ID() + "String_Node_Str");
    return true;
  }
  return false;
}
Program: 40096
Project: 40096
Buggy source:
@Override public void activate(){
  m_iStatus=Goal.curStatus.active;
  m_dStartTime=Clock.GetCurrentTime();
  m_dTimeToReachPos=getM_pOwner().calculateTimeToReachPosition(m_vPosition);
  double MarginOfError=1.0;
  m_dTimeToReachPos+=MarginOfError;
  getM_pOwner().getSteering().SetTarget(m_vPosition);
  getM_pOwner().getSteering().SeekOn();
}

Fixed version (ground truth):
@Override public void activate(){
  m_iStatus=Goal.curStatus.active;
  m_dStartTime=System.nanoTime() * 1000;
  m_dTimeToReachPos=getM_pOwner().calculateTimeToReachPosition(m_vPosition);
  double MarginOfError=1.0;
  m_dTimeToReachPos+=MarginOfError;
  getM_pOwner().getSteering().SetTarget(m_vPosition);
  getM_pOwner().getSteering().SeekOn();
}
Program: 40097
Project: 40097
Buggy source:
boolean isStuck(){
  double TimeTaken=Clock.GetCurrentTime() - m_dStartTime;
  if (TimeTaken > m_dTimeExpected) {
    System.out.println("String_Node_Str" + getM_pOwner().ID() + "String_Node_Str");
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isStuck(){
  double TimeTaken=System.nanoTime() * 1000 - m_dStartTime;
  if (TimeTaken > m_dTimeExpected) {
    System.out.println("String_Node_Str" + getM_pOwner().ID() + "String_Node_Str");
    return true;
  }
  return false;
}
Program: 40098
Project: 40098
Buggy source:
public Goal_TraverseEdge(RavenBot ravenBot,GraphEdge edge,boolean lastedgeinpath){
  super(ravenBot,Goal.goalType.goal_traverse_edge);
  m_Edge=edge;
  m_dTimeExpected=0.0;
  m_bLastEdgeInPath=lastedgeinpath;
}

Fixed version (ground truth):
public Goal_TraverseEdge(RavenBot ravenBot,NavGraphEdge edge,boolean lastedgeinpath){
  super(ravenBot,Goal.goalType.goal_traverse_edge);
  m_Edge=edge;
  m_dTimeExpected=0.0;
  m_bLastEdgeInPath=lastedgeinpath;
}
Program: 40099
Project: 40099
Buggy source:
@Override public void activate(){
  m_iStatus=Goal.curStatus.active;
switch (m_Edge.behavior()) {
case swim:
{
      getM_pOwner().SetMaxSpeed(script.GetDouble("String_Node_Str"));
    }
  break;
case crawl:
{
  getM_pOwner().SetMaxSpeed(script.GetDouble("String_Node_Str"));
}
break;
}
m_dStartTime=Clock.GetCurrentTime();
m_dTimeExpected=getM_pOwner().calculateTimeToReachPosition(m_Edge.destination());
double MarginOfError=2.0;
m_dTimeExpected+=MarginOfError;
getM_pOwner().getSteering().SetTarget(m_Edge.destination());
if (m_bLastEdgeInPath) {
getM_pOwner().getSteering().ArriveOn();
}
 else {
getM_pOwner().getSteering().SeekOn();
}
}

Fixed version (ground truth):
@Override public void activate(){
  m_iStatus=Goal.curStatus.active;
switch (m_Edge.flags()) {
case NavGraphEdge.SWIM:
{
      getM_pOwner().setMaxSpeed(RavenScript.getDouble("String_Node_Str"));
    }
  break;
case NavGraphEdge.CRAWL:
{
  getM_pOwner().setMaxSpeed(RavenScript.getDouble("String_Node_Str"));
}
break;
}
m_dStartTime=System.nanoTime() * 1000;
m_dTimeExpected=getM_pOwner().calculateTimeToReachPosition(m_Edge.destination());
double MarginOfError=2.0;
m_dTimeExpected+=MarginOfError;
getM_pOwner().getSteering().SetTarget(m_Edge.destination());
if (m_bLastEdgeInPath) {
getM_pOwner().getSteering().ArriveOn();
}
 else {
getM_pOwner().getSteering().SeekOn();
}
}