nus-yam/ex-repair huggingface dataset:
Program: 95371
Project: 95371
Buggy source:
/** 
 * Extrapolate latitude/longitude given a heading and distance thanks to http://www.movable-type.co.uk/scripts/latlong.html
 * @param origin Point of origin
 * @param bearing bearing to navigate
 * @param distance distance to be added
 * @return New point with the added distance
 */
static LatLng newCoordFromBearingAndDistance(LatLng origin,double bearing,double distance){
  double lat=origin.latitude;
  double lon=origin.longitude;
  double lat1=Math.toRadians(lat);
  double lon1=Math.toRadians(lon);
  double brng=Math.toRadians(bearing);
  double dr=distance / RADIUS_OF_EARTH;
  double lat2=Math.asin(Math.sin(lat1) * Math.cos(dr) + Math.cos(lat1) * Math.sin(dr) * Math.cos(brng));
  double lon2=lon1 + Math.atan2(Math.sin(brng) * Math.sin(dr) * Math.cos(lat1),Math.cos(dr) - Math.sin(lat1) * Math.sin(lat2));
  return (new LatLng(Math.toDegrees(lat2),Math.toDegrees(lon2)));
}

Fixed version (ground truth):
/** 
 * Extrapolate latitude/longitude given a heading and distance thanks to http://www.movable-type.co.uk/scripts/latlong.html
 * @param origin Point of origin
 * @param bearing bearing to navigate
 * @param distance distance to be added
 * @return New point with the added distance
 */
public static LatLng newCoordFromBearingAndDistance(LatLng origin,double bearing,double distance){
  double lat=origin.latitude;
  double lon=origin.longitude;
  double lat1=Math.toRadians(lat);
  double lon1=Math.toRadians(lon);
  double brng=Math.toRadians(bearing);
  double dr=distance / RADIUS_OF_EARTH;
  double lat2=Math.asin(Math.sin(lat1) * Math.cos(dr) + Math.cos(lat1) * Math.sin(dr) * Math.cos(brng));
  double lon2=lon1 + Math.atan2(Math.sin(brng) * Math.sin(dr) * Math.cos(lat1),Math.cos(dr) - Math.sin(lat1) * Math.sin(lat2));
  return (new LatLng(Math.toDegrees(lat2),Math.toDegrees(lon2)));
}
Program: 95372
Project: 95372
Buggy source:
/** 
 * Returns the distance between two points
 * @return distance between the points in degrees
 */
static Double getAproximatedDistance(LatLng p1,LatLng p2){
  return (Math.hypot((p1.latitude - p2.latitude),(p1.longitude - p2.longitude)));
}

Fixed version (ground truth):
/** 
 * Returns the distance between two points
 * @return distance between the points in degrees
 */
public static Double getAproximatedDistance(LatLng p1,LatLng p2){
  return (Math.hypot((p1.latitude - p2.latitude),(p1.longitude - p2.longitude)));
}
Program: 95373
Project: 95373
Buggy source:
/** 
 * Adds an offset to a point (in degrees)
 * @param point the point to be modified
 * @param offset offset to be added
 * @return point with offset
 */
static LatLng addLatLng(LatLng point,LatLng offset){
  return (new LatLng(point.latitude + offset.latitude,point.longitude + offset.longitude));
}

Fixed version (ground truth):
/** 
 * Adds an offset to a point (in degrees)
 * @param point the point to be modified
 * @param offset offset to be added
 * @return point with offset
 */
public static LatLng addLatLng(LatLng point,LatLng offset){
  return (new LatLng(point.latitude + offset.latitude,point.longitude + offset.longitude));
}
Program: 95374
Project: 95374
Buggy source:
/** 
 * Finds the line that has the start or tip closest to a point.
 * @param point Point to the distance will be minimized
 * @param list A list of lines to search
 * @return The closest Line
 */
static LineLatLng findClosestLine(LatLng point,List<LineLatLng> list){
  LineLatLng answer=list.get(0);
  double shortest=Double.MAX_VALUE;
  for (  LineLatLng line : list) {
    double ans1=getAproximatedDistance(point,line.p1);
    double ans2=getAproximatedDistance(point,line.p2);
    LatLng shorterpnt=ans1 < ans2 ? line.p1 : line.p2;
    if (shortest > getAproximatedDistance(point,shorterpnt)) {
      answer=line;
      shortest=getAproximatedDistance(point,shorterpnt);
    }
  }
  return answer;
}

Fixed version (ground truth):
/** 
 * Finds the line that has the start or tip closest to a point.
 * @param point Point to the distance will be minimized
 * @param list A list of lines to search
 * @return The closest Line
 */
public static LineLatLng findClosestLine(LatLng point,List<LineLatLng> list){
  LineLatLng answer=list.get(0);
  double shortest=Double.MAX_VALUE;
  for (  LineLatLng line : list) {
    double ans1=getAproximatedDistance(point,line.p1);
    double ans2=getAproximatedDistance(point,line.p2);
    LatLng shorterpnt=ans1 < ans2 ? line.p1 : line.p2;
    if (shortest > getAproximatedDistance(point,shorterpnt)) {
      answer=line;
      shortest=getAproximatedDistance(point,shorterpnt);
    }
  }
  return answer;
}
Program: 95375
Project: 95375
Buggy source:
static Double metersTolat(double meters){
  double radius_of_earth=6378100.0;
  return Math.toDegrees(meters / radius_of_earth);
}

Fixed version (ground truth):
public static Double metersTolat(double meters){
  double radius_of_earth=6378100.0;
  return Math.toDegrees(meters / radius_of_earth);
}
Program: 95376
Project: 95376
Buggy source:
static Double latToMeters(double lat){
  double radius_of_earth=6378100.0;
  return Math.toRadians(lat) * radius_of_earth;
}

Fixed version (ground truth):
public static Double latToMeters(double lat){
  double radius_of_earth=6378100.0;
  return Math.toRadians(lat) * radius_of_earth;
}
Program: 95377
Project: 95377
Buggy source:
/** 
 * Finds the intersection of two lines http://stackoverflow.com/questions/ 1119451/how-to-tell-if-a-line-intersects -a-polygon-in-c
 * @param start1 starting point of the first line
 * @param end1 ending point of the first line
 * @param start2 starting point of the second line
 * @param end2 ending point of the second line
 * @return point of intersection, or null if there is no intersection
 */
