nus-yam/ex-repair huggingface dataset:
Program: 189505
Project: 189505
Buggy source:
@Override public double logEvaluate(Observation input){
  double logLikelihood=0d;
  logLikelihood+=this.edgeTransitionDist.logEvaluate(this.getPath().getEdges().get(0).getInferredEdge(),this.getInferredEdge());
  logLikelihood+=this.getMovementFilter().logLikelihood(input.getProjectedPoint(),this.belief,PathEdge.getEdge(this.getInferredEdge()));
  return logLikelihood;
}

Fixed version (ground truth):
@Beta @Override public double logEvaluate(Observation input){
  double logLikelihood=0d;
  logLikelihood+=this.getMovementFilter().logLikelihood(input.getProjectedPoint(),this.belief,PathEdge.getEdge(this.getInferredEdge()));
  return logLikelihood;
}
Program: 189506
Project: 189506
Buggy source:
public double logEvaluate(InferredEdge from,InferredEdge to){
  if (from.isEmptyEdge()) {
    return getFreeMotionTransPrior().getProbabilityFunction().logEvaluate(getTransitionType(from,to));
  }
 else {
    return getEdgeMotionTransPrior().getProbabilityFunction().logEvaluate(getTransitionType(from,to));
  }
}

Fixed version (ground truth):
public double logEvaluate(InferredEdge from,InferredEdge to){
  if (from == null) {
    if (to.isEmptyEdge()) {
      return getFreeMotionTransPrior().getProbabilityFunction().logEvaluate(getTransitionType(to,to));
    }
 else {
      return getEdgeMotionTransPrior().getProbabilityFunction().logEvaluate(getTransitionType(to,to));
    }
  }
 else {
    if (from.isEmptyEdge()) {
      return getFreeMotionTransPrior().getProbabilityFunction().logEvaluate(getTransitionType(from,to));
    }
 else {
      return getEdgeMotionTransPrior().getProbabilityFunction().logEvaluate(getTransitionType(from,to));
    }
  }
}
Program: 189507
Project: 189507
Buggy source:
public int getTotalCount(){
  return totalCount;
}

Fixed version (ground truth):
public int getTotalCount(){
  int total=0;
  for (  java.util.Map.Entry<KeyType,MutableDouble> entry : this.map.entrySet()) {
    MutableDoubleCount count=(MutableDoubleCount)entry.getValue();
    total+=count.getCount();
  }
  return total;
}
Program: 189508
Project: 189508
Buggy source:
@Override public double increment(KeyType key,final double value){
  final MutableDouble entry=this.map.get(key);
  double newValue;
  double delta;
  if (entry == null) {
    if (value > 0.0) {
      this.map.put(key,new MutableDouble(value));
      delta=value;
    }
 else {
      delta=0.0;
    }
    newValue=value;
  }
 else {
    if (entry.value + value >= 0.0) {
      delta=value;
      entry.value+=value;
    }
 else {
      delta=-entry.value;
      entry.value=0.0;
    }
    newValue=entry.value;
  }
  if (delta != 0.0) {
    keysToCounts.adjustOrPutValue(key,1,1);
    totalCount++;
    assert(totalCount == StatisticsUtil.sum(keysToCounts.values()));
  }
  this.total+=delta;
  return newValue;
}

Fixed version (ground truth):
@Override public double increment(KeyType key,final double value){
  final MutableDoubleCount entry=(MutableDoubleCount)this.map.get(key);
  double newValue;
  double delta;
  if (entry == null) {
    if (value > 0.0) {
      this.map.put(key,new MutableDoubleCount(value));
      delta=value;
    }
 else {
      delta=0.0;
    }
    newValue=value;
  }
 else {
    if (entry.value + value >= 0.0) {
      delta=value;
      entry.plusEquals(value);
    }
 else {
      delta=-entry.value;
      entry.set(0d);
    }
    newValue=entry.value;
  }
  this.total+=delta;
  return newValue;
}
Program: 189509
Project: 189509
Buggy source:
public int getCount(final KeyType key){
  return keysToCounts.get(key);
}

Fixed version (ground truth):
public int getCount(KeyType key){
  return ((MutableDoubleCount)this.map.get(key)).getCount();
}
Program: 189510
Project: 189510
Buggy source:
@Override public void set(final KeyType key,final double value){
  final MutableDouble entry=this.map.get(key);
  if (entry == null) {
    if (value > 0.0) {
      this.map.put(key,new MutableDouble(value));
      this.total+=value;
      keysToCounts.adjustOrPutValue(key,1,1);
      totalCount++;
    }
  }
 else   if (value > 0.0) {
    this.total+=value - entry.value;
    entry.value=value;
    keysToCounts.adjustOrPutValue(key,1,1);
    totalCount++;
  }
 else {
    entry.value=0.0;
  }
  assert(totalCount <= 50);
  assert(totalCount == StatisticsUtil.sum(keysToCounts.values()));
}

Fixed version (ground truth):
public void set(final KeyType key,final double value,final int count){
  final MutableDoubleCount entry=(MutableDoubleCount)this.map.get(key);
  if (entry == null) {
    if (value > 0.0) {
      this.map.put(key,new MutableDoubleCount(value,count));
      this.total+=value;
    }
  }
 else   if (value > 0.0) {
    this.total+=value - entry.value;
    entry.set(value,count);
  }
 else {
    entry.set(0d,count);
  }
}
Program: 189511
Project: 189511
Buggy source:
@Override public void clear(){
  this.map.clear();
  this.total=0.0;
  this.keysToCounts.clear();
  this.totalCount=0;
}

Fixed version (ground truth):
@Override public void clear(){
  super.clear();
  this.total=0.0;
}
Program: 189512
Project: 189512
Buggy source:
/** 
 * Creates a new instance of
 * @param map Backing Map that stores the data
 * @param total Sum of all values in the Map
 */
protected LogDefaultDataDistribution(final LinkedHashMap<KeyType,Multiset.Entry<KeyType>> map,final double total){
  this.map=Maps.newLinkedHashMap(map);
  this.total=total;
}

Fixed version (ground truth):
/** 
 * Creates a new instance of
 * @param map Backing Map that stores the data
 * @param total Sum of all values in the Map
 */
protected LogDefaultDataDistribution(final Map<KeyType,MutableDouble> map,final double total){
  super(map);
  this.total=total;
}
Program: 189513
Project: 189513
Buggy source:
@Override public LogDefaultDataDistribution<KeyType> clone(){
  final LogDefaultDataDistribution<KeyType> clone=new LogDefaultDataDistribution<KeyType>(this.getDomainSize());
  clone.incrementAll(this.getDomain());
  clone.total=this.total;
  clone.totalCount=this.totalCount;
  return clone;
}

