nus-yam/ex-repair huggingface dataset:
Program: 154244
Project: 154244
Buggy source:
public Move getBestMove(MachineState state,Role role) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  minStateScores.clear();
  maxStateScores.clear();
  List<Move> moves=stateMachine.getLegalMoves(state,role);
  if (moves.size() == 1) {
    return moves.get(0);
  }
 else {
    Move bestMove=null;
    int bestValue=Integer.MIN_VALUE;
    for (    Move move : stateMachine.getLegalMoves(state,role)) {
      List<List<Move>> allJointMoves=stateMachine.getLegalJointMoves(state,role,move);
      for (      List<Move> jointMove : allJointMoves) {
        MachineState newState=stateMachine.getNextState(state,jointMove);
        int newValue=minScore(role,newState);
        if (newValue > bestValue) {
          bestValue=newValue;
          bestMove=move;
        }
      }
    }
    System.out.println("String_Node_Str" + bestValue);
    return bestMove;
  }
}

Fixed version (ground truth):
public Move getBestMove(MachineState state,Role role) throws MoveDefinitionException, GoalDefinitionException, TransitionDefinitionException {
  maxStateScores.clear();
  List<Move> moves=stateMachine.getLegalMoves(state,role);
  if (moves.size() == 1) {
    return moves.get(0);
  }
 else {
    Move bestMove=null;
    int bestValue=Integer.MIN_VALUE;
    for (    Move move : moves) {
      int value=minScore(role,move,state);
      if (value > bestValue) {
        bestValue=value;
        bestMove=move;
      }
    }
    System.out.println("String_Node_Str" + bestValue);
    return bestMove;
  }
}
Program: 154245
Project: 154245
Buggy source:
private int maxScore(Role role,MachineState state) throws GoalDefinitionException, MoveDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state))   return stateMachine.getGoal(state,role);
  int bestValue=Integer.MIN_VALUE;
  for (  Move move : stateMachine.getLegalMoves(state,role)) {
    List<List<Move>> allJointMoves=stateMachine.getLegalJointMoves(state,role,move);
    for (    List<Move> jointMove : allJointMoves) {
      MachineState newState=stateMachine.getNextState(state,jointMove);
      int newValue=minScore(role,newState);
      if (newValue > bestValue) {
        bestValue=newValue;
      }
    }
  }
  maxStateScores.put(state.toString(),bestValue);
  return bestValue;
}

Fixed version (ground truth):
private int maxScore(Role role,MachineState state) throws GoalDefinitionException, MoveDefinitionException, TransitionDefinitionException {
  if (stateMachine.isTerminal(state))   return stateMachine.getGoal(state,role);
  if (maxStateScores.get(state.toString()) != null)   return maxStateScores.get(state.toString());
  int bestValue=Integer.MIN_VALUE;
  for (  Move move : stateMachine.getLegalMoves(state,role)) {
    int value=minScore(role,move,state);
    if (value > bestValue) {
      bestValue=value;
    }
  }
  maxStateScores.put(state.toString(),bestValue);
  return bestValue;
}
Program: 154246
Project: 154246
Buggy source:
/** 
 * Returns a new Token object, by default. However, if you want, you can create and return subclass objects based on the value of ofKind. Simply add the cases to the switch for all those special cases. For example, if you have a subclass of Token called IDToken that you want to create if ofKind is ID, simply add something like : case MyParserConstants.ID : return new IDToken(); to the following switch statement. Then you can cast matchedToken variable to the appropriate type and use it in your lexical actions.
 */
public static Token newToken(int ofKind,String image){
switch (ofKind) {
case UnrealScriptParserConstants.RUNSIGNEDSHIFT:
case UnrealScriptParserConstants.RSIGNEDSHIFT:
case UnrealScriptParserConstants.GT:
    return new GTToken(ofKind,image);
default :
  return new Token(ofKind,image);
}
}

Fixed version (ground truth):
/** 
 * Returns a new Token object, by default. However, if you want, you can create and return subclass objects based on the value of ofKind. Simply add the cases to the switch for all those special cases. For example, if you have a subclass of Token called IDToken that you want to create if ofKind is ID, simply add something like : case MyParserConstants.ID : return new IDToken(); to the following switch statement. Then you can cast matchedToken variable to the appropriate type and use it in your lexical actions.
 */
public static Token newToken(int ofKind,String image){
switch (ofKind) {
case UnrealScriptParserConstants.RUNSIGNEDSHIFT:
    return new GTToken(ofKind,image,UnrealScriptParserConstants.RUNSIGNEDSHIFT);
case UnrealScriptParserConstants.RSIGNEDSHIFT:
  return new GTToken(ofKind,image,UnrealScriptParserConstants.RSIGNEDSHIFT);
case UnrealScriptParserConstants.GT:
return new GTToken(ofKind,image,UnrealScriptParserConstants.GT);
default :
return new Token(ofKind,image);
}
}
Program: 154247
Project: 154247
Buggy source:
public GTToken(int kind,String image){
  super(kind,image);
}

Fixed version (ground truth):
public GTToken(int kind,String image,int realKind){
  super(kind,image);
  this.realKind=realKind;
}
Program: 154248
Project: 154248
Buggy source:
private void connectAndJoin(){
}

Fixed version (ground truth):
private void connectAndJoin(){
  String server=conf.getString("String_Node_Str","String_Node_Str");
  String username=conf.getString("String_Node_Str","String_Node_Str");
  String password=conf.getString("String_Node_Str","String_Node_Str");
  String channel=conf.getString("String_Node_Str","String_Node_Str");
  String nickname=conf.getString("String_Node_Str","String_Node_Str");
  if (!server.equals("String_Node_Str") && !username.equals("String_Node_Str") && !password.equals("String_Node_Str")&& !channel.equals("String_Node_Str")) {
    try {
      log.info("String_Node_Str");
      xmppconn=new XMPPConnection(server);
      xmppconn.connect();
      if (!xmppconn.isConnected()) {
        log.error("String_Node_Str");
        return;
      }
      xmppconn.login(username,password);
      log.info("String_Node_Str");
      muc=new MultiUserChat(xmppconn,channel);
      DiscussionHistory history=new DiscussionHistory();
      history.setMaxStanzas(0);
      muc.join(nickname,"String_Node_Str",history,2000);
      muc.addMessageListener(this);
      muc.addParticipantStatusListener(participantListener);
    }
 catch (    Exception e) {
      log.warning("String_Node_Str" + server);
    }
  }
 else {
    log.warning("String_Node_Str");
  }
}
Program: 154249
Project: 154249
Buggy source:
public void sendMUCMessage(String msg){
}