static LatLng FindLineIntersection(LatLng start1,LatLng end1,LatLng start2,LatLng end2){
  double denom=((end1.longitude - start1.longitude) * (end2.latitude - start2.latitude)) - ((end1.latitude - start1.latitude) * (end2.longitude - start2.longitude));
  if (denom == 0)   return null;
  double numer=((start1.latitude - start2.latitude) * (end2.longitude - start2.longitude)) - ((start1.longitude - start2.longitude) * (end2.latitude - start2.latitude));
  double r=numer / denom;
  double numer2=((start1.latitude - start2.latitude) * (end1.longitude - start1.longitude)) - ((start1.longitude - start2.longitude) * (end1.latitude - start1.latitude));
  double s=numer2 / denom;
  if ((r < 0 || r > 1) || (s < 0 || s > 1))   return null;
  double longitude=start1.longitude + (r * (end1.longitude - start1.longitude));
  double latitude=start1.latitude + (r * (end1.latitude - start1.latitude));
  return (new LatLng(latitude,longitude));
}

Fixed version (ground truth):
/** 
 * Finds the intersection of two lines http://stackoverflow.com/questions/ 1119451/how-to-tell-if-a-line-intersects -a-polygon-in-c
 * @param start1 starting point of the first line
 * @param end1 ending point of the first line
 * @param start2 starting point of the second line
 * @param end2 ending point of the second line
 * @return point of intersection, or null if there is no intersection
 */
public static LatLng FindLineIntersection(LatLng start1,LatLng end1,LatLng start2,LatLng end2){
  double denom=((end1.longitude - start1.longitude) * (end2.latitude - start2.latitude)) - ((end1.latitude - start1.latitude) * (end2.longitude - start2.longitude));
  if (denom == 0)   return null;
  double numer=((start1.latitude - start2.latitude) * (end2.longitude - start2.longitude)) - ((start1.longitude - start2.longitude) * (end2.latitude - start2.latitude));
  double r=numer / denom;
  double numer2=((start1.latitude - start2.latitude) * (end1.longitude - start1.longitude)) - ((start1.longitude - start2.longitude) * (end1.latitude - start1.latitude));
  double s=numer2 / denom;
  if ((r < 0 || r > 1) || (s < 0 || s > 1))   return null;
  double longitude=start1.longitude + (r * (end1.longitude - start1.longitude));
  double latitude=start1.latitude + (r * (end1.latitude - start1.latitude));
  return (new LatLng(latitude,longitude));
}
Program: 95378
Project: 95378
Buggy source:
public void addWaypoints(List<waypoint> points){
  waypoints.addAll(points);
}

Fixed version (ground truth):
public void addWaypoints(List<waypoint> points){
  for (  waypoint wp : points) {
    addWaypoint(wp);
  }
}
Program: 95379
Project: 95379
Buggy source:
public static MarkerOptions build(PolygonPoint wp){
  return new MarkerOptions().position(wp.coord).draggable(true).title("String_Node_Str" + Integer.toString(0)).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
}

Fixed version (ground truth):
public static MarkerOptions build(PolygonPoint wp){
  return new MarkerOptions().position(wp.coord).draggable(true).title("String_Node_Str").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
}
Program: 95380
Project: 95380
Buggy source:
public static void update(Marker marker,PolygonPoint wp){
  marker.setPosition(wp.coord);
  marker.setTitle("String_Node_Str" + Integer.toString(0));
  marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
}

Fixed version (ground truth):
public static void update(Marker marker,PolygonPoint wp){
  marker.setPosition(wp.coord);
  marker.setTitle("String_Node_Str");
  marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
}
Program: 95381
Project: 95381
Buggy source:
private void setupOnlineMapOverlay(){
  GoogleMap mMap=getMap();
  mMap.setMapType(getMapType());
}

Fixed version (ground truth):
private void setupOnlineMapOverlay(){
  mMap.setMapType(getMapType());
}
Program: 95382
Project: 95382
Buggy source:
private void setupOfflineMapOverlay(){
  GoogleMap mMap=getMap();
  mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
  TileOverlay tileOverlay=mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new LocalMapTileProvider()));
  tileOverlay.setZIndex(-1);
  tileOverlay.clearTileCache();
}

Fixed version (ground truth):
private void setupOfflineMapOverlay(){
  mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
  TileOverlay tileOverlay=mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new LocalMapTileProvider()));
  tileOverlay.setZIndex(-1);
  tileOverlay.clearTileCache();
}
Program: 95383
Project: 95383
Buggy source:
public double getMapRotation(){
  GoogleMap map=getMap();
  if (map != null) {
    return map.getCameraPosition().bearing;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public double getMapRotation(){
  if (isMapLayoutFinished()) {
    return mMap.getCameraPosition().bearing;
  }
 else {
    return 0;
  }
}
Program: 95384
Project: 95384
Buggy source:
private void setupMap(){
  setupMapUI();
  setupMapOverlay();
}

Fixed version (ground truth):
private void setupMap(){
  mMap=getMap();
  if (isMapLayoutFinished()) {
    setupMapUI();
    setupMapOverlay();
  }
}
Program: 95385
Project: 95385
Buggy source:
private void setupMapUI(){
  GoogleMap mMap=getMap();
  if (mMap != null) {
    mMap.setMyLocationEnabled(true);
    UiSettings mUiSettings=mMap.getUiSettings();
    mUiSettings.setMyLocationButtonEnabled(true);
    mUiSettings.setCompassEnabled(true);
    mUiSettings.setTiltGesturesEnabled(false);
  }
}

Fixed version (ground truth):
private void setupMapUI(){
  mMap.setMyLocationEnabled(true);
  UiSettings mUiSettings=mMap.getUiSettings();
  mUiSettings.setMyLocationButtonEnabled(true);
  mUiSettings.setCompassEnabled(true);
  mUiSettings.setTiltGesturesEnabled(false);
}
Program: 95386
Project: 95386
Buggy source:
private void setupOnlineMapOverlay(){
  GoogleMap mMap=getMap();
  mMap.setMapType(getMapType());
}

Fixed version (ground truth):
private void setupOnlineMapOverlay(){
  mMap.setMapType(getMapType());
}
Program: 95387
Project: 95387
Buggy source:
private void setupOfflineMapOverlay(){
  GoogleMap mMap=getMap();
  mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
  TileOverlay tileOverlay=mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new LocalMapTileProvider()));
  tileOverlay.setZIndex(-1);
  tileOverlay.clearTileCache();
}