Fixed version (ground truth):
@Override public LogDefaultDataDistribution<KeyType> clone(){
}
Program: 189514
Project: 189514
Buggy source:
public static <DistributionType,SupportType extends Comparable>DataDistribution<SupportType> getLogNormalizedDistribution(Map<SupportType,WrappedWeightedValue<DistributionType>> map){
  double totalLikelihood=Double.NEGATIVE_INFINITY;
  for (  final WrappedWeightedValue<DistributionType> weight : map.values()) {
    totalLikelihood=LogMath.add(weight.getWeight(),totalLikelihood);
  }
  if (totalLikelihood == Double.NEGATIVE_INFINITY)   return null;
  final List<Entry<SupportType,WrappedWeightedValue<DistributionType>>> entryList=Lists.newArrayList(map.entrySet());
  final DataDistribution<SupportType> result=new LogDefaultDataDistribution<SupportType>();
  for (  final Entry<SupportType,WrappedWeightedValue<DistributionType>> entry : entryList) {
    if (entry.getValue().getWeight() == Double.NEGATIVE_INFINITY)     continue;
    final double weight=entry.getValue().getWeight() - totalLikelihood;
    result.set(entry.getKey(),Math.exp(weight));
  }
  return result;
}

Fixed version (ground truth):
public static <DistributionType,SupportType extends Comparable>DataDistribution<SupportType> getLogNormalizedDistribution(Map<SupportType,WrappedWeightedValue<DistributionType>> map){
  double totalLikelihood=Double.NEGATIVE_INFINITY;
  for (  final WrappedWeightedValue<DistributionType> weight : map.values()) {
    totalLikelihood=LogMath.add(weight.getWeight(),totalLikelihood);
  }
  if (totalLikelihood == Double.NEGATIVE_INFINITY)   return null;
  final List<Entry<SupportType,WrappedWeightedValue<DistributionType>>> entryList=Lists.newArrayList(map.entrySet());
  final LogDefaultDataDistribution<SupportType> result=new LogDefaultDataDistribution<SupportType>();
  for (  final Entry<SupportType,WrappedWeightedValue<DistributionType>> entry : entryList) {
    if (entry.getValue().getWeight() == Double.NEGATIVE_INFINITY)     continue;
    final double weight=entry.getValue().getWeight() - totalLikelihood;
    result.set(entry.getKey(),Math.exp(weight),entry.getValue().getCount());
  }
  return result;
}
Program: 189515
Project: 189515
Buggy source:
public VehicleTrackingBootstrapFilter(Observation obs,OtpGraph inferredGraph,InitialParameters parameters,boolean isDebug){
  this.isDebug=isDebug;
  this.setNumParticles(50);
  this.inferredGraph=inferredGraph;
  VehicleTrackingBootstrapFilterUpdater updater=new VehicleTrackingBootstrapFilterUpdater(obs,this.inferredGraph,parameters);
  this.setUpdater(updater);
  this.initialObservation=obs;
}

Fixed version (ground truth):
public VehicleTrackingBootstrapFilter(Observation obs,OtpGraph inferredGraph,VehicleStateInitialParameters parameters,boolean isDebug){
  this.isDebug=isDebug;
  this.setNumParticles(50);
  this.inferredGraph=inferredGraph;
  VehicleTrackingBootstrapFilterUpdater updater=new VehicleTrackingBootstrapFilterUpdater(obs,this.inferredGraph,parameters);
  this.setUpdater(updater);
  this.initialObservation=obs;
}
Program: 189516
Project: 189516
Buggy source:
public VehicleTrackingBootstrapFilterUpdater(Observation obs,OtpGraph inferredGraph,InitialParameters parameters){
  this.initialObservation=obs;
  this.inferredGraph=inferredGraph;
  this.parameters=parameters;
  this.threadRandom=new UpdaterThreadLocal(parameters.getSeed());
}

Fixed version (ground truth):
public VehicleTrackingBootstrapFilterUpdater(Observation obs,OtpGraph inferredGraph,VehicleStateInitialParameters parameters){
  this.initialObservation=obs;
  this.inferredGraph=inferredGraph;
  this.parameters=parameters;
  this.threadRandom=new UpdaterThreadLocal(parameters.getSeed());
}
Program: 189517
Project: 189517
Buggy source:
public VehicleTrackingPLFilter(Observation obs,OtpGraph inferredGraph,InitialParameters parameters,boolean isDebug){
  this.isDebug=isDebug;
  this.setNumParticles(50);
  this.inferredGraph=inferredGraph;
  this.setUpdater(new VehicleTrackingBootstrapFilterUpdater(obs,this.inferredGraph,parameters));
  this.initialObservation=obs;
}

Fixed version (ground truth):
public VehicleTrackingPLFilter(Observation obs,OtpGraph inferredGraph,VehicleStateInitialParameters parameters,boolean isDebug){
  this.isDebug=isDebug;
  this.setNumParticles(50);
  this.inferredGraph=inferredGraph;
  this.setUpdater(new VehicleTrackingBootstrapFilterUpdater(obs,this.inferredGraph,parameters));
  this.initialObservation=obs;
}
Program: 189518
Project: 189518
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + value + "String_Node_Str"+ weight+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + count + "String_Node_Str"+ value+ "String_Node_Str"+ weight+ "String_Node_Str";
}
Program: 189519
Project: 189519
Buggy source:
@Override public State traverse(State s0){
  RoutingRequest options=s0.getOptions();
  if (turnRestricted(s0,options) && !options.getModes().contains(TraverseMode.WALK)) {
    return null;
  }
  TraverseMode traverseMode=s0.getNonTransitMode(options);
  if (!((TurnVertex)fromv).canTraverse(options,traverseMode)) {
    return null;
  }
  StateEditor s1=s0.edit(this);
  double speed=options.getSpeed(s0.getNonTransitMode(options));
  double time=(((TurnVertex)fromv).getEffectiveLength(traverseMode) + turnCost / 20.0) / speed;
  double weight=((TurnVertex)fromv).computeWeight(s0,options,time);
  s1.incrementWalkDistance(((TurnVertex)fromv).getLength());
  s1.incrementTimeInSeconds((int)Math.ceil(time));
  s1.incrementWeight(weight);
  if (s1.weHaveWalkedTooFar(options))   return null;
  return s1.makeState();
}