Fixed version (ground truth):
public void sendMUCMessage(String msg){
  if (xmppconn.isConnected() && muc.isJoined()) {
    muc.sendMessage(msg);
  }
}
Program: 154250
Project: 154250
Buggy source:
private void connectAndJoin(){
  String server=conf.getString("String_Node_Str","String_Node_Str");
  String username=conf.getString("String_Node_Str","String_Node_Str");
  String password=conf.getString("String_Node_Str","String_Node_Str");
  String channel=conf.getString("String_Node_Str","String_Node_Str");
  String nickname=conf.getString("String_Node_Str","String_Node_Str");
  if (!server.equals("String_Node_Str") && !username.equals("String_Node_Str") && !password.equals("String_Node_Str")&& !channel.equals("String_Node_Str")) {
    try {
      log.info("String_Node_Str");
      xmppconn=new XMPPConnection(server);
      xmppconn.connect();
      if (!xmppconn.isConnected()) {
        log.error("String_Node_Str");
        return;
      }
      xmppconn.login(username,password);
      log.info("String_Node_Str");
      muc=new MultiUserChat(xmppconn,channel);
      DiscussionHistory history=new DiscussionHistory();
      history.setMaxStanzas(0);
      muc.join(nickname,"String_Node_Str",history,2000);
      muc.addMessageListener(this);
      muc.addParticipantStatusListener(participantListener);
    }
 catch (    Exception e) {
      log.warning("String_Node_Str" + server);
    }
  }
 else {
    log.warning("String_Node_Str");
  }
}

Fixed version (ground truth):
private void connectAndJoin(){
  String server=conf.getString("String_Node_Str","String_Node_Str");
  String username=conf.getString("String_Node_Str","String_Node_Str");
  String password=conf.getString("String_Node_Str","String_Node_Str");
  String channel=conf.getString("String_Node_Str","String_Node_Str");
  String nickname=conf.getString("String_Node_Str","String_Node_Str");
  if (!server.equals("String_Node_Str") && !username.equals("String_Node_Str") && !password.equals("String_Node_Str")&& !channel.equals("String_Node_Str")) {
    try {
      log.info("String_Node_Str");
      xmppconn=new XMPPConnection(server);
      xmppconn.connect();
      if (!xmppconn.isConnected()) {
        log.warning("String_Node_Str");
        return;
      }
      xmppconn.login(username,password);
      log.info("String_Node_Str");
      muc=new MultiUserChat(xmppconn,channel);
      DiscussionHistory history=new DiscussionHistory();
      history.setMaxStanzas(0);
      muc.join(nickname,"String_Node_Str",history,2000);
      muc.addMessageListener(this);
      muc.addParticipantStatusListener(participantListener);
    }
 catch (    Exception e) {
      log.warning("String_Node_Str" + server);
    }
  }
 else {
    log.warning("String_Node_Str");
  }
}
Program: 154251
Project: 154251
Buggy source:
public void sendMUCMessage(String msg){
  if (xmppconn.isConnected() && muc.isJoined()) {
    muc.sendMessage(msg);
  }
}

Fixed version (ground truth):
public void sendMUCMessage(String msg){
  if (xmppconn.isConnected() && muc.isJoined()) {
    try {
      muc.sendMessage(msg);
    }
 catch (    Exception e) {
      log.warning("String_Node_Str");
    }
  }
}
Program: 154252
Project: 154252
Buggy source:
public void processPacket(Packet p){
  if (p instanceof Message) {
    final Message message=(Message)p;
    if (message.getType() == Message.Type.groupchat) {
      if (!StringUtils.parseResource(message.getFrom()).equalsIgnoreCase(nickname)) {
        String outmsg=ChatColor.GRAY + "String_Node_Str" + ChatColor.DARK_GREEN+ "String_Node_Str"+ ChatColor.GRAY+ "String_Node_Str"+ ChatColor.WHITE+ StringUtils.parseResource(message.getFrom())+ "String_Node_Str"+ message.getBody();
        sendMCMessage(outmsg);
        log.info(outmsg);
      }
    }
  }
}