Fixed version (ground truth):
private void setupOfflineMapOverlay(){
  mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
  TileOverlay tileOverlay=mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new LocalMapTileProvider()));
  tileOverlay.setZIndex(-1);
  tileOverlay.clearTileCache();
}
Program: 95388
Project: 95388
Buggy source:
public double getMapRotation(){
  GoogleMap map=getMap();
  if (map != null) {
    return map.getCameraPosition().bearing;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public double getMapRotation(){
  if (isMapLayoutFinished()) {
    return mMap.getCameraPosition().bearing;
  }
 else {
    return 0;
  }
}
Program: 95389
Project: 95389
Buggy source:
private void setupMap(){
  setupMapUI();
  setupMapOverlay();
}

Fixed version (ground truth):
private void setupMap(){
  mMap=getMap();
  if (isMapLayoutFinished()) {
    setupMapUI();
    setupMapOverlay();
  }
}
Program: 95390
Project: 95390
Buggy source:
private void setupMapUI(){
  GoogleMap mMap=getMap();
  if (mMap != null) {
    mMap.setMyLocationEnabled(true);
    UiSettings mUiSettings=mMap.getUiSettings();
    mUiSettings.setMyLocationButtonEnabled(true);
    mUiSettings.setCompassEnabled(true);
    mUiSettings.setTiltGesturesEnabled(false);
  }
}

Fixed version (ground truth):
private void setupMapUI(){
  mMap.setMyLocationEnabled(true);
  UiSettings mUiSettings=mMap.getUiSettings();
  mUiSettings.setMyLocationButtonEnabled(true);
  mUiSettings.setCompassEnabled(true);
  mUiSettings.setTiltGesturesEnabled(false);
}
Program: 95391
Project: 95391
Buggy source:
@Override public void onGestureEnded(GestureOverlayView arg0,MotionEvent arg1){
  overlay.setEnabled(false);
  List<Point> path=new ArrayList<Point>();
  float[] points=overlay.getGesture().getStrokes().get(0).points;
  for (int i=0; i < points.length; i+=2) {
    path.add(new Point((int)points[i],(int)points[i + 1]));
  }
  path=Simplify.simplify(path,10);
  listner.onPathFinished(path);
}

Fixed version (ground truth):
@Override public void onGestureEnded(GestureOverlayView arg0,MotionEvent arg1){
  overlay.setEnabled(false);
  List<Point> path=decodeGesture();
  if (path.size() > 1) {
    path=Simplify.simplify(path,TOLERANCE);
  }
  listner.onPathFinished(path);
}
Program: 95392
Project: 95392
Buggy source:
@Override public void onGestureEnded(GestureOverlayView arg0,MotionEvent arg1){
  Log.d("String_Node_Str","String_Node_Str");
  overlay.setEnabled(false);
  List<Point> path=new ArrayList<Point>();
  float[] points=overlay.getGesture().getStrokes().get(0).points;
  for (int i=0; i < points.length; i+=2) {
    path.add(new Point((int)points[i],(int)points[i + 1]));
  }
  path=Simplify.simplify(path,50.0);
  listner.onPathFinished(path);
}

Fixed version (ground truth):
@Override public void onGestureEnded(GestureOverlayView arg0,MotionEvent arg1){
  overlay.setEnabled(false);
  List<Point> path=new ArrayList<Point>();
  float[] points=overlay.getGesture().getStrokes().get(0).points;
  for (int i=0; i < points.length; i+=2) {
    path.add(new Point((int)points[i],(int)points[i + 1]));
  }
  path=Simplify.simplify(path,10);
  listner.onPathFinished(path);
}
Program: 95393
Project: 95393
Buggy source:
/** 
 * Provides the distance from a point P to the line segment that passes through A-B. If the point is not on the side of the line, returns the distance to the closest point
 * @param L1 First point of the line
 * @param L2 Second point of the line
 * @param P Point to measure the distance
 */
public static double pointToLineDistance(Point L1,Point L2,Point P){
  double A=P.x - L1.y;
  double B=P.y - L1.y;
  double C=L2.x - L1.x;
  double D=L2.y - L1.y;
  double dot=A * C + B * D;
  double len_sq=C * C + D * D;
  double param=dot / len_sq;
  double xx, yy;
  if (param < 0) {
    xx=L1.x;
    yy=L1.y;
  }
 else   if (param > 1) {
    xx=L2.x;
    yy=L2.y;
  }
 else {
    xx=L1.x + param * C;
    yy=L1.y + param * D;
  }
  return Math.hypot(xx - P.x,yy - P.y);
}

Fixed version (ground truth):
/** 
 * Perpendicular Distance of point to line
 * @param L1 First point of the line
 * @param L2 Second point of the line
 * @param P Point to measure the distance
 * @return The square distance
 */
public static double pointToLineDistance(Point L1,Point L2,Point P){
  double x0, y0, x1, y1, x2, y2, dx, dy, t;
  x1=L1.x;
  y1=L1.y;
  x2=L2.x;
  y2=L2.y;
  x0=P.x;
  y0=P.y;
  dx=x2 - x1;
  dy=y2 - y1;
  if (dx != 0.0d || dy != 0.0d) {
    t=((x0 - x1) * dx + (y0 - y1) * dy) / (dx * dx + dy * dy);
    if (t > 1.0d) {
      x1=x2;
      y1=y2;
    }
 else     if (t > 0.0d) {
      x1+=dx * t;
      y1+=dy * t;
    }
  }
  dx=x0 - x1;
  dy=y0 - y1;
  return dx * dx + dy * dy;
}
Program: 95394
Project: 95394
Buggy source:
public static List<Point> simplify(List<Point> list,double tolerance){
  int index=0;
  double dmax=0;
  int lastIndex=list.size() - 1;
  for (int i=1; i < list.size() - 1; i++) {
    double d=pointToLineDistance(list.get(0),list.get(lastIndex),list.get(i));
    if (d > dmax) {
      index=i;
      dmax=d;
    }
  }
  List<Point> ResultList=new ArrayList<Point>();
  if (dmax > tolerance) {
    List<Point> recResults1=simplify(list.subList(0,index),tolerance);
    List<Point> recResults2=simplify(list.subList(index,lastIndex),tolerance);
    recResults1.remove(recResults1.size() - 1);
    ResultList.addAll(recResults1);
    ResultList.addAll(recResults2);
  }
 else {
    ResultList.add(list.get(0));
    ResultList.add(list.get(lastIndex));
  }
  return ResultList;
}

Fixed version (ground truth):
public static List<Point> simplify(List<Point> list,double tolerance){
  int index=0;
  double dmax=0;
  double squareTolerance=tolerance * tolerance;
  int lastIndex=list.size() - 1;
  for (int i=1; i < list.size() - 1; i++) {
    double d=pointToLineDistance(list.get(0),list.get(lastIndex),list.get(i));
    if (d > dmax) {
      index=i;
      dmax=d;
    }
  }
  List<Point> ResultList=new ArrayList<Point>();
  if (dmax > squareTolerance) {
    List<Point> recResults1=simplify(list.subList(0,index + 1),tolerance);
    List<Point> recResults2=simplify(list.subList(index,lastIndex + 1),tolerance);
    recResults1.remove(recResults1.size() - 1);
    ResultList.addAll(recResults1);
    ResultList.addAll(recResults2);
  }
 else {
    ResultList.add(list.get(0));
    ResultList.add(list.get(lastIndex));
  }
  return ResultList;
}
Program: 95395
Project: 95395
Buggy source:
private void updateCameraSpinner(Context context){
  String[] list=FileList.getCameraInfoFileList();
  if (list.length > 0) {
    avaliableCameras=new ArrayAdapter<CharSequence>(context,android.R.layout.simple_spinner_dropdown_item);
    avaliableCameras.addAll();
    cameraSpinner.setAdapter(avaliableCameras);
    cameraSpinner.setSelection(0);
  }
 else {
    Toast.makeText(context,context.getString(R.string.no_files),Toast.LENGTH_LONG).show();
  }
}

Fixed version (ground truth):
private void updateCameraSpinner(Context context){
  String[] list=FileList.getCameraInfoFileList();
  if (list.length > 0) {
    avaliableCameras=new ArrayAdapter<CharSequence>(context,android.R.layout.simple_spinner_dropdown_item);
    avaliableCameras.addAll(list);
    cameraSpinner.setAdapter(avaliableCameras);
    cameraSpinner.setSelection(0);
  }
 else {
    Toast.makeText(context,context.getString(R.string.no_files),Toast.LENGTH_LONG).show();
  }
}
Program: 95396
Project: 95396
Buggy source:
private void processReceivedParam(msg_param_value m_value){
  Parameter param=new Parameter(m_value);
  parameters.add(param);
  parameterListner.onParameterReceived(param);
  if (m_value.param_index == m_value.param_count - 1) {
    Toast.makeText(myDrone.context,"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}

Fixed version (ground truth):
private void processReceivedParam(msg_param_value m_value){
  Parameter param=new Parameter(m_value);
  parameters.add(param);
  if (parameterListner != null) {
    parameterListner.onParameterReceived(param);
  }
  if (m_value.param_index == m_value.param_count - 1) {
    Toast.makeText(myDrone.context,"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}
Program: 95397
Project: 95397
Buggy source:
private void processReceivedParam(msg_param_value m_value){
  Parameter param=new Parameter(m_value);
  parameters.add(param);
  parameterListner.onParameterReceived(param);
  if (m_value.param_index == m_value.param_count - 1) {
    Toast.makeText(myDrone.context,"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}

Fixed version (ground truth):
private void processReceivedParam(msg_param_value m_value){
  Parameter param=new Parameter(m_value);
  parameters.add(param);
  if (parameterListner != null) {
    parameterListner.onParameterReceived(param);
  }
  if (m_value.param_index == m_value.param_count - 1) {
    Toast.makeText(myDrone.context,"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}
Program: 95398
Project: 95398
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  int pointerIndex;
  int pointerId;
  final int action=ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
    return processMove(ev);
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
  if (isPointerValid()) {
    mVelocityTracker.recycle();
    return processRelease();
  }
break;
case MotionEvent.ACTION_POINTER_UP:
pointerIndex=(action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
pointerId=ev.getPointerId(pointerIndex);
if (pointerId == this.pointerId) {
return processRelease();
}
break;
case MotionEvent.ACTION_DOWN:
if (!isPointerValid()) {
this.pointerId=ev.getPointerId(0);
if (mVelocityTracker == null) {
mVelocityTracker=VelocityTracker.obtain();
}
 else {
mVelocityTracker.clear();
}
mVelocityTracker.addMovement(ev);
processFirstTouch(ev);
return true;
}
break;
case MotionEvent.ACTION_POINTER_DOWN:
pointerIndex=(action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
pointerId=ev.getPointerId(pointerIndex);
if (pointerId == INVALID_POINTER_ID) {
this.pointerId=pointerId;
processFirstTouch(ev);
return true;
}
break;
}
return false;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  int pointerIndex;
  int pointerId;
  final int action=ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
    return processMove(ev);
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
  if (isPointerValid()) {
    return processRelease();
  }
break;
case MotionEvent.ACTION_POINTER_UP:
pointerIndex=(action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
pointerId=ev.getPointerId(pointerIndex);
if (pointerId == this.pointerId) {
return processRelease();
}
break;
case MotionEvent.ACTION_DOWN:
if (!isPointerValid()) {
this.pointerId=ev.getPointerId(0);
if (mVelocityTracker == null) {
mVelocityTracker=VelocityTracker.obtain();
}
 else {
mVelocityTracker.clear();
}
mVelocityTracker.addMovement(ev);
processFirstTouch(ev);
return true;
}
break;
case MotionEvent.ACTION_POINTER_DOWN:
pointerIndex=(action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
pointerId=ev.getPointerId(pointerIndex);
if (pointerId == INVALID_POINTER_ID) {
this.pointerId=pointerId;
processFirstTouch(ev);
return true;
}
break;
}
return false;
}
Program: 95399
Project: 95399
Buggy source:
private boolean processRelease(){
  this.pointerId=INVALID_POINTER_ID;
  handleVisible=false;
  invalidate();
  if (moveListener != null) {
    releaseX=xAxisAutoReturnToCenter ? 0 : userX;
    releaseY=yAxisAutoReturnToCenter ? 0 : userY;
    moveListener.OnMoved(releaseX,releaseY);
  }
  return true;
}

Fixed version (ground truth):
private boolean processRelease(){
  this.pointerId=INVALID_POINTER_ID;
  mVelocityTracker.recycle();
  handleVisible=false;
  invalidate();
  if (moveListener != null) {
    releaseX=xAxisAutoReturnToCenter ? 0 : userX;
    releaseY=yAxisAutoReturnToCenter ? 0 : userY;
    moveListener.OnMoved(releaseX,releaseY);
  }
  return true;
}
Program: 95400
Project: 95400
Buggy source:
public void updateDroneMarkers(){
  buildBitmaps();
  addMarkerToMap();
}

Fixed version (ground truth):
public void updateDroneMarkers(){
  if (droneMarker != null) {
    droneMarker.remove();
  }
  buildBitmaps();
  addMarkerToMap();
}
Program: 95401
Project: 95401
Buggy source:
public void openPolygonGenerateDialog(){
  double defaultHatchAngle=(planningMapFragment.getMapRotation() + 90) % 180;
  PolygonDialog polygonDialog=new PolygonDialog(){
    @Override public void onPolygonGenerated(    List<waypoint> list){
      drone.mission.addWaypoints(list);
      update();
    }
  }
;
  polygonDialog.generatePolygon(defaultHatchAngle,50.0,polygon,drone.mission.getLastWaypoint().getCoord(),drone.mission.getDefaultAlt(),this);
}

Fixed version (ground truth):
public void openPolygonGenerateDialog(){
  double defaultHatchAngle=(planningMapFragment.getMapRotation() + 90) % 180;
  GridDialog polygonDialog=new GridDialog(){
    @Override public void onPolygonGenerated(    List<waypoint> list){
      drone.mission.addWaypoints(list);
      update();
    }
  }
;
  polygonDialog.generatePolygon(defaultHatchAngle,50.0,polygon,drone.mission.getLastWaypoint().getCoord(),drone.mission.getDefaultAlt(),this);
}
Program: 95402
Project: 95402
Buggy source:
public Home(Double Lat,Double Lng,Double h){
  super(Lat,Lng,h);
}

Fixed version (ground truth):
public Home(waypoint waypoint){
  super(waypoint.missionItem);
  setCurrent((byte)1);
}
Program: 95403
Project: 95403
Buggy source:
public void onWaypointsReceived(List<waypoint> waypoints){
  if (waypoints != null) {
    Toast.makeText(myDrone.context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    myDrone.tts.speak("String_Node_Str");
    setHome(waypoints.get(0));
    waypoints.remove(0);
    clearWaypoints();
    addWaypoints(waypoints);
    notifyMissionUpdate();
  }
}

Fixed version (ground truth):
public void onWaypointsReceived(List<waypoint> waypoints){
  if (waypoints != null) {
    Toast.makeText(myDrone.context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    myDrone.tts.speak("String_Node_Str");
    setHome(new Home(waypoints.get(0)));
    waypoints.remove(0);
    clearWaypoints();
    addWaypoints(waypoints);
    notifyMissionUpdate();
  }
}
Program: 95404
Project: 95404
Buggy source:
public waypoint getHome(){
  return home;
}

Fixed version (ground truth):
public Home getHome(){
  return home;
}
Program: 95405
Project: 95405
Buggy source:
private void parseHomeLine(BufferedReader reader) throws IOException {
  String[] RowData=reader.readLine().split("String_Node_Str");
  home=new waypoint(Double.valueOf(RowData[8]),Double.valueOf(RowData[9]),Double.valueOf(RowData[10]));
  home.setNumber(Integer.valueOf(RowData[0]));
  home.setFrame(Integer.valueOf(RowData[2]));
  home.setCmd(ApmCommands.getCmd(Integer.valueOf(RowData[3])));
  home.setParameters(Float.valueOf(RowData[4]),Float.valueOf(RowData[5]),Float.valueOf(RowData[6]),Float.valueOf(RowData[7]));
  home.setAutoContinue(Integer.valueOf(RowData[11]));
}

Fixed version (ground truth):
private void parseHomeLine(BufferedReader reader) throws IOException {
  String[] RowData=reader.readLine().split("String_Node_Str");
  home=new Home(Double.valueOf(RowData[8]),Double.valueOf(RowData[9]),Double.valueOf(RowData[10]));
  home.setNumber(Integer.valueOf(RowData[0]));
  home.setFrame(Integer.valueOf(RowData[2]));
  home.setCmd(ApmCommands.getCmd(Integer.valueOf(RowData[3])));
  home.setParameters(Float.valueOf(RowData[4]),Float.valueOf(RowData[5]),Float.valueOf(RowData[6]),Float.valueOf(RowData[7]));
  home.setAutoContinue(Integer.valueOf(RowData[11]));
}
Program: 95406
Project: 95406
Buggy source:
@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
switch (item.getItemId()) {
case R.id.menu_settings:
    startActivity(new Intent(this,SettingsActivity.class));
  return true;
case R.id.menu_connect:
toggleConnectionState();
return true;
case R.id.menu_load_from_apm:
drone.waypointMananger.getWaypoints();
return true;
case R.id.menu_default_alt:
changeDefaultAlt();
return true;
case R.id.menu_preflight_calibration:
drone.calibrationSetup.startCalibration(this);
return true;
case R.id.menu_record_me:
app.recordMe.toogleRecordMeState();
case R.id.menu_follow_me:
app.followMe.toogleFollowMeState();
default :
return super.onMenuItemSelected(featureId,item);
}
}

Fixed version (ground truth):
@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
switch (item.getItemId()) {
case R.id.menu_settings:
    startActivity(new Intent(this,SettingsActivity.class));
  return true;
case R.id.menu_connect:
toggleConnectionState();
return true;
case R.id.menu_load_from_apm:
drone.waypointMananger.getWaypoints();
return true;
case R.id.menu_default_alt:
changeDefaultAlt();
return true;
case R.id.menu_preflight_calibration:
drone.calibrationSetup.startCalibration(this);
return true;
case R.id.menu_record_me:
app.recordMe.toogleRecordMeState();
return true;
case R.id.menu_follow_me:
app.followMe.toogleFollowMeState();
return true;
default :
return super.onMenuItemSelected(featureId,item);
}
}
Program: 95407
Project: 95407
Buggy source:
public Home(Double Lat,Double Lng,Double h){
  super(Lat,Lng,h);
}

Fixed version (ground truth):
public Home(waypoint waypoint){
  super(waypoint.missionItem);
  setCurrent((byte)1);
}
Program: 95408
Project: 95408
Buggy source:
public void onWaypointsReceived(List<waypoint> waypoints){
  if (waypoints != null) {
    Toast.makeText(myDrone.context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    myDrone.tts.speak("String_Node_Str");
    setHome(waypoints.get(0));
    waypoints.remove(0);
    clearWaypoints();
    addWaypoints(waypoints);
    notifyMissionUpdate();
  }
}

Fixed version (ground truth):
public void onWaypointsReceived(List<waypoint> waypoints){
  if (waypoints != null) {
    Toast.makeText(myDrone.context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    myDrone.tts.speak("String_Node_Str");
    setHome(new Home(waypoints.get(0)));
    waypoints.remove(0);
    clearWaypoints();
    addWaypoints(waypoints);
    notifyMissionUpdate();
  }
}
Program: 95409
Project: 95409
Buggy source:
public waypoint getHome(){
  return home;
}

Fixed version (ground truth):
public Home getHome(){
  return home;
}
Program: 95410
Project: 95410
Buggy source:
private void parseHomeLine(BufferedReader reader) throws IOException {
  String[] RowData=reader.readLine().split("String_Node_Str");
  home=new waypoint(Double.valueOf(RowData[8]),Double.valueOf(RowData[9]),Double.valueOf(RowData[10]));
  home.setNumber(Integer.valueOf(RowData[0]));
  home.setFrame(Integer.valueOf(RowData[2]));
  home.setCmd(ApmCommands.getCmd(Integer.valueOf(RowData[3])));
  home.setParameters(Float.valueOf(RowData[4]),Float.valueOf(RowData[5]),Float.valueOf(RowData[6]),Float.valueOf(RowData[7]));
  home.setAutoContinue(Integer.valueOf(RowData[11]));
}

Fixed version (ground truth):
private void parseHomeLine(BufferedReader reader) throws IOException {
  String[] RowData=reader.readLine().split("String_Node_Str");
  home=new Home(Double.valueOf(RowData[8]),Double.valueOf(RowData[9]),Double.valueOf(RowData[10]));
  home.setNumber(Integer.valueOf(RowData[0]));
  home.setFrame(Integer.valueOf(RowData[2]));
  home.setCmd(ApmCommands.getCmd(Integer.valueOf(RowData[3])));
  home.setParameters(Float.valueOf(RowData[4]),Float.valueOf(RowData[5]),Float.valueOf(RowData[6]),Float.valueOf(RowData[7]));
  home.setAutoContinue(Integer.valueOf(RowData[11]));
}
Program: 95411
Project: 95411
Buggy source:
public static void sendWaypoint(MAVLinkClient MavClient,int index,waypoint waypoint){
  waypoint.setCurrent((byte)((index == 0) ? 1 : 0));
  MavClient.sendMavPacket(waypoint.pack());
}

Fixed version (ground truth):
public static void sendWaypoint(MAVLinkClient MavClient,int index,waypoint waypoint){
  waypoint.setCurrent((byte)((index == 0) ? 1 : 0));
  waypoint.setTarget(1,1);
  MavClient.sendMavPacket(waypoint.pack());
}
Program: 95412
Project: 95412
Buggy source:
private void updatePosition(double yaw,LatLng coord){
  double correctHeading=(yaw - flightMapFragment.getMapRotation() + 360) % 360;
  Log.d("String_Node_Str","String_Node_Str");
  try {
    droneMarker.setVisible(true);
    droneMarker.setPosition(coord);
    droneMarker.setIcon(bitmaps.getIcon(correctHeading));
    animateCamera(coord);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
private void updatePosition(double yaw,LatLng coord){
  double correctHeading=(yaw - flightMapFragment.getMapRotation() + 360) % 360;
  try {
    droneMarker.setVisible(true);
    droneMarker.setPosition(coord);
    droneMarker.setIcon(bitmaps.getIcon(correctHeading));
    animateCamera(coord);
  }
 catch (  Exception e) {
  }
}
Program: 95413
Project: 95413
Buggy source:
@Override public void onAltitudeChanged(double newAltitude){
  super.onAltitudeChanged(newAltitude);
  if (guidedPoint != null) {
    Toast.makeText(this,"String_Node_Str" + (int)newAltitude + "String_Node_Str",Toast.LENGTH_SHORT).show();
    drone.state.setGuidedMode(new waypoint(guidedPoint.getCoord(),newAltitude));
    guidedPoint=null;
  }
}

Fixed version (ground truth):
@Override public void onAltitudeChanged(double newAltitude){
  super.onAltitudeChanged(newAltitude);
  if (drone.guidedPoint.isCoordValid()) {
    drone.guidedPoint.setGuidedMode();
  }
}
Program: 95414
Project: 95414
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.menu_super_flight_activity,menu);
  MenuItem flightModeMenu=menu.findItem(R.id.menu_flight_modes_spinner);
  fligthModeSpinner=(SelectModeSpinner)flightModeMenu.getActionView();
  fligthModeSpinner.buildSpinner(this,this);
  fligthModeSpinner.updateModeSpinner(drone);
  MenuItem wpMenu=menu.findItem(R.id.menu_wp_spinner);
  wpSpinner=(SelectWaypointSpinner)wpMenu.getActionView();
  wpSpinner.buildSpinner(this,this);
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.menu_super_flight_activity,menu);
  MenuItem flightModeMenu=menu.findItem(R.id.menu_flight_modes_spinner);
  fligthModeSpinner=(SelectModeSpinner)flightModeMenu.getActionView();
  fligthModeSpinner.buildSpinner(this,this);
  fligthModeSpinner.updateModeSpinner(drone);
  MenuItem wpMenu=menu.findItem(R.id.menu_wp_spinner);
  wpSpinner=(SelectWaypointSpinner)wpMenu.getActionView();
  wpSpinner.buildSpinner(this,this);
  drone.guidedPoint.setOnGuidedListner(this);
  return super.onCreateOptionsMenu(menu);
}
Program: 95415
Project: 95415
Buggy source:
public GuidedPoint(LatLng coord){
  this.coord=coord;
}

Fixed version (ground truth):
public GuidedPoint(Drone myDrone){
  super(myDrone);
}
Program: 95416
Project: 95416
Buggy source:
@Override public void onMapLongClick(LatLng coord){
  getPreferences();
  if (isGuidedModeEnabled) {
    GuidedPoint guidedPoint=new GuidedPoint(coord);
    mListener.onSetGuidedMode(guidedPoint);
    markers.updateMarker(guidedPoint);
  }
}

Fixed version (ground truth):
@Override public void onMapLongClick(LatLng coord){
  getPreferences();
  if (isGuidedModeEnabled) {
    drone.guidedPoint.newGuidedPoint(coord);
    markers.updateMarker(drone.guidedPoint);
  }
}
Program: 95417
Project: 95417
Buggy source:
@Override public void onLocationChanged(Location location){
  waypoint guidedWP=new waypoint(location.getLatitude(),location.getLongitude(),drone.mission.getDefaultAlt());
  drone.state.setGuidedMode(guidedWP);
}

Fixed version (ground truth):
@Override public void onLocationChanged(Location location){
  waypoint guidedWP=new waypoint(location.getLatitude(),location.getLongitude(),drone.mission.getDefaultAlt());
  drone.guidedPoint.setGuidedMode(guidedWP);
}
Program: 95418
Project: 95418
Buggy source:
void updateGuidedMarker(LatLng point){
  if (guidedMarker == null) {
    addMarker(point);
  }
 else {
    updateMarker(point);
  }
}

Fixed version (ground truth):
public void updateGuidedMarker(LatLng point){
  if (guidedMarker == null) {
    addMarker(point);
  }
 else {
    updateMarker(point);
  }
}
Program: 95419
Project: 95419
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.gcp);
  gcpList=new ArrayList<gcp>();
  gcpMapFragment=((GcpMapFragment)getFragmentManager().findFragmentById(R.id.gcpMapFragment));
  clearWaypointsAndUpdate();
  checkIntent();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.gcp);
  gcpList=new ArrayList<Gcp>();
  gcpMapFragment=((GcpMapFragment)getFragmentManager().findFragmentById(R.id.gcpMapFragment));
  clearWaypointsAndUpdate();
  checkIntent();
}
Program: 95420
Project: 95420
Buggy source:
public void openGcpFile(){
  OpenFileDialog dialog=new OpenGcpFileDialog(){
    @Override public void onGcpFileLoaded(    List<gcp> list){
      if (list != null) {
        putListToGcp(list);
      }
    }
  }
;
  dialog.openDialog(this);
}

Fixed version (ground truth):
public void openGcpFile(){
  OpenFileDialog dialog=new OpenGcpFileDialog(){
    @Override public void onGcpFileLoaded(    List<Gcp> list){
      if (list != null) {
        putListToGcp(list);
      }
    }
  }
;
  dialog.openDialog(this);
}
Program: 95421
Project: 95421
Buggy source:
private List<LatLng> getGcpCoordinates(){
  List<LatLng> result=new ArrayList<LatLng>();
  for (  gcp latLng : gcpList) {
    result.add(latLng.coord);
  }
  return result;
}

Fixed version (ground truth):
private List<LatLng> getGcpCoordinates(){
  List<LatLng> result=new ArrayList<LatLng>();
  for (  Gcp latLng : gcpList) {
    result.add(latLng.coord);
  }
  return result;
}
Program: 95422
Project: 95422
Buggy source:
@Override public void onGcpFileLoaded(List<gcp> list){
  if (list != null) {
    putListToGcp(list);
  }
}

Fixed version (ground truth):
@Override public void onGcpFileLoaded(List<Gcp> list){
  if (list != null) {
    putListToGcp(list);
  }
}
Program: 95423
Project: 95423
Buggy source:
@Override public void onGcpClick(MarkerSource gcp){
  ((com.droidplanner.gcp.gcp)gcp).toogleState();
  gcpMapFragment.markers.updateMarker(gcp);
}

Fixed version (ground truth):
@Override public void onGcpClick(MarkerSource gcp){
  ((com.droidplanner.gcp.Gcp)gcp).toogleState();
  gcpMapFragment.markers.updateMarker(gcp);
}
Program: 95424
Project: 95424
Buggy source:
private void putListToGcp(List<gcp> list){
  gcpList.clear();
  gcpList.addAll(list);
  gcpMapFragment.markers.updateMarkers(gcpList);
  gcpMapFragment.zoomToExtents(getGcpCoordinates());
}

Fixed version (ground truth):
private void putListToGcp(List<Gcp> list){
  gcpList.clear();
  gcpList.addAll(list);
  gcpMapFragment.markers.updateMarkers(gcpList);
  gcpMapFragment.zoomToExtents(getGcpCoordinates());
}
Program: 95425
Project: 95425
Buggy source:
public abstract void onGcpFileLoaded(List<gcp> gcpList);

Fixed version (ground truth):
public abstract void onGcpFileLoaded(List<Gcp> gcpList);
Program: 95426
Project: 95426
Buggy source:
private gcp readCoordinate(XmlPullParser parser) throws IOException, XmlPullParserException {
  Double Lat, Lng;
  parser.require(XmlPullParser.START_TAG,ns,"String_Node_Str");
  String coordString=readText(parser);
  parser.require(XmlPullParser.END_TAG,ns,"String_Node_Str");
  String title[]=coordString.split("String_Node_Str");
  Lng=Double.valueOf(title[0]);
  Lat=Double.valueOf(title[1]);
  return (new gcp(Lat,Lng));
}

Fixed version (ground truth):
private Gcp readCoordinate(XmlPullParser parser) throws IOException, XmlPullParserException {
  Double Lat, Lng;
  parser.require(XmlPullParser.START_TAG,ns,"String_Node_Str");
  String coordString=readText(parser);
  parser.require(XmlPullParser.END_TAG,ns,"String_Node_Str");
  String title[]=coordString.split("String_Node_Str");
  Lng=Double.valueOf(title[0]);
  Lat=Double.valueOf(title[1]);
  return (new Gcp(Lat,Lng));
}
Program: 95427
Project: 95427
Buggy source:
private void readPlacemark(XmlPullParser parser) throws XmlPullParserException, IOException {
  parser.require(XmlPullParser.START_TAG,ns,"String_Node_Str");
  gcp point=null;
  while (parser.next() != XmlPullParser.END_TAG) {
    if (parser.getEventType() != XmlPullParser.START_TAG) {
      continue;
    }
    String name=parser.getName();
    if (name.equals("String_Node_Str")) {
      point=readPoint(parser);
      if (point != null) {
        gcpList.add(point);
      }
    }
 else {
      skip(parser);
    }
  }
}

Fixed version (ground truth):
private void readPlacemark(XmlPullParser parser) throws XmlPullParserException, IOException {
  parser.require(XmlPullParser.START_TAG,ns,"String_Node_Str");
  Gcp point=null;
  while (parser.next() != XmlPullParser.END_TAG) {
    if (parser.getEventType() != XmlPullParser.START_TAG) {
      continue;
    }
    String name=parser.getName();
    if (name.equals("String_Node_Str")) {
      point=readPoint(parser);
      if (point != null) {
        gcpList.add(point);
      }
    }
 else {
      skip(parser);
    }
  }
}
Program: 95428
Project: 95428
Buggy source:
public List<gcp> parse(InputStream in) throws XmlPullParserException, IOException {
  gcpList=new ArrayList<gcp>();
  XmlPullParser parser=Xml.newPullParser();
  parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES,false);
  parser.setInput(in,null);
  parser.nextTag();
  readFeed(parser);
  return gcpList;
}

Fixed version (ground truth):
public List<Gcp> parse(InputStream in) throws XmlPullParserException, IOException {
  gcpList=new ArrayList<Gcp>();
  XmlPullParser parser=Xml.newPullParser();
  parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES,false);
  parser.setInput(in,null);
  parser.nextTag();
  readFeed(parser);
  return gcpList;
}
Program: 95429
Project: 95429
Buggy source:
private gcp readPoint(XmlPullParser parser) throws IOException, XmlPullParserException {
  gcp point=null;
  while (parser.next() != XmlPullParser.END_TAG) {
    if (parser.getEventType() != XmlPullParser.START_TAG) {
      continue;
    }
    String name=parser.getName();
    if (name.equals("String_Node_Str")) {
      point=readCoordinate(parser);
    }
 else {
      skip(parser);
    }
  }
  return point;
}

Fixed version (ground truth):
private Gcp readPoint(XmlPullParser parser) throws IOException, XmlPullParserException {
  Gcp point=null;
  while (parser.next() != XmlPullParser.END_TAG) {
    if (parser.getEventType() != XmlPullParser.START_TAG) {
      continue;
    }
    String name=parser.getName();
    if (name.equals("String_Node_Str")) {
      point=readCoordinate(parser);
    }
 else {
      skip(parser);
    }
  }
  return point;
}
Program: 95430
Project: 95430
Buggy source:
public static MarkerOptions build(gcp gcp){
  return new MarkerOptions().position(gcp.coord).title(String.valueOf(0)).icon(getIcon(gcp)).anchor((float)0.5,(float)0.5);
}

Fixed version (ground truth):
public static MarkerOptions build(Gcp gcp){
  return new MarkerOptions().position(gcp.coord).title(String.valueOf(0)).icon(getIcon(gcp)).anchor((float)0.5,(float)0.5);
}
Program: 95431
Project: 95431
Buggy source:
public static void update(Marker marker,gcp gcp){
  marker.setPosition(gcp.coord);
  marker.setTitle(String.valueOf(0));
  marker.setIcon(getIcon(gcp));
}

Fixed version (ground truth):
public static void update(Marker marker,Gcp gcp){
  marker.setPosition(gcp.coord);
  marker.setTitle(String.valueOf(0));
  marker.setIcon(getIcon(gcp));
}
Program: 95432
Project: 95432
Buggy source:
private static BitmapDescriptor getIcon(gcp gcp){
  if (gcp.isMarked) {
    return BitmapDescriptorFactory.fromResource(R.drawable.placemark_circle_red);
  }
 else {
    return BitmapDescriptorFactory.fromResource(R.drawable.placemark_circle_blue);
  }
}

Fixed version (ground truth):
private static BitmapDescriptor getIcon(Gcp gcp){
  if (gcp.isMarked) {
    return BitmapDescriptorFactory.fromResource(R.drawable.placemark_circle_red);
  }
 else {
    return BitmapDescriptorFactory.fromResource(R.drawable.placemark_circle_blue);
  }
}
Program: 95433
Project: 95433
Buggy source:
private void writeWaypointsLines(FileOutputStream out) throws IOException {
  for (int i=0; i < waypoints.size(); i++) {
    out.write(String.format(Locale.ENGLISH,"String_Node_Str",i + 1,0,16,waypoints.get(i).getCoord().latitude,waypoints.get(i).getCoord().longitude,waypoints.get(i).getHeight()).getBytes());
  }
}

Fixed version (ground truth):
private void writeWaypointsLines(FileOutputStream out) throws IOException {
  for (int i=0; i < waypoints.size(); i++) {
    waypoint wp=waypoints.get(i);
    out.write(String.format(Locale.ENGLISH,"String_Node_Str",i + 1,wp.getFrame(),wp.getCmd().getType(),wp.getCoord().latitude,wp.getCoord().longitude,wp.getHeight()).getBytes());
  }
}
Program: 95434
Project: 95434
Buggy source:
private void addRow(waypoint wp,int i){
  wp.setNumber(i);
  MissionRow row=new MissionRow(this,wp);
  table.addView(row);
}

Fixed version (ground truth):
private void addRow(waypoint wp,int i){
  MissionRow row=new MissionRow(this,wp);
  table.addView(row);
}
Program: 95435
Project: 95435
Buggy source:
private void parseWaypointLines(BufferedReader reader) throws IOException {
  String line;
  waypoints.clear();
  while ((line=reader.readLine()) != null) {
    String[] RowData=line.split("String_Node_Str");
    waypoints.add(new waypoint(Double.valueOf(RowData[8]),Double.valueOf(RowData[9]),Double.valueOf(RowData[10])));
  }
}

Fixed version (ground truth):
private void parseWaypointLines(BufferedReader reader) throws IOException {
  String line;
  waypoints.clear();
  while ((line=reader.readLine()) != null) {
    String[] RowData=line.split("String_Node_Str");
    waypoint wp=new waypoint(Double.valueOf(RowData[8]),Double.valueOf(RowData[9]),Double.valueOf(RowData[10]));
    wp.setNumber(Integer.valueOf(RowData[0]));
    wp.setFrame(Integer.valueOf(RowData[2]));
    wp.setCmd(ApmCommands.getCmd(Integer.valueOf(RowData[3])));
    wp.setParameters(Float.valueOf(RowData[4]),Float.valueOf(RowData[5]),Float.valueOf(RowData[6]),Float.valueOf(RowData[7]));
    waypoints.add(wp);
  }
}
Program: 95436
Project: 95436
Buggy source:
public void update(Drone drone,Polygon polygon){
  mMap.clear();
  homeMarker.invalidate();
  waypointMarkers.clear();
  polygonMarkers.clear();
  homeMarker.update(drone);
  int i=0;
  for (  MarkerOptions waypoint : getMissionMarkers(drone)) {
    waypointMarkers.put(i++,mMap.addMarker(waypoint));
  }
  mMap.addPolyline(getMissionPath(drone));
  i=0;
  for (  MarkerOptions point : getPolygonMarkers(polygon)) {
    polygonMarkers.put(i++,mMap.addMarker(point));
  }
  mMap.addPolyline(getPolygonPath(polygon));
}

Fixed version (ground truth):
public void update(Drone drone,Polygon polygon){
  mMap.clear();
  homeMarker.invalidate();
  waypointMarkers.clear();
  polygonMarkers.clear();
  mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new LocalMapTileProvider())).setZIndex(-1);
  homeMarker.update(drone);
  int i=0;
  for (  MarkerOptions point : getPolygonMarkers(polygon)) {
    polygonMarkers.put(i++,mMap.addMarker(point));
  }
  mMap.addPolyline(getPolygonPath(polygon));
  i=0;
  for (  MarkerOptions waypoint : getMissionMarkers(drone)) {
    waypointMarkers.put(i++,mMap.addMarker(waypoint));
  }
  mMap.addPolyline(getMissionPath(drone));
}
Program: 95437
Project: 95437
Buggy source:
public void zoomToLastKnowPosition(){
  mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(drone.GPS.getPosition(),16));
}

Fixed version (ground truth):
public void zoomToLastKnowPosition(){
  if (drone.GPS.isPositionValid()) {
    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(drone.GPS.getPosition(),16));
  }
 else {
    Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
}
Program: 95438
Project: 95438
Buggy source:
private void setupOfflineMapOverlay(){
  clearTileCache();
  GoogleMap mMap=getMap();
  mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
  mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new LocalMapTileProvider()));
}

Fixed version (ground truth):
private void setupOfflineMapOverlay(){
  GoogleMap mMap=getMap();
  mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
  TileOverlay tileOverlay=mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new LocalMapTileProvider()));
  tileOverlay.setZIndex(-1);
  tileOverlay.clearTileCache();
}