Fixed version (ground truth):
@Override public State traverse(State s0){
  final RoutingRequest options=s0.getOptions();
  if (turnRestricted(s0,options) && !options.getModes().contains(TraverseMode.WALK)) {
    return null;
  }
  final TraverseMode traverseMode=s0.getNonTransitMode(options);
  if (!((TurnVertex)fromv).canTraverse(options,traverseMode)) {
    return null;
  }
  final StateEditor s1=s0.edit(this);
  final double speed=options.getSpeed(s0.getNonTransitMode(options));
  final double time=(((TurnVertex)fromv).getEffectiveLength(traverseMode) + turnCost / 20.0) / speed;
  final double weight=((TurnVertex)fromv).computeWeight(s0,options,time);
  s1.incrementWalkDistance(((TurnVertex)fromv).getLength());
  s1.incrementTimeInSeconds((int)Math.ceil(time));
  s1.incrementWeight(weight);
  if (s1.weHaveWalkedTooFar(options))   return null;
  return s1.makeState();
}
Program: 189520
Project: 189520
Buggy source:
public TurnEdge makeTurnEdge(StreetVertex out){
  if (out instanceof TurnVertex) {
    return new SimpleTurnEdge(this,(TurnVertex)out);
  }
  return new SimpleTurnEdge(this,out);
}

Fixed version (ground truth):
@Override public TurnEdge makeTurnEdge(StreetVertex out){
  if (out instanceof TurnVertex) {
    return new SimpleTurnEdge(this,out);
  }
  return new SimpleTurnEdge(this,out);
}
Program: 189521
Project: 189521
Buggy source:
@Override public double distance(double lat1,double lon1,double lat2,double lon2,double radius){
  double xd=lon1 - lon2;
  double yd=lat1 - lat2;
  return Math.sqrt(xd * xd + yd * yd);
}

Fixed version (ground truth):
@Override public double distance(double lat1,double lon1,double lat2,double lon2,double radius){
  final double xd=lon1 - lon2;
  final double yd=lat1 - lat2;
  return Math.sqrt(xd * xd + yd * yd);
}
Program: 189522
Project: 189522
Buggy source:
@Override public double fastDistance(double lat1,double lon1,double lat2,double lon2){
  double xd=lon1 - lon2;
  double yd=lat1 - lat2;
  return Math.sqrt(xd * xd + yd * yd);
}

Fixed version (ground truth):
@Override public double fastDistance(double lat1,double lon1,double lat2,double lon2){
  final double xd=lon1 - lon2;
  final double yd=lat1 - lat2;
  return Math.sqrt(xd * xd + yd * yd);
}
Program: 189523
Project: 189523
Buggy source:
public PathEdge getEdgeForDistance(double distance,boolean clamp){
  final double direction=Math.signum(totalPathDistance);
  if (direction * distance > Math.abs(totalPathDistance)) {
    return Iterables.getLast(edges);
  }
 else   if (direction * distance < 0d) {
    return Iterables.getFirst(edges,null);
  }
  for (  final PathEdge edge : edges) {
    if (edge.isOnEdge(distance))     return edge;
  }
  return null;
}

Fixed version (ground truth):
public PathEdge getEdgeForDistance(double distance,boolean clamp){
}
Program: 189524
Project: 189524
Buggy source:
public InferredEdge getStartEdge(){
  return startEdge;
}

Fixed version (ground truth):
public InferredEdge getStartEdge(){
  return startSearchEdge;
}
Program: 189525
Project: 189525
Buggy source:
public InferredEdge getEndEdge(){
  return endEdge;
}

Fixed version (ground truth):
public InferredEdge getEndEdge(){
  return endSearchEdge;
}
Program: 189526
Project: 189526
Buggy source:
public static void convertToGroundBelief(MultivariateGaussian belief,PathEdge edge,boolean allowExtensions){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 4)   return;
  Preconditions.checkArgument(!edge.isEmptyEdge());
  final Vector positiveMean;
  if (belief.getMean().getElement(0) < 0d) {
    final Vector posMeanTmp=belief.getMean().clone();
    double posLocation=Math.max(0d,belief.getMean().getElement(0) + edge.getInferredEdge().getLength() + Math.abs(edge.getDistToStartOfEdge()));
    if (allowExtensions && posLocation < 0d) {
      posLocation=edge.getInferredEdge().getLength() + Math.abs(belief.getMean().getElement(0));
    }
    posMeanTmp.setElement(0,posLocation);
    positiveMean=posMeanTmp;
  }
 else {
    positiveMean=belief.getMean().clone();
  }
  final Entry<LineSegment,Double> segmentDist=getSegmentAndDistanceToStart(edge.getInferredEdge(),positiveMean.getElement(0));
  final double absTotalPathDistanceToStartOfSegment=Math.abs(segmentDist.getValue());
  final double absTotalPathDistanceToEndOfSegment=absTotalPathDistanceToStartOfSegment + segmentDist.getKey().getLength();
  final Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(segmentDist.getKey(),absTotalPathDistanceToStartOfSegment);
  if (!allowExtensions) {
    if (positiveMean.getElement(0) > absTotalPathDistanceToEndOfSegment) {
      positiveMean.setElement(0,absTotalPathDistanceToEndOfSegment);
    }
 else     if (positiveMean.getElement(0) < absTotalPathDistanceToStartOfSegment) {
      positiveMean.setElement(0,absTotalPathDistanceToStartOfSegment);
    }
  }
  final Matrix C=belief.getCovariance();
  final Vector projMean=projPair.getKey().times(positiveMean).plus(projPair.getValue());
  final Matrix projCov=projPair.getKey().times(C).times(projPair.getKey().transpose());
  belief.setMean(projMean);
  belief.setCovariance(projCov);
}

Fixed version (ground truth):
public static void convertToGroundBelief(MultivariateGaussian belief,PathEdge edge,boolean allowExtensions){
}
Program: 189529
Project: 189529
Buggy source:
private VehicleState sampleState(VehicleState vehicleState,long time){
  vehicleState.getMovementFilter().setCurrentTimeDiff(this.simParameters.getFrequency());
  vehicleState.getBelief().clone();
  final MultivariateGaussian currentLocBelief=vehicleState.getBelief();
  final EdgeTransitionDistributions currentEdgeTrans=vehicleState.getEdgeTransitionDist();
  final PathEdge currentPathEdge=PathEdge.getEdge(vehicleState.getInferredEdge());
  this.localSeed=rng.nextLong();
  final InferredPath newPath=traverseEdge(vehicleState.getEdgeTransitionDist(),currentLocBelief,currentPathEdge,vehicleState.getMovementFilter());
  final PathEdge newPathEdge=Iterables.getLast(newPath.getEdges());
  final Matrix gCov=vehicleState.getMovementFilter().getGroundFilter().getMeasurementCovariance();
  final Vector thisLoc=sampleObservation(currentLocBelief,gCov,newPathEdge);
  final Coordinate obsCoord=GeoUtils.convertToLatLon(thisLoc);
  Observation thisObs;
  try {
    thisObs=Observation.createObservation(simulationName,new Date(time),obsCoord,null,null,null);
  }
 catch (  final TimeOrderException e) {
    e.printStackTrace();
    return null;
  }
  final VehicleState newState=new VehicleState(this.inferredGraph,thisObs,vehicleState.getMovementFilter(),currentLocBelief,currentEdgeTrans,newPath,vehicleState);
  instance.update(newState,thisObs,this.simParameters.isPerformInference());
  return newState;
}