Fixed version (ground truth):
public void processPacket(Packet p){
  if (p instanceof Message) {
    final Message message=(Message)p;
    if (message.getType() == Message.Type.groupchat) {
      if (!StringUtils.parseResource(message.getFrom()).equalsIgnoreCase(conf.getString("String_Node_Str","String_Node_Str"))) {
        String outmsg=ChatColor.GRAY + "String_Node_Str" + ChatColor.DARK_GREEN+ "String_Node_Str"+ ChatColor.GRAY+ "String_Node_Str"+ ChatColor.WHITE+ StringUtils.parseResource(message.getFrom())+ "String_Node_Str"+ message.getBody();
        sendMCMessage(outmsg);
        log.info(outmsg);
      }
    }
  }
}
Program: 154253
Project: 154253
Buggy source:
@Override public boolean performFinish(){
  IFile file=page.createNewFile();
  if (file == null)   return false;
  IContainer parent=file.getParent();
  if (parent != null && parent.exists()) {
    IFile sourceFile=parent.getFile(new Path("String_Node_Str"));
    if (sourceFile != null && sourceFile.exists()) {
      String filename=page.getFileName();
      String append="String_Node_Str" + filename + "String_Node_Str"+ filename;
      try {
        sourceFile.appendContents(new ByteArrayInputStream(append.getBytes()),false,true,null);
      }
 catch (      CoreException e) {
        e.printStackTrace();
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  IFile file=page.createNewFile();
  if (file == null)   return false;
  IContainer parent=file.getParent();
  if (parent != null && parent.exists()) {
    IFile sourceFile=parent.getFile(new Path(parent.getName() + "String_Node_Str"));
    if (sourceFile != null && sourceFile.exists()) {
      String filename=page.getFileName();
      String append="String_Node_Str" + filename + "String_Node_Str"+ filename;
      try {
        sourceFile.appendContents(new ByteArrayInputStream(append.getBytes()),false,true,null);
      }
 catch (      CoreException e) {
        e.printStackTrace();
      }
    }
  }
  return true;
}
Program: 154254
Project: 154254
Buggy source:
@Override public boolean performFinish(){
  IFolder folder=page.createNewFolder();
  if (folder == null)   return false;
  IFile sourceFile=folder.getFile("String_Node_Str");
  try {
    sourceFile.create(new ByteArrayInputStream("String_Node_Str".getBytes()),false,null);
  }
 catch (  CoreException e) {
    e.printStackTrace();
    return false;
  }
  IContainer parent=folder.getParent();
  if (parent != null) {
    IFile parentSourceFile=parent.getFile(new Path("String_Node_Str"));
    if (parentSourceFile != null) {
      String newlines="String_Node_Str";
      if (!parentSourceFile.exists()) {
        try {
          parentSourceFile.create(new ByteArrayInputStream("String_Node_Str".getBytes()),false,null);
          newlines="String_Node_Str";
        }
 catch (        CoreException e) {
          e.printStackTrace();
        }
      }
      if (parentSourceFile.exists()) {
        String folderName=folder.getName();
        String append=newlines + "String_Node_Str" + folderName+ "String_Node_Str"+ folder.getName()+ "String_Node_Str";
        try {
          parentSourceFile.appendContents(new ByteArrayInputStream(append.getBytes()),false,true,null);
        }
 catch (        CoreException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  IFolder folder=page.createNewFolder();
  if (folder == null)   return false;
  IFile sourceFile=folder.getFile(folder.getName() + "String_Node_Str");
  try {
    sourceFile.create(new ByteArrayInputStream("String_Node_Str".getBytes()),false,null);
  }
 catch (  CoreException e) {
    e.printStackTrace();
    return false;
  }
  IContainer parent=folder.getParent();
  if (parent != null) {
    IFile parentSourceFile=parent.getFile(new Path(parent.getName() + "String_Node_Str"));
    if (parentSourceFile != null) {
      String newlines="String_Node_Str";
      if (!parentSourceFile.exists()) {
        try {
          parentSourceFile.create(new ByteArrayInputStream("String_Node_Str".getBytes()),false,null);
          newlines="String_Node_Str";
        }
 catch (        CoreException e) {
          e.printStackTrace();
        }
      }
      if (parentSourceFile.exists()) {
        String folderName=folder.getName();
        String append=newlines + "String_Node_Str" + folderName+ "String_Node_Str"+ folder.getName()+ "String_Node_Str"+ folderName+ "String_Node_Str";
        try {
          parentSourceFile.appendContents(new ByteArrayInputStream(append.getBytes()),false,true,null);
        }
 catch (        CoreException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return true;
}
Program: 154255
Project: 154255
Buggy source:
public synchronized void removeNodeFromCurrentInstances(Node node){
  nn--;
  numberOfNodesLbl.setText(String.valueOf(nn));
synchronized (model) {
    if (null != node) {
      logger.debug("String_Node_Str" + node + "String_Node_Str");
      for (int i=0; i < model.getRowCount(); i++) {
        if (((String)(model.getValueAt(i,0))).equals(node.getNodeName())) {
          model.removeRow(i);
          logger.debug(node + "String_Node_Str");
          return;
        }
      }
    }
 else {
      logger.error("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public synchronized void removeNodeFromCurrentInstances(Node node){
  nn--;
  numberOfNodesLbl.setText(String.valueOf(nn));
synchronized (model) {
    if (null != node) {
      logger.debug("String_Node_Str" + node + "String_Node_Str");
      for (int i=0; i < model.getRowCount(); i++) {
        if (((String)(model.getValueAt(i,1))).equals(node.getIP() + "String_Node_Str" + node.getPort())) {
          model.removeRow(i);
          logger.debug(node + "String_Node_Str");
          return;
        }
      }
      logger.error("String_Node_Str" + node);
    }
 else {
      logger.error("String_Node_Str");
    }
  }
}
Program: 154256
Project: 154256
Buggy source:
@Override public void initializeDataBlocks(List<Block> blocks){
  if (blocks != null & model.getRowCount() == 0) {
    for (    Block block : blocks) {
      if (StringUtils.isNotEmpty(block.getName())) {
        model.insertRow(model.getRowCount(),new Object[]{block.getName(),Size.getSizeString(block.getSize()),0,0});
      }
 else {
        logger.error("String_Node_Str");
      }
    }
  }
 else {
    logger.error("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void initializeDataBlocks(List<Block> blocks){
  if (blocks != null & model.getRowCount() == 0) {
    for (    Block block : blocks) {
      if (StringUtils.isNotEmpty(block.getName())) {
        model.insertRow(model.getRowCount(),new Object[]{block.getName(),Size.getSizeString(block.getSize()),0,0});
      }
 else {
        logger.error("String_Node_Str");
      }
    }
  }
 else {
    if (blocks == null)     logger.error("String_Node_Str");
  }
}
Program: 154257
Project: 154257
Buggy source:
private void checkIfCanAcceptRequest(){
  if (!acceptRequest) {
    boolean found=false;
    for (    String pid : pt.keySet()) {
      if (pt.get(pid).getRequest().getDestinationNode() != null) {
        found=true;
        break;
      }
    }
    if (!found)     acceptRequest=true;
  }
  trigger(new MemoryCheckOperation(),cpu);
}

Fixed version (ground truth):
private synchronized void checkIfCanAcceptRequest(){
  if (!acceptRequest) {
    boolean found=false;
    for (    String pid : pt.keySet()) {
      if (pt.get(pid).getRequest().getDestinationNode() != null) {
        found=true;
        break;
      }
    }
    if (!found)     acceptRequest=true;
  }
  trigger(new MemoryCheckOperation(),cpu);
}
Program: 154258
Project: 154258
Buggy source:
protected double calculateAverageThroughput(){
  int throughputSum=0;
  double mean;
  for (  Integer tp : throughputCollection) {
    throughputSum+=tp;
  }
  if (throughputCollection.size() == 0)   mean=0;
 else   mean=throughputSum / throughputCollection.size();
  throughputCollection.clear();
  return mean;
}

Fixed version (ground truth):
protected double calculateAverageThroughput(){
  int throughputSum=0;
  double mean;
  for (  Integer tp : throughputCollection) {
    throughputSum+=tp;
  }
  if (throughputCollection.size() == 0)   return previousTP;
 else   mean=throughputSum / throughputCollection.size();
  previousTP=mean;
  throughputCollection.clear();
  return mean;
}
Program: 154259
Project: 154259
Buggy source:
public void activateFor(Node node){
  if (replicas.contains(node))   active=true;
 else   replicas.add(node);
}

Fixed version (ground truth):
public void activateFor(Node node){
  if (!replicas.contains(node)) {
    active=true;
    replicas.add(node);
  }
}
Program: 154260
Project: 154260
Buggy source:
public List<Block> prepareBlocksForNode(Node node){
  List<Block> blocks=new ArrayList<Block>();
  for (  ELBEntry entry : entries) {
    if (entry.getNrOfReplicas() < desireReplicateDegree) {
      entry.updateNode(node);
      blocks.add(entry.getBlock());
    }
  }
  if (blocks.size() == 0) {
    selectRandomNumberOfBlocks(blocks,node);
  }
  return blocks;
}

Fixed version (ground truth):
public List<Block> prepareBlocksForNode(Node node){
  List<Block> blocks=new ArrayList<Block>();
  for (  ELBEntry entry : entries) {
    if (entry.getNrOfReplicas() < desireReplicateDegree) {
      blocks.add(entry.getBlock());
    }
  }
  if (blocks.size() == 0) {
    selectRandomNumberOfBlocks(blocks,node);
  }
  return blocks;
}
Program: 154261
Project: 154261
Buggy source:
private void selectRandomNumberOfBlocks(List<Block> blocks,Node node){
  for (int i=0; i < entries.size(); i+=2) {
    ELBEntry entry=entries.get(i);
    entry.updateNode(node);
    blocks.add(entry.getBlock());
  }
}

Fixed version (ground truth):
private void selectRandomNumberOfBlocks(List<Block> blocks,Node node){
  for (int i=0; i < entries.size(); i+=2) {
    ELBEntry entry=entries.get(i);
    blocks.add(entry.getBlock());
  }
}
Program: 154262
Project: 154262
Buggy source:
@Override public synchronized void log(String text){
  logTextArea.append(text + "String_Node_Str");
  if (!logTextLocked.get())   logTextArea.setCaretPosition(logTextArea.getText().length());
 else   logTextArea.setCaretPosition(lockedPosition);
}

Fixed version (ground truth):
@Override public void log(String text){
  logTextArea.append(text + "String_Node_Str");
  if (!logTextLocked.get())   logTextArea.setCaretPosition(logTextArea.getText().length());
 else   logTextArea.setCaretPosition(lockedPosition);
}
Program: 154263
Project: 154263
Buggy source:
private String fticks(String msg){
  StringBuffer buf=new StringBuffer();
  String fields[]=msg.split("String_Node_Str");
  String principalName=fields[8];
  buf.append("String_Node_Str");
  buf.append("String_Node_Str").append(getFederationIdentifier());
  buf.append("String_Node_Str").append(getVersion());
  buf.append("String_Node_Str").append(fields[0]);
  buf.append("String_Node_Str").append(fields[3]);
  buf.append("String_Node_Str").append(fields[5]);
  buf.append("String_Node_Str").append(anonymize(principalName));
  buf.append("String_Node_Str").append(fields[9]);
  buf.append("String_Node_Str");
  return buf.toString();
}

Fixed version (ground truth):
private String fticks(String msg){
  StringBuffer buf=new StringBuffer();
  String fields[]=msg.split("String_Node_Str");
  buf.append("String_Node_Str");
  buf.append("String_Node_Str").append(getFederationIdentifier());
  buf.append("String_Node_Str").append(getVersion());
  buf.append("String_Node_Str").append(fields[0]);
  if (fields.length > 3) {
    buf.append("String_Node_Str").append(fields[3]);
  }
  if (fields.length > 5) {
    buf.append("String_Node_Str").append(fields[5]);
  }
  if (fields.length > 8) {
    buf.append("String_Node_Str").append(anonymize(fields[8]));
  }
  if (fields.length > 9) {
    buf.append("String_Node_Str").append(fields[9]);
  }
  buf.append("String_Node_Str");
  return buf.toString();
}
Program: 154264
Project: 154264
Buggy source:
private Object convertFromAvroPrimitive(Object inObj,Class<?> inType){
  if (inObj == null) {
    return null;
  }
 else   if (inType == String.class) {
    String convertedObj=((Utf8)inObj).toString();
    return convertedObj;
  }
 else   if (inType == BytesWritable.class) {
    return new BytesWritable(((ByteBuffer)inObj).array());
  }
 else   if (inType.isEnum()) {
    return inObj.toString();
  }
 else {
    return inObj;
  }
}

Fixed version (ground truth):
private Object convertFromAvroPrimitive(Object inObj,Class<?> inType){
  if (inObj == null) {
    return null;
  }
 else   if (inType == String.class) {
    String convertedObj=((Utf8)inObj).toString();
    return convertedObj;
  }
 else   if (inType == BytesWritable.class) {
    ByteBuffer buffer=(ByteBuffer)inObj;
    BytesWritable result=new BytesWritable();
    result.set(buffer.array(),buffer.position(),buffer.limit());
    return result;
  }
 else   if (inType.isEnum()) {
    return inObj.toString();
  }
 else {
    return inObj;
  }
}
Program: 154265
Project: 154265
Buggy source:
private Object convertFromAvroPrimitive(Object inObj,Class inType){
  Class curType=inObj.getClass();
  if (curType == Utf8.class) {
    String convertedObj=((Utf8)inObj).toString();
    return convertedObj;
  }
 else   if (curType == BytesWritable.class) {
    return new BytesWritable(((ByteBuffer)inObj).array());
  }
  return inObj;
}

Fixed version (ground truth):
private Object convertFromAvroPrimitive(Object inObj,Class inType){
  if (inType == String.class) {
    String convertedObj=((Utf8)inObj).toString();
    return convertedObj;
  }
 else   if (inType == BytesWritable.class) {
    return new BytesWritable(((ByteBuffer)inObj).array());
  }
  return inObj;
}
Program: 154266
Project: 154266
Buggy source:
private Object convertToAvroPrimitive(Object inObj,Class curType){
  if (curType == String.class) {
    Utf8 convertedObj=new Utf8((String)inObj);
    return convertedObj;
  }
 else   if (curType == BytesWritable.class) {
    ByteBuffer convertedObj=ByteBuffer.wrap(((BytesWritable)inObj).get());
    return convertedObj;
  }
 else {
    return inObj;
  }
}

Fixed version (ground truth):
private Object convertToAvroPrimitive(Object inObj,Class curType){
  if (curType == String.class) {
    Utf8 convertedObj=new Utf8((String)inObj);
    return convertedObj;
  }
 else   if (curType == BytesWritable.class) {
    BytesWritable bw=(BytesWritable)inObj;
    ByteBuffer convertedObj=ByteBuffer.wrap(bw.get(),0,bw.getSize());
    return convertedObj;
  }
 else {
    return inObj;
  }
}
Program: 154267
Project: 154267
Buggy source:
private void clearFields(){
  SpinnerNumberModel model=new SpinnerNumberModel(0,0,0,0);
  buildTypeAmountSpinner.setModel(model);
  buildTypeAmountSpinner.setVisible(false);
  projectedCosts=0;
  cartListModel.clear();
  railroadRadioButton.setEnabled(false);
  industrialRadioButton.setEnabled(false);
  residentialRadioButton.setEnabled(false);
  stadiumRadioButton.setEnabled(false);
  monopolyTowerRadioButton.setEnabled(false);
  skyscraperRadioButton.setEnabled(false);
  removeHazardRadioButton.setEnabled(false);
  railroadRadioButton.setSelected(false);
  industrialRadioButton.setSelected(false);
  residentialRadioButton.setSelected(false);
  stadiumRadioButton.setSelected(false);
  monopolyTowerRadioButton.setSelected(false);
  skyscraperRadioButton.setSelected(false);
  removeHazardRadioButton.setSelected(false);
}

Fixed version (ground truth):
private void clearFields(){
  SpinnerNumberModel model=new SpinnerNumberModel(0,0,0,0);
  buildTypeAmountSpinner.setModel(model);
  buildTypeAmountSpinner.setVisible(false);
  projectedCosts=0;
  cartListModel.clear();
  messageTextField.setText("String_Node_Str");
  clearRadio();
}
Program: 154268
Project: 154268
Buggy source:
public void enter(){
  System.out.println("String_Node_Str");
  currentPlayer=GameMaster.getInstance().getCurrentPlayer();
  playerCash=GameMaster.getInstance().getCurrentPlayer().getCash();
  playerAllowance=generateAllowance();
  allowanceRemaining=playerAllowance;
  clearFields();
  totalTextField.setText("String_Node_Str" + projectedCosts + "String_Node_Str");
  playerDistricts=new String[currentPlayer.getDistricts().size() + 1];
  comboBoxModel=new DefaultComboBoxModel(playerDistricts);
  comboBoxModel.removeAllElements();
  for (int jj=0; jj < currentPlayer.getDistricts().size() + 1; jj++) {
    if (jj == 0)     playerDistricts[jj]="String_Node_Str";
 else     playerDistricts[jj]=currentPlayer.getDistricts().get(jj - 1).getName();
    comboBoxModel.addElement(playerDistricts[jj]);
  }
  ownedDistrictsComboBox.setModel(comboBoxModel);
  playerCashTextField.setText("String_Node_Str" + playerCash + "String_Node_Str");
  if (allowanceRemaining == -1) {
    buildAllowanceTextField.setText("String_Node_Str");
  }
 else   buildAllowanceTextField.setText(allowanceRemaining + "String_Node_Str");
  mainFrame.setContentPane(layeredPane);
  layeredPane.revalidate();
  startMode();
}

Fixed version (ground truth):
public void enter(){
  System.out.println("String_Node_Str");
  currentPlayer=GameMaster.getInstance().getCurrentPlayer();
  if (currentPlayer.getDistricts().size() < 2) {
    System.out.println(currentPlayer.getDistricts().size());
    gameStateMachine.setState(gameStateMachine.getGamePlayState());
  }
  System.out.println(currentPlayer.getDistricts().size());
  playerCash=GameMaster.getInstance().getCurrentPlayer().getCash();
  playerAllowance=generateAllowance();
  allowanceRemaining=playerAllowance;
  clearFields();
  totalTextField.setText("String_Node_Str" + projectedCosts + "String_Node_Str");
  playerDistricts=new String[currentPlayer.getDistricts().size() + 1];
  comboBoxModel=new DefaultComboBoxModel(playerDistricts);
  comboBoxModel.removeAllElements();
  for (int jj=0; jj < currentPlayer.getDistricts().size() + 1; jj++) {
    if (jj == 0)     playerDistricts[jj]="String_Node_Str";
 else     playerDistricts[jj]=currentPlayer.getDistricts().get(jj - 1).getName();
    comboBoxModel.addElement(playerDistricts[jj]);
  }
  ownedDistrictsComboBox.setModel(comboBoxModel);
  playerCashTextField.setText("String_Node_Str" + playerCash + "String_Node_Str");
  if (allowanceRemaining == -1) {
    buildAllowanceTextField.setText("String_Node_Str");
  }
 else   buildAllowanceTextField.setText(allowanceRemaining + "String_Node_Str");
  mainFrame.setContentPane(layeredPane);
  layeredPane.revalidate();
  startMode();
}
Program: 154270
Project: 154270
Buggy source:
public BuildButton(){
  setText("String_Node_Str");
  setPreferredSize(new Dimension(100,30));
  addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      System.out.println("String_Node_Str");
      if (playerCash > projectedCosts) {
        currentPlayer.collect(projectedCosts);
        gameStateMachine.setState(gameStateMachine.getGamePlayState());
      }
 else       messageTextField.setText("String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
public BuildButton(){
  setText("String_Node_Str");
  setPreferredSize(new Dimension(100,30));
  addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      System.out.println("String_Node_Str");
      if (playerCash > projectedCosts) {
        currentPlayer.pay(projectedCosts);
        gameStateMachine.setState(gameStateMachine.getGamePlayState());
      }
 else       messageTextField.setText("String_Node_Str");
    }
  }
);
}
Program: 154272
Project: 154272
Buggy source:
@Override public void performCard(){
  gameMaster=GameMaster.getInstance();
  gamePane=GamePane.getInstance();
  gamePane.clearMessageLayer();
  if (!failed)   gamePane.setMessagePanelText("String_Node_Str");
 else   gamePane.setMessagePanelText("String_Node_Str");
  gamePane.addMessagePanelText("String_Node_Str");
  gamePane.setSelectedDistrict(-1);
  JButton startAuctionButton=new JButton("String_Node_Str");
  startAuctionButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      startAuctionButtonPerformed();
    }
  }
);
  gamePane.addMessagePanelButton(startAuctionButton);
}

Fixed version (ground truth):
@Override public void performCard(){
  gameMaster=GameMaster.getInstance();
  gamePane=GamePane.getInstance();
  gamePane.clearMessageLayer();
  if (!failed)   gamePane.setMessagePanelText("String_Node_Str");
 else   gamePane.setMessagePanelText("String_Node_Str");
  gamePane.addMessagePanelText("String_Node_Str");
  gamePane.clearSelectedDistrict();
  JButton startAuctionButton=new JButton("String_Node_Str");
  startAuctionButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      startAuctionButtonPerformed();
    }
  }
);
  gamePane.addMessagePanelButton(startAuctionButton);
}
Program: 154273
Project: 154273
Buggy source:
protected void startAuctionButtonPerformed(){
  int selectedDistrictIndex=gamePane.getSelectedDistrict();
  Board board=gameMaster.getBoard();
  Square selectedSquare=board.getSquare(selectedDistrictIndex);
  District district;
  if (selectedSquare.getType() == SQUARETYPE.DISTRICT) {
    district=(District)selectedSquare;
    if (!district.isOwned()) {
      gamePane.clearSelectedDistrict();
      gameMaster.startAuction();
    }
 else {
      failed=true;
      performCard();
    }
  }
}

Fixed version (ground truth):
protected void startAuctionButtonPerformed(){
  int selectedDistrictIndex=gamePane.getSelectedDistrict();
  Board board=gameMaster.getBoard();
  if (selectedDistrictIndex != -1) {
    Square selectedSquare=board.getSquare(selectedDistrictIndex);
    District district;
    if (selectedSquare.getType() == SQUARETYPE.DISTRICT) {
      district=(District)selectedSquare;
      if (!district.isOwned()) {
        gameMaster.startAuction();
      }
 else {
        failed=true;
        performCard();
      }
    }
  }
 else {
    failed=true;
    performCard();
  }
}
Program: 154274
Project: 154274
Buggy source:
public ChanceDeck(){
  chanceCards=new ArrayList<ChanceCard>();
  discardPile=new ArrayList<ChanceCard>();
  chanceCards.add(new ChanceCardEasyMoney());
  chanceCards.add(new ChanceCardAuctionUnowned());
  Collections.shuffle(chanceCards);
}

Fixed version (ground truth):
public ChanceDeck(){
  chanceCards=new ArrayList<ChanceCard>();
  discardPile=new ArrayList<ChanceCard>();
  chanceCards.add(new ChanceCardEasyMoney());
  chanceCards.add(new ChanceCardAuctionUnowned());
  chanceCards.add(new ChanceCardInheritance());
  Collections.shuffle(chanceCards);
}
Program: 154275
Project: 154275
Buggy source:
public void resumeTurn(){
  if (!currentPlayer.rolledDoubles) {
    if (!isBuilding) {
      gamePane.disableButton(gamePane.getRollDiceButton());
      gamePane.enableButton(gamePane.getBuildButton());
      gamePane.enableButton(gamePane.getEndTurnButton());
    }
 else {
      gamePane.disableButton(gamePane.getRollDiceButton());
      gamePane.disableButton(gamePane.getBuildButton());
      gamePane.enableButton(gamePane.getEndTurnButton());
    }
  }
 else {
    if (isBuilding) {
      gamePane.enableButton(gamePane.getRollDiceButton());
      gamePane.disableButton(gamePane.getBuildButton());
      gamePane.disableButton(gamePane.getEndTurnButton());
    }
 else {
      gamePane.disableButton(gamePane.getRollDiceButton());
      gamePane.enableButton(gamePane.getBuildButton());
      gamePane.disableButton(gamePane.getEndTurnButton());
    }
  }
}

Fixed version (ground truth):
public void resumeTurn(){
  if (!currentPlayer.rolledDoubles) {
    if (!isBuilding) {
      gamePane.disableButton(gamePane.getRollDiceButton());
      gamePane.enableButton(gamePane.getBuildButton());
      gamePane.enableButton(gamePane.getEndTurnButton());
    }
 else {
      gamePane.disableButton(gamePane.getRollDiceButton());
      gamePane.disableButton(gamePane.getBuildButton());
      gamePane.enableButton(gamePane.getEndTurnButton());
    }
  }
 else {
    if (isBuilding) {
      gamePane.disableButton(gamePane.getRollDiceButton());
      gamePane.disableButton(gamePane.getBuildButton());
      gamePane.enableButton(gamePane.getEndTurnButton());
    }
 else {
      gamePane.enableButton(gamePane.getRollDiceButton());
      gamePane.enableButton(gamePane.getBuildButton());
      gamePane.disableButton(gamePane.getEndTurnButton());
    }
  }
}
Program: 154276
Project: 154276
Buggy source:
public void roll(){
  gamePane.enableButton(gamePane.getEndTurnButton());
  int[] dice=rollDice();
  System.out.println("String_Node_Str" + Integer.toString(dice[0]) + "String_Node_Str"+ Integer.toString(dice[1]));
  if (dice[0] == dice[1]) {
    System.out.println(currentPlayer.getName() + "String_Node_Str");
    System.out.println("String_Node_Str" + Integer.toString(currentPlayer.getNumDoubles()));
    currentPlayer.setDoubles(true);
    if (currentPlayer.isInJail) {
      gamePane.setMessagePanelText("String_Node_Str" + currentPlayer.getName() + "String_Node_Str");
      currentPlayer.setIsInJail(false);
      currentPlayer.setDoubles(false);
    }
    if (currentPlayer.getNumDoubles() > 2) {
      System.out.println("String_Node_Str" + currentPlayer.getIndex() + "String_Node_Str");
      currentPlayer.setIsInJail(true);
      gamePane.disableButton(gamePane.getBuildButton());
      gamePane.setMessagePanelText("String_Node_Str");
      JButton button=new JButton("String_Node_Str");
      button.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent event){
          endTurn();
        }
      }
);
    }
    if (!currentPlayer.isInJail) {
      checkSquare(dice[0] + dice[1]);
    }
  }
 else {
    if (currentPlayer.isInJail) {
      gamePane.clearMessageLayer();
      gamePane.setMessagePanelText("String_Node_Str");
      currentPlayer.setIsInJail(true);
    }
 else {
      currentPlayer.setDoubles(false);
      checkSquare(dice[0] + dice[1]);
    }
  }
  gamePane.update();
}

Fixed version (ground truth):
public void roll(){
  gamePane.enableButton(gamePane.getEndTurnButton());
  int[] dice=rollDice();
  System.out.println("String_Node_Str" + Integer.toString(dice[0]) + "String_Node_Str"+ Integer.toString(dice[1]));
  if (dice[0] == dice[1]) {
    System.out.println(currentPlayer.getName() + "String_Node_Str");
    System.out.println("String_Node_Str" + Integer.toString(currentPlayer.getNumDoubles()));
    currentPlayer.setDoubles(true);
    if (currentPlayer.isInJail) {
      gamePane.setMessagePanelText("String_Node_Str" + currentPlayer.getName() + "String_Node_Str");
      currentPlayer.setIsInJail(false);
      currentPlayer.setDoubles(false);
    }
    if (currentPlayer.getNumDoubles() > 2) {
      System.out.println("String_Node_Str" + currentPlayer.getIndex() + "String_Node_Str");
      currentPlayer.setIsInJail(true);
      gamePane.disableButton(gamePane.getBuildButton());
      gamePane.setMessagePanelText("String_Node_Str");
      JButton button=new JButton("String_Node_Str");
      button.addActionListener(new ActionListener(){
        public void actionPerformed(        ActionEvent event){
          endTurn();
        }
      }
);
    }
    if (!currentPlayer.isInJail) {
      checkSquare(dice[0] + dice[1]);
    }
  }
 else {
    if (currentPlayer.isInJail) {
      gamePane.clearMessageLayer();
      gamePane.setMessagePanelText("String_Node_Str");
      currentPlayer.setIsInJail(true);
    }
 else {
      currentPlayer.setDoubles(false);
      checkSquare(dice[0] + dice[1]);
    }
  }
  resumeTurn();
  gamePane.update();
}
Program: 154277
Project: 154277
Buggy source:
public void endTurn(){
  currentPlayer.rolledDoubles=false;
  currentPlayer.numDoubles=0;
  currentPlayer=getNextPlayer();
  gamePane.clearMessageLayer();
  gamePane.update();
  startTurn();
}

Fixed version (ground truth):
public void endTurn(){
  currentPlayer=getNextPlayer();
  gamePane.clearMessageLayer();
  gamePane.update();
  startTurn();
}
Program: 154278
Project: 154278
Buggy source:
public double distancia(Entidade a){
  int x, y;
  x=a.getX() - getX();
  y=a.getY() - getY();
  return Math.sqrt(x * x - y * y);
}

Fixed version (ground truth):
public double distancia(Entidade a){
  int x, y;
  x=a.getX() - getX();
  y=a.getY() - getY();
  return Math.sqrt(x * x + y * y);
}
Program: 154279
Project: 154279
Buggy source:
private void adicionaAgentes(){
  int i;
  for (i=0; i < 30; i++) {
    adicionaEntidade(new AgenteDummy(0,0,Constants.ENTIDADE_ENERGIA_INICIAL));
    adicionaEntidade(new AgenteInimigo(Constants.LARGURA_MAPA,0,Constants.ENTIDADE_ENERGIA_INICIAL));
  }
}

Fixed version (ground truth):
private void adicionaAgentes(){
  int i;
  int x=Constants.LARGURA_TELA / 2, y=Constants.ALTURA_TELA / 2;
  for (i=0; i < 15; i++) {
    adicionaEntidade(new AgenteDummy(x,y,Constants.ENTIDADE_ENERGIA_INICIAL));
    adicionaEntidade(new AgenteInimigo(x,y,Constants.ENTIDADE_ENERGIA_INICIAL));
  }
}
Program: 154280
Project: 154280
Buggy source:
private void processaTeclado(){
  if (teclado.isKeyDown(KeyEvent.VK_UP)) {
    intervaloUpdate-=Constants.INTERVALO_UPDATE_INCREMENTO;
  }
 else   if (teclado.isKeyDown(KeyEvent.VK_DOWN)) {
    intervaloUpdate+=Constants.INTERVALO_UPDATE_INCREMENTO;
  }
 else   if (teclado.isKeyDown(KeyEvent.VK_RIGHT) || teclado.isKeyDown(KeyEvent.VK_LEFT)) {
    intervaloUpdate=Constants.INTERVALO_UPDATE;
  }
  if (teclado.isKeyDown(KeyEvent.VK_Q)) {
    termina();
  }
}

Fixed version (ground truth):
private void processaTeclado(){
  if (teclado.isKeyDown(KeyEvent.VK_UP)) {
    intervaloUpdate-=Constants.INTERVALO_UPDATE_INCREMENTO;
  }
 else   if (teclado.isKeyDown(KeyEvent.VK_DOWN)) {
    intervaloUpdate+=Constants.INTERVALO_UPDATE_INCREMENTO;
  }
 else   if (teclado.isKeyDown(KeyEvent.VK_RIGHT) || teclado.isKeyDown(KeyEvent.VK_LEFT)) {
    intervaloUpdate=Constants.INTERVALO_UPDATE;
  }
  if (teclado.isKeyDown(KeyEvent.VK_Q) || teclado.isKeyDown(KeyEvent.VK_ESCAPE)) {
    termina();
  }
  if (teclado.isKeyDown(KeyEvent.VK_D)) {
    debug=true;
  }
 else {
    debug=false;
  }
}
Program: 154281
Project: 154281
Buggy source:
private void desenhaAgente(Graphics g,Agente a){
  int i=0;
  int frameAtual=getFrameCorrente("String_Node_Str",a);
  long tempoAgora=System.currentTimeMillis();
  desenhaAnimacao("String_Node_Str",imgEnergia,g,a,200,200);
  desenhaAnimacao("String_Node_Str",imgMensagens,g,a,160,160);
  desenhaAnimacao("String_Node_Str",imgMensagens,g,a,160,160);
switch (a.getDirecao()) {
case Agente.DIREITA:
    i=2;
  break;
case Agente.ESQUERDA:
i=1;
break;
case Agente.CIMA:
i=3;
break;
case Agente.BAIXO:
i=0;
break;
default :
}
frameAtual=getFrameCorrente("String_Node_Str",a);
if (tempoAgora >= getTimeProximoRender("String_Node_Str",a)) {
setTimeProximoRender("String_Node_Str",a,tempoAgora + INTERVALO_RENDER_SPRITES);
incrementaFrame("String_Node_Str",a,frameAtual);
}
desenhaSprite(g,a.getX(),a.getY(),i,frameAtual,getTipoSprite(a));
}

Fixed version (ground truth):
private void desenhaAgente(Graphics g,Agente a){
  int i=0;
  int frameAtual=getFrameCorrente("String_Node_Str",a);
  long tempoAgora=System.currentTimeMillis();
  desenhaAnimacao("String_Node_Str",imgEnergia,g,a,200,200);
  desenhaAnimacao("String_Node_Str",imgMensagens,g,a,160,160);
  desenhaAnimacao("String_Node_Str",imgMensagens,g,a,160,160);
switch (a.getDirecao()) {
case Agente.DIREITA:
    i=2;
  break;
case Agente.ESQUERDA:
i=1;
break;
case Agente.CIMA:
i=3;
break;
case Agente.BAIXO:
i=0;
break;
default :
}
frameAtual=getFrameCorrente("String_Node_Str",a);
if (tempoAgora >= getTimeProximoRender("String_Node_Str",a)) {
setTimeProximoRender("String_Node_Str",a,tempoAgora + INTERVALO_RENDER_SPRITES);
incrementaFrame("String_Node_Str",a,frameAtual);
}
desenhaSprite(g,a.getX(),a.getY(),i,frameAtual,getTipoSprite(a));
if (arena.isDebug()) {
g.setColor(Color.GREEN);
g.fillRect(a.getX() + getTamanho(a,LARGURA) / 2 - 3,a.getY() + getTamanho(a,ALTURA) / 2 - 3,6,6);
}
}
Program: 154282
Project: 154282
Buggy source:
public void agenteRecebeuEnergia(Agente a){
}

Fixed version (ground truth):
public void agenteRecebeuEnergia(Agente a){
  ativaAnimacao("String_Node_Str",a,500);
}
Program: 154283
Project: 154283
Buggy source:
private void desenhaPontoEnergia(Graphics g,PontoEnergia p){
  g.drawImage(imgPontosEnergia,p.getX(),p.getY(),p.getX() + 50,p.getY() + 60,55,0,90,60,null);
}

Fixed version (ground truth):
private void desenhaPontoEnergia(Graphics g,PontoEnergia p){
  g.drawImage(imgPontosEnergia,p.getX(),p.getY(),p.getX() + 50,p.getY() + 60,55,0,90,60,null);
  if (arena.isDebug()) {
    g.setColor(Color.RED);
    g.fillRect(p.getX() + getTamanho(p,LARGURA) / 2 - 3,p.getY() + getTamanho(p,ALTURA) / 2 - 3,6,6);
  }
}
Program: 154284
Project: 154284
Buggy source:
public double distancia(Entidade a){
  int x, y;
  x=a.getX() - getX();
  y=a.getY() - getY();
  return Math.sqrt(x * x + y * y);
}

Fixed version (ground truth):
public double distancia(Entidade a){
  int x, y;
  Desenhista d=getArena().getDesenhista();
  x=(a.getX() + d.getTamanho(a,Desenhista.LARGURA) / 2) - (getX() + d.getTamanho(this,Desenhista.LARGURA) / 2);
  y=(a.getY() + d.getTamanho(a,Desenhista.ALTURA) / 2) - (getY() + d.getTamanho(this,Desenhista.ALTURA) / 2);
  return Math.sqrt(x * x + y * y);
}
Program: 154285
Project: 154285
Buggy source:
public final void update(){
  if (isMorta()) {
    return;
  }
  protegeInformacoes(true);
  pensa();
  protegeInformacoes(false);
  if (!isParado()) {
    movePara(getDirecao());
    gastaEnergia(Constants.ENTIDADE_ENERGIA_GASTO_ANDAR);
  }
  gastaEnergia(Constants.ENTIDADE_ENERGIA_GASTO_VIVER);
  processaCombate();
}

Fixed version (ground truth):
public final void update(){
  if (isMorta()) {
    return;
  }
  protegeInformacoes(true);
  pensa();
  protegeInformacoes(false);
  if (fazerDivisao) {
    fazDivisao();
  }
  if (!isParado()) {
    movePara(getDirecao());
    gastaEnergia(Constants.ENTIDADE_ENERGIA_GASTO_ANDAR);
  }
  gastaEnergia(Constants.ENTIDADE_ENERGIA_GASTO_VIVER);
  processaCombate();
}
Program: 154286
Project: 154286
Buggy source:
public final boolean divide(){
  if (podeDividir()) {
    gastaEnergia(Constants.ENTIDADE_ENERGIA_GASTO_DIVIDIR);
    gastaEnergia(getEnergia() / 2);
    getArena().divideEntidade(this);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public final boolean divide(){
  if (podeDividir()) {
    fazerDivisao=true;
    return true;
  }
 else {
    fazerDivisao=false;
    return false;
  }
}
Program: 154287
Project: 154287
Buggy source:
public Agente(Integer x,Integer y,Integer energia){
  super(x,y,energia);
  setDirecao(geraDirecaoAleatoria());
  avisouMorte=false;
}

Fixed version (ground truth):
public Agente(Integer x,Integer y,Integer energia){
  super(x,y,energia);
  setDirecao(geraDirecaoAleatoria());
  avisouMorte=false;
  fazerDivisao=false;
}
Program: 154288
Project: 154288
Buggy source:
public void pensa(){
  if (!podeMoverPara(getDirecao())) {
    setDirecao(geraDirecaoAleatoria());
  }
  if (podeDividir()) {
  }
}

Fixed version (ground truth):
public void pensa(){
  if (!podeMoverPara(getDirecao())) {
    setDirecao(geraDirecaoAleatoria());
  }
  if (podeDividir() && getEnergia() >= 400) {
    divide();
  }
}
Program: 154289
Project: 154289
Buggy source:
public void divideEntidade(Entidade entidade){
  try {
    Class[] argsConstrutor=new Class[]{Integer.class,Integer.class,Integer.class};
    Class classe=entidade.getClass();
    Constructor construtor=classe.getConstructor(argsConstrutor);
    Entidade nova=(Entidade)construtor.newInstance(entidade.getX(),entidade.getY(),entidade.getEnergia());
    agendaNascimento(nova);
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
public void divideEntidade(Entidade entidade){
  try {
    Class[] argsConstrutor=new Class[]{Integer.class,Integer.class,Integer.class};
    Class classe=entidade.getClass();
    Constructor construtor=classe.getConstructor(argsConstrutor);
    Entidade nova=(Entidade)construtor.newInstance(entidade.getX(),entidade.getY(),entidade.getEnergia());
    agendaNascimento(nova);
    if (entidade instanceof Agente) {
      estatistico.contabilizaDivisao((Agente)entidade);
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
  }
}
Program: 154290
Project: 154290
Buggy source:
/** 
 * Envia uma mensagem para os agentes que estão próximos.
 * @param msg string que será enviada como mensagem para os agentes que estão próximos. Todos os agentes que receberem a mensagem terão o método recebeuMensagem() invocado. 
 */
public final void enviaMensagem(String msg){
  Agente d;
  for (  Entidade a : getArena().getEntidades()) {
    if ((a instanceof Agente) && (distancia(a) <= Constants.AGENTE_ALCANCE_MENSAGEM)) {
      d=(Agente)a;
      d.recebeuMensagem(msg,this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Envia uma mensagem para os agentes que estão próximos.
 * @param msg string que será enviada como mensagem para os agentes que estão próximos. Todos os agentes que receberem a mensagem terão o método recebeuMensagem() invocado. 
 */
public final void enviaMensagem(String msg){
  Agente d;
  for (  Entidade a : getArena().getEntidades()) {
    if ((a instanceof Agente) && (distancia(a) <= Constants.AGENTE_ALCANCE_MENSAGEM)) {
      d=(Agente)a;
      d.sinalizaRecebeuMensagem(msg,this);
    }
  }
}
Program: 154291
Project: 154291
Buggy source:
private void processaCombate(){
  Agente inimigo=getInimigoJuntoComigo();
  boolean morreu=false;
  if (inimigo != null) {
    morreu=dahPancada(inimigo);
    if (morreu) {
      ganhaEnergia(Constants.ENTIDADE_COMBATE_RECOMPENSA);
      ganhouCombate();
    }
  }
}

Fixed version (ground truth):
private void processaCombate(){
  Agente inimigo=getInimigoJuntoComigo();
  boolean morreu=false;
  if (inimigo != null) {
    morreu=dahPancada(inimigo);
    if (morreu) {
      ganhaEnergia(Constants.ENTIDADE_COMBATE_RECOMPENSA);
      sinalizaGanhouCombate();
    }
  }
}
Program: 154292
Project: 154292
Buggy source:
private boolean dahPancada(Agente inimigo){
  boolean morreu;
  morreu=inimigo.gastaEnergia(Constants.ENTIDADE_COMBATE_DANO);
  if (!morreu) {
    inimigo.tomouDano(this);
  }
  return morreu;
}

Fixed version (ground truth):
private boolean dahPancada(Agente inimigo){
  boolean morreu;
  morreu=inimigo.gastaEnergia(Constants.ENTIDADE_COMBATE_DANO);
  if (!morreu) {
    inimigo.sinalizaTomouDano(this);
  }
  return morreu;
}