Fixed version (ground truth):
private VehicleState sampleState(VehicleState vehicleState,long time){
  vehicleState.getMovementFilter().setCurrentTimeDiff(this.simParameters.getFrequency());
  final MultivariateGaussian currentLocBelief=vehicleState.getBelief();
  final EdgeTransitionDistributions currentEdgeTrans=vehicleState.getEdgeTransitionDist();
  final PathEdge currentPathEdge=PathEdge.getEdge(vehicleState.getInferredEdge());
  this.localSeed=rng.nextLong();
  final InferredPath newPath=traverseEdge(vehicleState.getEdgeTransitionDist(),currentLocBelief,currentPathEdge,vehicleState.getMovementFilter());
  final PathEdge newPathEdge=Iterables.getLast(newPath.getEdges());
  final Matrix gCov=vehicleState.getMovementFilter().getGroundFilter().getMeasurementCovariance();
  final Vector thisLoc=sampleObservation(currentLocBelief,gCov,newPathEdge);
  final Coordinate obsCoord=GeoUtils.convertToLatLon(thisLoc);
  Observation thisObs;
  try {
    thisObs=Observation.createObservation(simulationName,new Date(time),obsCoord,null,null,null);
  }
 catch (  final TimeOrderException e) {
    e.printStackTrace();
    return null;
  }
  final VehicleState newState=new VehicleState(this.inferredGraph,thisObs,vehicleState.getMovementFilter(),currentLocBelief,currentEdgeTrans,newPath,vehicleState);
  instance.update(newState,thisObs,this.simParameters.isPerformInference());
  return newState;
}
Program: 189530
Project: 189530
Buggy source:
public InferredPath(PathEdge edge){
  Preconditions.checkArgument(!edge.isEmptyEdge());
  this.edges=ImmutableList.of(edge);
  this.totalPathDistance=edge.getInferredEdge().getLength();
  this.isBackward=Boolean.FALSE;
}

Fixed version (ground truth):
public InferredPath(PathEdge edge){
  Preconditions.checkArgument(!edge.isEmptyEdge());
  this.edges=ImmutableList.of(edge);
  this.totalPathDistance=edge.getInferredEdge().getLength();
  this.isBackward=Boolean.FALSE;
  this.edgeIds.add(edge.getInferredEdge().getEdgeId());
}
Program: 189532
Project: 189532
Buggy source:
public Vector sampleObservation(VehicleState vehicleState,PathEdge edge){
  final MultivariateGaussian gbelief=vehicleState.getBelief().clone();
  StandardRoadTrackingFilter.convertToGroundBelief(gbelief,edge);
  final Vector gMean=StandardRoadTrackingFilter.getOg().times(gbelief.getMean());
  final Matrix gCov=vehicleState.getMovementFilter().getGroundFilter().getMeasurementCovariance();
  final Matrix covSqrt=CholeskyDecompositionMTJ.create(DenseMatrixFactoryMTJ.INSTANCE.copyMatrix(gCov)).getR();
  final Vector thisStateSample=MultivariateGaussian.sample(gMean,covSqrt,rng);
  return thisStateSample;
}

Fixed version (ground truth):
public Vector sampleObservation(MultivariateGaussian velLocBelief,Matrix obsCov,PathEdge edge){
  final MultivariateGaussian gbelief=velLocBelief.clone();
  StandardRoadTrackingFilter.convertToGroundBelief(gbelief,edge);
  final Vector gMean=StandardRoadTrackingFilter.getOg().times(gbelief.getMean());
  final Matrix covSqrt=CholeskyDecompositionMTJ.create(DenseMatrixFactoryMTJ.INSTANCE.copyMatrix(obsCov)).getR();
  final Vector thisStateSample=MultivariateGaussian.sample(gMean,covSqrt,rng);
  return thisStateSample;
}
Program: 189533
Project: 189533
Buggy source:
private VehicleState sampleState(VehicleState vehicleState,long time){
  vehicleState.getMovementFilter().setCurrentTimeDiff(this.simParameters.getFrequency());
  final MultivariateGaussian previousLocBelief=vehicleState.getBelief().clone();
  final MultivariateGaussian currentLocBelief=vehicleState.getBelief();
  final EdgeTransitionDistributions currentEdgeTrans=vehicleState.getEdgeTransitionDist();
  final PathEdge currentPathEdge=PathEdge.getEdge(vehicleState.getInferredEdge());
  final InferredPath newPath=traverseEdge(vehicleState.getEdgeTransitionDist(),currentLocBelief,currentPathEdge,vehicleState.getMovementFilter());
  final PathEdge newPathEdge=Iterables.getLast(newPath.getEdges());
  final Vector thisLoc=sampleObservation(vehicleState,newPathEdge);
  final Coordinate obsCoord=GeoUtils.convertToLatLon(thisLoc);
  Observation thisObs;
  try {
    thisObs=Observation.createObservation(simulationName,new Date(time),obsCoord,null,null,null);
  }
 catch (  final TimeOrderException e) {
    e.printStackTrace();
    return null;
  }
  final VehicleState newState=new VehicleState(this.inferredGraph,thisObs,vehicleState.getMovementFilter(),currentLocBelief,currentEdgeTrans,newPathEdge,newPath,vehicleState);
  instance.update(newState,thisObs,this.simParameters.isPerformInference());
  return newState;
}

Fixed version (ground truth):
private VehicleState sampleState(VehicleState vehicleState,long time){
  vehicleState.getMovementFilter().setCurrentTimeDiff(this.simParameters.getFrequency());
  final MultivariateGaussian previousLocBelief=vehicleState.getBelief().clone();
  final MultivariateGaussian currentLocBelief=vehicleState.getBelief();
  final EdgeTransitionDistributions currentEdgeTrans=vehicleState.getEdgeTransitionDist();
  final PathEdge currentPathEdge=PathEdge.getEdge(vehicleState.getInferredEdge());
  final InferredPath newPath=traverseEdge(vehicleState.getEdgeTransitionDist(),currentLocBelief,currentPathEdge,vehicleState.getMovementFilter());
  final PathEdge newPathEdge=Iterables.getLast(newPath.getEdges());
  final Matrix gCov=vehicleState.getMovementFilter().getGroundFilter().getMeasurementCovariance();
  final Vector thisLoc=sampleObservation(currentLocBelief,gCov,newPathEdge);
  final Coordinate obsCoord=GeoUtils.convertToLatLon(thisLoc);
  Observation thisObs;
  try {
    thisObs=Observation.createObservation(simulationName,new Date(time),obsCoord,null,null,null);
  }
 catch (  final TimeOrderException e) {
    e.printStackTrace();
    return null;
  }
  final VehicleState newState=new VehicleState(this.inferredGraph,thisObs,vehicleState.getMovementFilter(),currentLocBelief,currentEdgeTrans,newPathEdge,newPath,vehicleState);
  instance.update(newState,thisObs,this.simParameters.isPerformInference());
  return newState;
}
Program: 189534
Project: 189534
Buggy source:
/** 
 * Get the snapped location in projected/euclidean coordinates for the given obsPoint (in lat/lon).
 * @param obsPoint
 * @return
 */
public Vector getPointOnEdge(Coordinate obsPoint){
  if (this == InferredEdge.emptyEdge)   return null;
  final Coordinate revObsPoint=new Coordinate(obsPoint.y,obsPoint.x);
  final LinearLocation here=posLocationIndexedLine.project(revObsPoint);
  final Coordinate pointOnLine=posLocationIndexedLine.extractPoint(here);
  final Coordinate revOnLine=new Coordinate(pointOnLine.y,pointOnLine.x);
  final Coordinate projPointOnLine=GeoUtils.convertToEuclidean(revOnLine);
  return VectorFactory.getDefault().createVector2D(projPointOnLine.x,projPointOnLine.y);
}

Fixed version (ground truth):
/** 
 * Get the snapped location in projected/euclidean coordinates for the given obsPoint (in lat/lon).
 * @param obsPoint
 * @return
 */
public Vector getPointOnEdge(Coordinate obsPoint){
  if (this == InferredEdge.emptyEdge)   return null;
  final Coordinate revObsPoint=new Coordinate(obsPoint.y,obsPoint.x);
  final LinearLocation here=locationIndexedLine.project(revObsPoint);
  final Coordinate pointOnLine=locationIndexedLine.extractPoint(here);
  final Coordinate revOnLine=new Coordinate(pointOnLine.y,pointOnLine.x);
  final Coordinate projPointOnLine=GeoUtils.convertToEuclidean(revOnLine);
  return VectorFactory.getDefault().createVector2D(projPointOnLine.x,projPointOnLine.y);
}
Program: 189535
Project: 189535
Buggy source:
public Coordinate getCenterPointCoord(){
  return this.posGeometry.getCentroid().getCoordinate();
}

Fixed version (ground truth):
public Coordinate getCenterPointCoord(){
  return this.geometry.getCentroid().getCoordinate();
}
Program: 189536
Project: 189536
Buggy source:
public Coordinate getCoordOnEdge(Vector obsPoint){
  if (this == InferredEdge.emptyEdge)   return null;
  final Coordinate revObsPoint=new Coordinate(obsPoint.getElement(1),obsPoint.getElement(0));
  final LinearLocation here=posLocationIndexedLine.project(revObsPoint);
  final Coordinate pointOnLine=posLocationIndexedLine.extractPoint(here);
  final Coordinate revOnLine=new Coordinate(pointOnLine.y,pointOnLine.x);
  return revOnLine;
}

Fixed version (ground truth):
public Coordinate getCoordOnEdge(Vector obsPoint){
  if (this == InferredEdge.emptyEdge)   return null;
  final Coordinate revObsPoint=new Coordinate(obsPoint.getElement(1),obsPoint.getElement(0));
  final LinearLocation here=locationIndexedLine.project(revObsPoint);
  final Coordinate pointOnLine=locationIndexedLine.extractPoint(here);
  final Coordinate revOnLine=new Coordinate(pointOnLine.y,pointOnLine.x);
  return revOnLine;
}
Program: 189538
Project: 189538
Buggy source:
/** 
 * Returns the lineSegment in the geometry of the edge and the distance to the start of the segment on the entire path.
 * @param edge
 * @param distanceAlong
 * @return
 */
public static Entry<LineSegment,Double> getSegmentAndDistanceToStart(PathEdge edge,double distanceAlong){
  final boolean isNegative=distanceAlong < 0d;
  final Geometry geometry;
  final LengthIndexedLine lengthIdxLine;
  if (isNegative) {
    geometry=edge.getInferredEdge().getNegGeometry();
    lengthIdxLine=edge.getInferredEdge().getNegLengthIndexedLine();
  }
 else {
    geometry=edge.getInferredEdge().getPosGeometry();
    lengthIdxLine=edge.getInferredEdge().getPosLengthIndexedLine();
  }
  final double distAlongGeometry=Math.abs(distanceAlong - edge.getDistToStartOfEdge());
  final LinearLocation lineLocation=LengthLocationMap.getLocation(geometry,GeoUtils.getMetersInAngleDegrees(distAlongGeometry));
  final LineSegment lineSegment=lineLocation.getSegment(geometry);
  final double distanceToStartOfSegmentOnGeometry=GeoUtils.getAngleDegreesInMeters(lengthIdxLine.indexOf(lineSegment.p0));
  final double distanceToStartOfSegmentOnPath=distanceToStartOfSegmentOnGeometry + Math.abs(edge.getDistToStartOfEdge());
  return Maps.immutableEntry(lineSegment,distanceToStartOfSegmentOnPath);
}

Fixed version (ground truth):
/** 
 * Returns the lineSegment in the geometry of the edge and the distance-to-start of the segment on the entire path. The line segment is in the direction of the edge's geometry, and the distance-to-start has the same sign as the direction of movement.
 * @param edge
 * @param distanceAlong
 * @return
 */
public static Entry<LineSegment,Double> getSegmentAndDistanceToStart(PathEdge edge,double distanceAlong){
  final Geometry geometry=edge.getInferredEdge().getGeometry();
  final LengthIndexedLine lengthIdxLine=edge.getInferredEdge().getLengthIndexedLine();
  final double direction=distanceAlong >= 0d ? 1d : -1d;
  final double distAlongGeometry=distanceAlong - edge.getDistToStartOfEdge();
  final LinearLocation lineLocation=LengthLocationMap.getLocation(geometry,GeoUtils.getMetersInAngleDegrees(distAlongGeometry));
  final LineSegment lineSegment=lineLocation.getSegment(geometry);
  final Coordinate startOfSegmentCoord=direction < 0d ? lineSegment.p1 : lineSegment.p0;
  final double positiveDistToStartOfSegmentOnGeometry=lengthIdxLine.indexOf(startOfSegmentCoord);
  double distanceToStartOfSegmentOnPath;
  if (direction < 0d) {
    distanceToStartOfSegmentOnPath=geometry.getLength() - positiveDistToStartOfSegmentOnGeometry;
  }
 else {
    distanceToStartOfSegmentOnPath=positiveDistToStartOfSegmentOnGeometry;
  }
  distanceToStartOfSegmentOnPath=GeoUtils.getAngleDegreesInMeters(distanceToStartOfSegmentOnPath) + edge.getDistToStartOfEdge();
  return Maps.immutableEntry(lineSegment,distanceToStartOfSegmentOnPath);
}
Program: 189539
Project: 189539
Buggy source:
public static void convertToRoadBelief(MultivariateGaussian belief,PathEdge edge){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 2)   return;
  Preconditions.checkArgument(!edge.isEmptyEdge());
  final Vector m=belief.getMean().clone();
  final Matrix C=belief.getCovariance().clone();
  final Coordinate latlonCurrentPos=GeoUtils.convertToLatLon(Og.times(m));
  final LinearLocation lineLocation=edge.getInferredEdge().getPosLocationIndexedLine().project(GeoUtils.reverseCoordinates(latlonCurrentPos));
  final LineSegment lineSegment=lineLocation.getSegment(edge.getInferredEdge().getPosGeometry());
  final double distanceToStartOfSegmentOnGeometry=GeoUtils.getAngleDegreesInMeters(edge.getInferredEdge().getPosLengthIndexedLine().indexOf(lineSegment.p0));
  final double distanceToStartOfSegmentOnPath=distanceToStartOfSegmentOnGeometry + edge.getDistToStartOfEdge();
  final Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(lineSegment,distanceToStartOfSegmentOnPath);
  final Vector projMean=projPair.getKey().transpose().times(m.minus(projPair.getValue()));
  final Matrix projCov=projPair.getKey().transpose().times(C).times(projPair.getKey());
  belief.setMean(projMean);
  belief.setCovariance(projCov);
}

Fixed version (ground truth):
public static void convertToRoadBelief(MultivariateGaussian belief,PathEdge edge){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 2)   return;
  Preconditions.checkArgument(!edge.isEmptyEdge());
  final Vector m=belief.getMean().clone();
  final Matrix C=belief.getCovariance().clone();
  final Coordinate latlonCurrentPos=GeoUtils.convertToLatLon(Og.times(m));
  final LinearLocation lineLocation=edge.getInferredEdge().getLocationIndexedLine().project(GeoUtils.reverseCoordinates(latlonCurrentPos));
  final LineSegment lineSegment=lineLocation.getSegment(edge.getInferredEdge().getGeometry());
  final double distanceToStartOfSegmentOnGeometry=GeoUtils.getAngleDegreesInMeters(edge.getInferredEdge().getLengthIndexedLine().indexOf(lineSegment.p0));
  final double distanceToStartOfSegmentOnPath=distanceToStartOfSegmentOnGeometry + edge.getDistToStartOfEdge();
  final Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(lineSegment,distanceToStartOfSegmentOnPath);
  final Vector projMean=projPair.getKey().transpose().times(m.minus(projPair.getValue()));
  final Matrix projCov=projPair.getKey().transpose().times(C).times(projPair.getKey());
  belief.setMean(projMean);
  belief.setCovariance(projCov);
}
Program: 189541
Project: 189541
Buggy source:
@SuppressWarnings("String_Node_Str") public FilterInformation(InferredPath path,Collection<InferredPathEntry> evaluatedPaths,DataDistribution<VehicleState> resampleDist){
  this.path=path;
  this.evaluatedPaths=(Collection<InferredPathEntry>)Objects.firstNonNull(evaluatedPaths,Collections.emptyList());
  this.resampleDist=resampleDist;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public FilterInformation(Collection<InferredPathEntry> evaluatedPaths,DataDistribution<VehicleState> resampleDist){
  this.evaluatedPaths=(Collection<InferredPathEntry>)Objects.firstNonNull(evaluatedPaths,Collections.emptyList());
  this.resampleDist=resampleDist;
}
Program: 189542
Project: 189542
Buggy source:
public InferredEdge getInferredEdge(Edge edge){
  InferredEdge edgeInfo=edgeToInfo.get(edge);
  final Integer edgeId=graph.getIdForEdge(edge);
  if (edgeInfo == null) {
    edgeInfo=new InferredEdge(edge,edgeId,this);
    edgeToInfo.put(edge,edgeInfo);
  }
  return edgeInfo;
}

Fixed version (ground truth):
public InferredEdge getInferredEdge(Edge edge){
  VertexPair key=new VertexPair(edge.getFromVertex(),edge.getToVertex());
  InferredEdge edgeInfo=edgeToInfo.get(key);
  final Integer edgeId=graph.getIdForEdge(edge);
  if (edgeInfo == null) {
    edgeInfo=new InferredEdge(edge,edgeId,this);
    edgeToInfo.put(key,edgeInfo);
  }
  return edgeInfo;
}
Program: 189543
Project: 189543
Buggy source:
public InferredEdge getEdge(int id){
  final Edge edge=graph.getEdgeById(id);
  InferredEdge edgeInfo=edgeToInfo.get(edge);
  if (edgeInfo == null) {
    edgeInfo=new InferredEdge(edge,id,this);
    edgeToInfo.put(edge,edgeInfo);
  }
  return edgeInfo;
}

Fixed version (ground truth):
public InferredEdge getEdge(int id){
  final Edge edge=graph.getEdgeById(id);
  VertexPair key=new VertexPair(edge.getFromVertex(),edge.getToVertex());
  InferredEdge edgeInfo=edgeToInfo.get(key);
  if (edgeInfo == null) {
    edgeInfo=new InferredEdge(edge,id,this);
    edgeToInfo.put(key,edgeInfo);
  }
  return edgeInfo;
}
Program: 189544
Project: 189544
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((endCoord == null) ? 0 : endCoord.hashCode());
  result=prime * result + ((startCoord == null) ? 0 : startCoord.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((endVertex == null) ? 0 : endVertex.hashCode());
  result=prime * result + ((startVertex == null) ? 0 : startVertex.hashCode());
  return result;
}
Program: 189545
Project: 189545
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final PathKey other=(PathKey)obj;
  if (endCoord == null) {
    if (other.endCoord != null) {
      return false;
    }
  }
 else   if (!endCoord.equals(other.endCoord)) {
    return false;
  }
  if (startCoord == null) {
    if (other.startCoord != null) {
      return false;
    }
  }
 else   if (!startCoord.equals(other.startCoord)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  VertexPair other=(VertexPair)obj;
  if (endVertex == null) {
    if (other.endVertex != null) {
      return false;
    }
  }
 else   if (!endVertex.equals(other.endVertex)) {
    return false;
  }
  if (startVertex == null) {
    if (other.startVertex != null) {
      return false;
    }
  }
 else   if (!startVertex.equals(other.startVertex)) {
    return false;
  }
  return true;
}
Program: 189546
Project: 189546
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + edgeId + "String_Node_Str"+ endPoint+ "String_Node_Str"+ startPoint+ "String_Node_Str"+ length+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + edgeId + "String_Node_Str"+ length+ "String_Node_Str";
}
Program: 189547
Project: 189547
Buggy source:
/** 
 * XXX: the state must have a prior predictive mean.
 * @param obs
 * @param state
 * @return
 */
public InferredPathEntry getPredictiveLogLikelihood(Observation obs,VehicleState state){
  final MultivariateGaussian beliefPrediction=state.getBelief();
  final StandardRoadTrackingFilter filter=state.getMovementFilter();
  PathEdge prevEdge=PathEdge.getEdge(state.getInferredEdge());
  double pathLogLik=Double.NEGATIVE_INFINITY;
  final Map<PathEdge,DefaultWeightedValue<MultivariateGaussian>> edgeToPredictiveBeliefAndLogLikelihood=Maps.newHashMap();
  for (  final PathEdge edge : this.getEdges()) {
    final MultivariateGaussian edgeBelief=beliefPrediction.clone();
    if (edge == PathEdge.getEmptyPathEdge()) {
      filter.predict(edgeBelief,edge,prevEdge);
    }
 else {
      edge.predict(edgeBelief);
    }
    double localLogLik=state.getEdgeTransitionDist().predictiveLogLikelihood(prevEdge.getInferredEdge(),edge.getInferredEdge());
    localLogLik+=filter.logLikelihood(obs.getProjectedPoint(),edgeBelief,edge);
    Preconditions.checkArgument(!Double.isNaN(localLogLik));
    edgeToPredictiveBeliefAndLogLikelihood.put(edge,new DefaultWeightedValue<MultivariateGaussian>(edgeBelief.clone(),localLogLik));
    pathLogLik=LogMath.add(pathLogLik,localLogLik);
    prevEdge=edge;
  }
  return new InferredPathEntry(this,edgeToPredictiveBeliefAndLogLikelihood,filter,pathLogLik);
}

Fixed version (ground truth):
/** 
 * XXX: the state must have a prior predictive mean.
 * @param obs
 * @param state
 * @return
 */
public InferredPathEntry getPredictiveLogLikelihood(Observation obs,VehicleState state){
  final MultivariateGaussian beliefPrediction=state.getBelief();
  final StandardRoadTrackingFilter filter=state.getMovementFilter();
  PathEdge prevEdge=PathEdge.getEdge(state.getInferredEdge());
  double pathLogLik=Double.NEGATIVE_INFINITY;
  final Map<PathEdge,DefaultWeightedValue<MultivariateGaussian>> edgeToPredictiveBeliefAndLogLikelihood=Maps.newHashMap();
  for (  final PathEdge edge : this.getEdges()) {
    final MultivariateGaussian edgeBelief=beliefPrediction.clone();
    final double edgePredMarginalLogLik;
    if (edge == PathEdge.getEmptyPathEdge()) {
      filter.predict(edgeBelief,edge,prevEdge);
      edgePredMarginalLogLik=Double.NEGATIVE_INFINITY;
    }
 else {
      edge.predict(edgeBelief,obs);
      edgePredMarginalLogLik=edge.marginalPredictiveLogLikelihood(beliefPrediction);
    }
    final double edgePredTransLogLik=state.getEdgeTransitionDist().predictiveLogLikelihood(prevEdge.getInferredEdge(),edge.getInferredEdge());
    final double localPosVelPredLogLik=filter.logLikelihood(obs.getProjectedPoint(),edgeBelief,edge);
    final double localLogLik=edgePredMarginalLogLik + edgePredTransLogLik + localPosVelPredLogLik;
    Preconditions.checkArgument(!Double.isNaN(localLogLik));
    edgeToPredictiveBeliefAndLogLikelihood.put(edge,new DefaultWeightedValue<MultivariateGaussian>(edgeBelief.clone(),localLogLik));
    pathLogLik=LogMath.add(pathLogLik,localLogLik);
    prevEdge=edge;
  }
  return new InferredPathEntry(this,edgeToPredictiveBeliefAndLogLikelihood,filter,pathLogLik);
}
Program: 189548
Project: 189548
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + edges + "String_Node_Str"+ totalPathDistance+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + edgeIds + "String_Node_Str"+ totalPathDistance+ "String_Node_Str";
}
Program: 189549
Project: 189549
Buggy source:
/** 
 * This method truncates the given belief over the interval defined by this edge.
 * @param belief
 */
public void predict(MultivariateGaussian belief){
  StandardRoadTrackingFilter.convertToRoadBelief(belief,this);
  final Matrix Or=StandardRoadTrackingFilter.getOr();
  final double S=Or.times(belief.getCovariance()).times(Or.transpose()).getElement(0,0) + Math.pow(edge.getLength() / Math.sqrt(12),2);
  final Matrix W=belief.getCovariance().times(Or.transpose()).scale(1 / S);
  final Matrix R=belief.getCovariance().minus(W.times(W.transpose()).scale(S));
  final double mean=(distToStartOfEdge + edge.getLength()) / 2d;
  final double e=mean - Or.times(belief.getMean()).getElement(0);
  final Vector a=belief.getMean().plus(W.getColumn(0).scale(e));
  belief.setMean(a);
  belief.setCovariance(R);
}

Fixed version (ground truth):
/** 
 * This method truncates the given belief over the interval defined by this edge.
 * @param belief
 */
public void predict(MultivariateGaussian belief,Observation obs){
  StandardRoadTrackingFilter.convertToRoadBelief(belief,this);
  final Matrix Or=StandardRoadTrackingFilter.getOr();
  final double S=Or.times(belief.getCovariance()).times(Or.transpose()).getElement(0,0) + Math.pow(edge.getLength() / Math.sqrt(12),2);
  final Matrix W=belief.getCovariance().times(Or.transpose()).scale(1 / S);
  final Matrix R=belief.getCovariance().minus(W.times(W.transpose()).scale(S));
  final boolean isPositive=belief.getMean().getElement(0) >= 0d;
  final double mean=(distToStartOfEdge + (isPositive ? 1d : -1d) * edge.getLength()) / 2d;
  final double e=mean - Or.times(belief.getMean()).getElement(0);
  final Vector a=belief.getMean().plus(W.getColumn(0).scale(e));
  belief.setMean(a);
  belief.setCovariance(R);
}
Program: 189550
Project: 189550
Buggy source:
public double marginalPredictiveLogLikelihood(MultivariateGaussian beliefPrediction,double direction){
  Preconditions.checkArgument(beliefPrediction.getInputDimensionality() == 2);
  final Matrix Or=StandardRoadTrackingFilter.getOr();
  final double variance=Math.sqrt(Or.times(beliefPrediction.getCovariance()).times(Or.transpose()).getElement(0,0));
  final double mean=Or.times(beliefPrediction.getMean()).getElement(0);
  final double endDist=direction * edge.getLength() + this.distToStartOfEdge;
  final double result=UnivariateGaussian.CDF.evaluate(endDist,mean,variance) - UnivariateGaussian.CDF.evaluate(this.distToStartOfEdge,mean,variance);
  return Math.log(result);
}

Fixed version (ground truth):
public double marginalPredictiveLogLikelihood(MultivariateGaussian beliefPrediction,double direction){
  Preconditions.checkArgument(beliefPrediction.getInputDimensionality() == 2);
  final Matrix Or=StandardRoadTrackingFilter.getOr();
  final double variance=Or.times(beliefPrediction.getCovariance()).times(Or.transpose()).getElement(0,0);
  final double mean=Or.times(beliefPrediction.getMean()).getElement(0);
  final double endDist=direction * edge.getLength() + this.distToStartOfEdge;
  final double result=UnivariateGaussian.CDF.evaluate(endDist,mean,variance) - UnivariateGaussian.CDF.evaluate(this.distToStartOfEdge,mean,variance);
  return Math.log(result);
}
Program: 189552
Project: 189552
Buggy source:
public MultiDestinationAStar(Graph graph,List<Edge> end,Coordinate center,double radius,Edge start){
  this.graph=graph;
  this.end=end;
  this.center=center;
  this.radius=radius;
  this.start=start;
}

Fixed version (ground truth):
public MultiDestinationAStar(Graph graph,Set<Edge> endEdges,Coordinate center,double radius,Edge start){
  this.graph=graph;
  this.end=new HashSet<Edge>(endEdges);
  this.center=center;
  this.radius=radius;
  this.start=start;
}
Program: 189553
Project: 189553
Buggy source:
public ShortestPathTree getSPT(boolean arriveBy){
  final GenericAStar astar=new GenericAStar();
  astar.setSearchTerminationStrategy(this);
  astar.setSkipTraverseResultStrategy(this);
  final RoutingRequest req=new RoutingRequest();
  req.setArriveBy(arriveBy);
  final Vertex startVertex=arriveBy ? start.getToVertex() : start.getFromVertex();
  final String bogusName="String_Node_Str" + Thread.currentThread().getId();
  final Vertex bogus=new IntersectionVertex(graph,bogusName,startVertex.getCoordinate(),bogusName);
  if (!arriveBy) {
    req.setRoutingContext(graph,startVertex,bogus);
  }
 else {
    req.setRoutingContext(graph,bogus,startVertex);
  }
  req.rctx.remainingWeightHeuristic=this;
  final ShortestPathTree result=astar.getShortestPathTree(req);
  graph.removeVertex(bogus);
  req.cleanup();
  return result;
}

Fixed version (ground truth):
public ShortestPathTree getSPT(boolean arriveBy){
  final GenericAStar astar=new GenericAStar();
  astar.setSearchTerminationStrategy(this);
  astar.setSkipTraverseResultStrategy(this);
  astar.setTraverseVisitor(this);
  final RoutingRequest req=new RoutingRequest(TraverseMode.CAR);
  req.setArriveBy(arriveBy);
  final Vertex startVertex=arriveBy ? start.getToVertex() : start.getFromVertex();
  final String bogusName="String_Node_Str" + Thread.currentThread().getId();
  final Vertex bogus=new IntersectionVertex(graph,bogusName,startVertex.getCoordinate(),bogusName);
  if (!arriveBy) {
    req.setRoutingContext(graph,startVertex,bogus);
  }
 else {
    req.setRoutingContext(graph,bogus,startVertex);
  }
  req.rctx.remainingWeightHeuristic=this;
  final ShortestPathTree result=astar.getShortestPathTree(req);
  graph.removeVertex(bogus);
  req.cleanup();
  return result;
}
Program: 189554
Project: 189554
Buggy source:
@Override public double computeForwardWeight(State s,Vertex target){
  final Vertex v=s.getVertex();
  final double distance=DistanceLibrary.fastDistance(v.getCoordinate(),center) - radius;
  return distance / MAX_SPEED;
}

Fixed version (ground truth):
@Override public double computeForwardWeight(State s,Vertex target){
  final Vertex v=s.getVertex();
  double distance=DistanceLibrary.fastDistance(v.getCoordinate(),center) - radius;
  if (distance < 0)   distance=0;
  return distance / MAX_SPEED;
}
Program: 189555
Project: 189555
Buggy source:
@Override public boolean shouldSearchContinue(Vertex origin,Vertex target,State current,ShortestPathTree spt,RoutingRequest traverseOptions){
  end.remove(current.getBackEdge());
  return end.size() != 0;
}

Fixed version (ground truth):
@Override public boolean shouldSearchContinue(Vertex origin,Vertex target,State current,ShortestPathTree spt,RoutingRequest traverseOptions){
  return end.size() != 0;
}
Program: 189556
Project: 189556
Buggy source:
@SuppressWarnings("String_Node_Str") public FilterInformation(Collection<InferredPathEntry> evaluatedPaths,DataDistribution<VehicleState> resampleDist){
  this.evaluatedPaths=(Collection<InferredPathEntry>)Objects.firstNonNull(evaluatedPaths,Collections.emptyList());
  this.resampleDist=resampleDist;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public FilterInformation(Set<InferredPath> evaluatedPaths,DataDistribution<VehicleState> resampleDist){
  this.evaluatedPaths=(Set<InferredPath>)Objects.firstNonNull(evaluatedPaths,Collections.emptySet());
  this.resampleDist=resampleDist;
}
Program: 189557
Project: 189557
Buggy source:
public Collection<InferredPathEntry> getEvaluatedPaths(){
  return evaluatedPaths;
}

Fixed version (ground truth):
public Set<InferredPath> getEvaluatedPaths(){
  return evaluatedPaths;
}