nus-yam/ex-repair huggingface dataset:
Program: 189451
Project: 189451
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (!super.equals(obj)) {
    return false;
  }
  if (this.getClass() != obj.getClass()) {
    return false;
  }
  final PathStateDistribution other=(PathStateDistribution)obj;
  if (this.pathState == null) {
    if (other.pathState != null) {
      return false;
    }
  }
 else   if (!this.pathState.equals(other.pathState)) {
    return false;
  }
  if (this.distribution == null) {
    if (other.distribution != null) {
      return false;
    }
  }
 else   if (!this.distribution.equals(other.distribution)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (!super.equals(obj)) {
    return false;
  }
  if (this.getClass() != obj.getClass()) {
    return false;
  }
  final PathStateDistribution other=(PathStateDistribution)obj;
  if (this.pathState == null) {
    if (other.pathState != null) {
      return false;
    }
  }
 else   if (!this.pathState.equals(other.pathState)) {
    return false;
  }
  if (this.motionDistribution == null) {
    if (other.motionDistribution != null) {
      return false;
    }
  }
 else   if (!this.motionDistribution.equals(other.motionDistribution)) {
    return false;
  }
  return true;
}
Program: 189452
Project: 189452
Buggy source:
@Override public PathStateDistribution clone(){
  final PathStateDistribution clone=(PathStateDistribution)super.clone();
  clone.path=ObjectUtil.cloneSmart(this.path);
  clone.pathState=ObjectUtil.cloneSmart(this.pathState);
  clone.distribution=this.distribution.clone();
  clone.groundBelief=ObjectUtil.cloneSmart(this.groundBelief);
  clone.localStateBelief=ObjectUtil.cloneSmart(this.localStateBelief);
  return clone;
}

Fixed version (ground truth):
@Override public PathStateDistribution clone(){
  final PathStateDistribution clone=(PathStateDistribution)super.clone();
  clone.path=ObjectUtil.cloneSmart(this.path);
  clone.pathState=ObjectUtil.cloneSmart(this.pathState);
  clone.motionDistribution=this.motionDistribution.clone();
  clone.groundDistribution=ObjectUtil.cloneSmart(this.groundDistribution);
  clone.edgeDistribution=ObjectUtil.cloneSmart(this.edgeDistribution);
  return clone;
}
Program: 189453
Project: 189453
Buggy source:
/** 
 * Updates the internal distribution to correspond to the argument projected onto the current edge.
 * @param newGroundDist
 */
public void setGroundDistribution(MultivariateGaussian newGroundDist){
  Preconditions.checkArgument(newGroundDist.getInputDimensionality() == 4);
  if (!this.path.isNullPath()) {
    this.distribution=PathUtils.getRoadBeliefFromGround(newGroundDist,this.pathState.getEdge(),true);
    this.pathState=new PathState(this.pathState.getPath(),this.distribution.getMean());
  }
  this.groundBelief=newGroundDist;
}

Fixed version (ground truth):
/** 
 * Updates the internal distribution to correspond to the argument projected onto the current edge.
 * @param newGroundDist
 */
public void setGroundDistribution(MultivariateGaussian newGroundDist){
  Preconditions.checkArgument(newGroundDist.getInputDimensionality() == 4);
  if (!this.path.isNullPath()) {
    this.motionDistribution=PathUtils.getRoadBeliefFromGround(newGroundDist,this.pathState.getEdge(),true);
  }
 else {
    this.motionDistribution=newGroundDist;
  }
  this.pathState=new PathState(this.pathState.getPath(),this.motionDistribution.getMean());
  this.groundDistribution=newGroundDist;
  this.edgeDistribution=null;
}
Program: 189454
Project: 189454
Buggy source:
@Override public String toString(){
  ToStringBuilder builder=new ToStringBuilder(this,ToStringStyle.SHORT_PREFIX_STYLE);
  builder.append("String_Node_Str",distribution);
  builder.append("String_Node_Str",path);
  return builder.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  ToStringBuilder builder=new ToStringBuilder(this,ToStringStyle.SHORT_PREFIX_STYLE);
  builder.append("String_Node_Str",motionDistribution);
  builder.append("String_Node_Str",path);
  return builder.toString();
}
Program: 189455
Project: 189455
Buggy source:
public PathStateDistribution(PathStateDistribution pathStateDistribution){
  this.pathState=pathStateDistribution.pathState;
  this.path=pathStateDistribution.path;
  this.distribution=pathStateDistribution.distribution;
  this.groundBelief=pathStateDistribution.groundBelief;
  this.localStateBelief=pathStateDistribution.localStateBelief;
}

Fixed version (ground truth):
public PathStateDistribution(PathStateDistribution pathStateDistribution){
  this.pathState=pathStateDistribution.pathState;
  this.path=pathStateDistribution.path;
  this.motionDistribution=pathStateDistribution.motionDistribution;
  this.groundDistribution=pathStateDistribution.groundDistribution;
  this.edgeDistribution=pathStateDistribution.edgeDistribution;
}
Program: 189456
Project: 189456
Buggy source:
/** 
 * This method gets the predictive/observation/measurement belief, i.e. the measurement model applied to the given state belief.
 * @param belief
 * @param edge
 * @return
 */
public MultivariateGaussian getMeasurementBelief(final PathStateDistribution stateBelief){
  final MultivariateGaussian projBelief=stateBelief.getGroundBelief().clone();
  final Matrix Q=MotionStateEstimatorPredictor.Og.times(projBelief.getCovariance()).times(MotionStateEstimatorPredictor.Og.transpose());
  Q.plusEquals(this.groundFilter.getMeasurementCovariance());
  final MultivariateGaussian res=this.groundFilter.createInitialLearnedObject();
  res.setMean(MotionStateEstimatorPredictor.Og.times(projBelief.getMean()));
  res.setCovariance(Q);
  return res;
}

Fixed version (ground truth):
/** 
 * This method gets the predictive/observation/measurement belief, i.e. the measurement model applied to the given state belief.
 * @param belief
 * @param edge
 * @return
 */
public MultivariateGaussian getMeasurementBelief(final PathStateDistribution stateBelief){
  final MultivariateGaussian projBelief=stateBelief.getGroundDistribution().clone();
  final Matrix Q=MotionStateEstimatorPredictor.Og.times(projBelief.getCovariance()).times(MotionStateEstimatorPredictor.Og.transpose());
  Q.plusEquals(this.groundFilter.getMeasurementCovariance());
  final MultivariateGaussian res=this.groundFilter.createInitialLearnedObject();
  res.setMean(MotionStateEstimatorPredictor.Og.times(projBelief.getMean()));
  res.setCovariance(Q);
  return res;
}
Program: 189457
Project: 189457
Buggy source:
@Override public void update(PathStateDistribution prior,Vector data){
  if (prior.getPathState().isOnRoad()) {
    if (!this.path.isOnPath(prior.getMean().getElement(0))) {
      prior.getMean().setElement(0,prior.getPathState().getPath().clampToPath(prior.getMean().getElement(0)));
    }
  }
}

Fixed version (ground truth):
@Override public void update(PathStateDistribution prior,Vector data){
  Preconditions.checkArgument(prior.getPathState().getPath().equals(this.path));
  if (prior.getPathState().isOnRoad()) {
    if (!this.path.isOnPath(prior.getMean().getElement(0))) {
      final Vector mean=prior.getMean().clone();
      mean.setElement(0,prior.getPathState().getPath().clampToPath(prior.getMean().getElement(0)));
      prior.setMean(mean);
    }
  }
}
Program: 189458
Project: 189458
Buggy source:
@Override public SimpleBayesianParameter<ParameterType,ConditionalType,PriorType> clone(){
  SimpleBayesianParameter<ParameterType,ConditionalType,PriorType> clone=(SimpleBayesianParameter<ParameterType,ConditionalType,PriorType>)super.clone();
  clone.conditional=ObjectUtil.cloneSmart(this.conditional);
  clone.prior=ObjectUtil.cloneSmart(this.prior);
  clone.value=ObjectUtil.cloneSmart(this.value);
  clone.name=this.name;
  return clone;
}

Fixed version (ground truth):
/** 
 * Shallow clone.  Deep copies in here can be expensive.
 */
@Override public SimpleBayesianParameter<ParameterType,ConditionalType,PriorType> clone(){
  SimpleBayesianParameter<ParameterType,ConditionalType,PriorType> clone=(SimpleBayesianParameter<ParameterType,ConditionalType,PriorType>)super.clone();
  clone.conditional=this.conditional;
  clone.prior=this.prior;
  clone.value=this.value;
  clone.name=this.name;
  return clone;
}
Program: 189459
Project: 189459
Buggy source:
@Override public double getPriorWeightSum(){
  if (priorWeights.length == 1)   return priorWeights[0];
  double logSum=priorWeights[0];
  for (int i=1; i < priorWeights.length; i++) {
    logSum=LogMath.add(logSum,priorWeights[i]);
  }
  return logSum;
}

Fixed version (ground truth):
@Override public double getPriorWeightSum(){
  if (priorWeights.length <= 0)   return Double.NEGATIVE_INFINITY;
  if (priorWeights.length == 1)   return priorWeights[0];
  double logSum=priorWeights[0];
  for (int i=1; i < priorWeights.length; i++) {
    logSum=LogMath.add(logSum,priorWeights[i]);
  }
  return logSum;
}
Program: 189461
Project: 189461
Buggy source:
public VehicleStatePLFilter(O obs,InferenceGraph inferredGraph,VehicleStateInitialParameters parameters,Boolean isDebug,Random rng){
  this.inferredGraph=inferredGraph;
  this.isDebug=isDebug;
  this.setUpdater(new VehicleStatePLUpdater<O>(obs,inferredGraph,parameters,rng));
}

Fixed version (ground truth):
public VehicleStatePLFilter(O obs,InferenceGraph inferredGraph,VehicleStateInitialParameters parameters,Boolean isDebug,Random rng){
  this.inferredGraph=inferredGraph;
  this.isDebug=isDebug;
  this.setUpdater(new VehicleStatePLUpdater<O>(obs,inferredGraph,parameters,rng));
  this.setNumParticles(parameters.getNumParticles());
  this.setRandom(rng);
}
Program: 189463
Project: 189463
Buggy source:
public MultivariateGaussian getLocalStateBelief(){
  if (this.pathState.isOnRoad()) {
    return this.distribution;
  }
 else {
    final Vector mean=Preconditions.checkNotNull(this.pathState.getEdge().getCheckedStateOnEdge(this.distribution.getMean(),MotionStateEstimatorPredictor.getEdgeLengthErrorTolerance(),true));
    final MultivariateGaussian localStateBelief=this.distribution.clone();
    localStateBelief.setMean(mean);
    return localStateBelief;
  }
}

Fixed version (ground truth):
public MultivariateGaussian getLocalStateBelief(){
  if (!this.pathState.isOnRoad()) {
    return this.distribution;
  }
 else {
    if (this.localStateBelief == null) {
      final Vector mean=Preconditions.checkNotNull(this.pathState.getEdge().getCheckedStateOnEdge(this.distribution.getMean(),MotionStateEstimatorPredictor.getEdgeLengthErrorTolerance(),true));
      final MultivariateGaussian localStateBelief=this.distribution.clone();
      localStateBelief.setMean(mean);
      this.localStateBelief=localStateBelief;
    }
    return localStateBelief;
  }
}
Program: 189464
Project: 189464
Buggy source:
public MultivariateGaussian getGroundBelief(){
  if (!this.pathState.isOnRoad()) {
    return this.distribution;
  }
  if (this.groundBelief == null) {
    this.groundBelief=PathUtils.getGroundBeliefFromRoad(this.distribution,this.pathState.getEdge(),true);
  }
  return this.groundBelief;
}

Fixed version (ground truth):
public MultivariateGaussian getGroundBelief(){
  if (!this.pathState.isOnRoad()) {
    return this.distribution;
  }
  if (this.groundBelief == null) {
    this.groundBelief=PathUtils.getGroundBeliefFromRoad(this.distribution,this.pathState.getEdge(),false,true);
  }
  return this.groundBelief;
}
Program: 189465
Project: 189465
Buggy source:
@Override public PathStateDistribution clone(){
  final PathStateDistribution clone=(PathStateDistribution)super.clone();
  clone.path=ObjectUtil.cloneSmart(this.path);
  clone.pathState=ObjectUtil.cloneSmart(this.pathState);
  clone.distribution=this.distribution.clone();
  clone.groundBelief=ObjectUtil.cloneSmart(this.groundBelief);
  return clone;
}

Fixed version (ground truth):
@Override public PathStateDistribution clone(){
  final PathStateDistribution clone=(PathStateDistribution)super.clone();
  clone.path=ObjectUtil.cloneSmart(this.path);
  clone.pathState=ObjectUtil.cloneSmart(this.pathState);
  clone.distribution=this.distribution.clone();
  clone.groundBelief=ObjectUtil.cloneSmart(this.groundBelief);
  clone.localStateBelief=ObjectUtil.cloneSmart(this.localStateBelief);
  return clone;
}
Program: 189466
Project: 189466
Buggy source:
@Override public String toString(){
  ToStringBuilder builder=new ToStringBuilder(this);
  builder.append("String_Node_Str",distribution);
  builder.append("String_Node_Str",path);
  return builder.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  ToStringBuilder builder=new ToStringBuilder(this,ToStringStyle.SHORT_PREFIX_STYLE);
  builder.append("String_Node_Str",distribution);
  builder.append("String_Node_Str",path);
  return builder.toString();
}
Program: 189467
Project: 189467
Buggy source:
public PathStateDistribution(PathStateDistribution pathStateDistribution){
  this.pathState=pathStateDistribution.pathState;
  this.path=pathStateDistribution.path;
  this.distribution=pathStateDistribution.distribution;
  this.groundBelief=pathStateDistribution.groundBelief;
}

Fixed version (ground truth):
public PathStateDistribution(PathStateDistribution pathStateDistribution){
  this.pathState=pathStateDistribution.pathState;
  this.path=pathStateDistribution.path;
  this.distribution=pathStateDistribution.distribution;
  this.groundBelief=pathStateDistribution.groundBelief;
  this.localStateBelief=pathStateDistribution.localStateBelief;
}
Program: 189468
Project: 189468
Buggy source:
public PDF(PathStateMixtureDensityModel<? extends DistributionType> other){
  super(other);
}

Fixed version (ground truth):
public PDF(PathStateMixtureDensityModel other){
  super(other);
}
Program: 189469
Project: 189469
Buggy source:
@Override public PathStateMixtureDensityModel.PDF<DistributionType> getProbabilityFunction(){
  return new PathStateMixtureDensityModel.PDF<DistributionType>(this);
}

Fixed version (ground truth):
@Override public PathStateMixtureDensityModel.PDF getProbabilityFunction(){
  return new PathStateMixtureDensityModel.PDF(this);
}
Program: 189470
Project: 189470
Buggy source:
public PathStateMixtureDensityModel(PathStateMixtureDensityModel<? extends DistributionType> other){
  this(ObjectUtil.cloneSmartElementsAsArrayList(other.getDistributions()),ObjectUtil.deepCopy(other.getPriorWeights()));
}

Fixed version (ground truth):
public PathStateMixtureDensityModel(PathStateMixtureDensityModel other){
  this(ObjectUtil.cloneSmartElementsAsArrayList(other.getDistributions()),ObjectUtil.deepCopy(other.getPriorWeights()));
}
Program: 189471
Project: 189471
Buggy source:
@Override public PathStateMixtureDensityModel<DistributionType> clone(){
  final PathStateMixtureDensityModel<DistributionType> clone=(PathStateMixtureDensityModel<DistributionType>)super.clone();
  return clone;
}

Fixed version (ground truth):
@Override public PathStateMixtureDensityModel clone(){
  final PathStateMixtureDensityModel clone=(PathStateMixtureDensityModel)super.clone();
  return clone;
}
Program: 189472
Project: 189472
Buggy source:
/** 
 * Returns the first highest-probability path edge and its mean location, as a path state, naturally.
 */
@Override public PathState getMean(){
  final Map<PathEdge,RingAccumulator<Vector>> edgeToMean=Maps.newHashMap();
  final Map<PathEdge,DataDistribution<Path>> edgeToPaths=Maps.newHashMap();
  final int K=this.getDistributionCount();
  final DefaultDataDistribution<PathEdge> edgeDist=new DefaultDataDistribution<PathEdge>();
  for (int k=0; k < K; k++) {
    final double priorWeight=this.getPriorWeights()[k];
    final DistributionType dist=this.getDistributions().get(k);
    PathEdge edge=dist.getMean().getEdge();
    edgeDist.increment(edge,priorWeight);
    Path path=dist.getMean().getPath();
    DataDistribution<Path> pathDist=edgeToPaths.get(path);
    if (pathDist == null) {
      pathDist=new DefaultDataDistribution<Path>();
      pathDist.increment(path,priorWeight);
    }
    RingAccumulator<Vector> mean=edgeToMean.get(edge);
    if (mean == null) {
      mean=new RingAccumulator<Vector>();
      edgeToMean.put(edge,mean);
    }
    mean.accumulate(dist.getMean().scale(priorWeight));
  }
  final PathEdge bestEdge=edgeDist.getMaxValueKey();
  final Path bestPath=edgeToPaths.get(bestEdge).getMaxValueKey();
  final RingAccumulator<Vector> mean=edgeToMean.get(bestEdge);
  return new PathState(bestPath,mean.getMean());
}

Fixed version (ground truth):
/** 
 * Returns the first highest-probability path edge and its mean location, as a path state, naturally.
 */
@Override public PathState getMean(){
  final Map<PathEdge,RingAccumulator<Vector>> edgeToMean=Maps.newHashMap();
  final Map<PathEdge,DataDistribution<Path>> edgeToPaths=Maps.newHashMap();
  final int K=this.getDistributionCount();
  final DefaultDataDistribution<PathEdge> edgeDist=new DefaultDataDistribution<PathEdge>();
  for (int k=0; k < K; k++) {
    final double priorWeight=this.getPriorWeights()[k];
    final PathStateDistribution dist=this.getDistributions().get(k);
    PathEdge edge=dist.getMean().getEdge();
    edgeDist.increment(edge,priorWeight);
    Path path=dist.getMean().getPath();
    DataDistribution<Path> pathDist=edgeToPaths.get(path);
    if (pathDist == null) {
      pathDist=new DefaultDataDistribution<Path>();
      pathDist.increment(path,priorWeight);
    }
    RingAccumulator<Vector> mean=edgeToMean.get(edge);
    if (mean == null) {
      mean=new RingAccumulator<Vector>();
      edgeToMean.put(edge,mean);
    }
    mean.accumulate(dist.getMean().scale(priorWeight));
  }
  final PathEdge bestEdge=edgeDist.getMaxValueKey();
  final Path bestPath=edgeToPaths.get(bestEdge).getMaxValueKey();
  final RingAccumulator<Vector> mean=edgeToMean.get(bestEdge);
  return new PathState(bestPath,mean.getMean());
}
Program: 189473
Project: 189473
Buggy source:
@Override public double cost(AStarNode n1,AStarNode n2){
  final BasicDirectedNode dn1=(BasicDirectedNode)n1.getNode();
  final BasicDirectedNode dn2=(BasicDirectedNode)n2.getNode();
  if (dn1.getOutEdge(dn2) == null)   return Double.POSITIVE_INFINITY;
  return 0d;
}

Fixed version (ground truth):
@Override public double cost(AStarNode n1,AStarNode n2){
  final BasicDirectedNode dn1=(BasicDirectedNode)n1.getNode();
  final BasicDirectedNode dn2=(BasicDirectedNode)n2.getNode();
  Edge edgeBetween=dn1.getOutEdge(dn2);
  if (edgeBetween == null)   return Double.POSITIVE_INFINITY;
  return 0d;
}
Program: 189477
Project: 189477
Buggy source:
@Override public double h(Node n){
  final double distance=((XYNode)n).getCoordinate().distance(toCoord);
  if (distance < obsStdDevDistance)   return 0d;
  return (distance - obsStdDevDistance) / 15d;
}

Fixed version (ground truth):
@Override public double h(Node n){
  final double distance=((Point)n.getObject()).getCoordinate().distance(toCoord);
  if (distance < obsStdDevDistance)   return 0d;
  return (distance - obsStdDevDistance) / 15d;
}
Program: 189479
Project: 189479
Buggy source:
/** 
 * The given collection of lines should be in GPS coordinates, since they will be projected here.
 * @param lines
 */
public GenericJTSGraph(Collection<LineString> lines){
  graphGenerator=new DirectedLineStringGraphGenerator();
  for (  LineString edge : lines) {
    gpsEnv.expandToInclude(edge.getEnvelopeInternal());
    final MathTransform transform=GeoUtils.getTransform(edge.getCoordinate());
    Geometry projectedEdge;
    try {
      projectedEdge=JTS.transform(edge,transform);
      projEnv.expandToInclude(projectedEdge.getEnvelopeInternal());
      graphGenerator.add(projectedEdge);
      edgeIndex.insert(projectedEdge.getEnvelopeInternal(),projectedEdge);
    }
 catch (    final TransformException e) {
      e.printStackTrace();
    }
  }
  edgeIndex.build();
}

Fixed version (ground truth):
/** 
 * The given collection of lines should be in GPS coordinates, since they will be projected here.
 * @param lines
 */
public GenericJTSGraph(Collection<LineString> lines){
  graphGenerator=new DirectedLineStringGraphGenerator();
  for (  LineString edge : lines) {
    gpsEnv.expandToInclude(edge.getEnvelopeInternal());
    final MathTransform transform=GeoUtils.getTransform(edge.getCoordinate());
    Geometry projectedEdge;
    try {
      projectedEdge=JTS.transform(edge,transform);
      projectedEdge.setUserData(edge.getCoordinate());
      projEnv.expandToInclude(projectedEdge.getEnvelopeInternal());
      graphGenerator.add(projectedEdge);
      edgeIndex.insert(projectedEdge.getEnvelopeInternal(),projectedEdge);
    }
 catch (    final TransformException e) {
      e.printStackTrace();
    }
  }
  edgeIndex.build();
}
Program: 189480
Project: 189480
Buggy source:
/** 
 * From http://gis.stackexchange.com/questions/28986/geotoolkit-conversion-from -lat-long-to-utm
 */
public static int getEPSGCodefromUTS(Coordinate refLonLat){
  int epsg_code=32600;
  if (refLonLat.y < 0) {
    epsg_code+=100;
  }
  epsg_code+=getUTMZoneForLongitude(refLonLat.x);
  return epsg_code;
}

Fixed version (ground truth):
/** 
 * From http://gis.stackexchange.com/questions/28986/geotoolkit-conversion-from -lat-long-to-utm
 */
public static int getEPSGCodefromUTS(Coordinate refLatLon){
  int epsg_code=32600;
  if (refLatLon.x < 0) {
    epsg_code+=100;
  }
  epsg_code+=getUTMZoneForLongitude(refLatLon.y);
  return epsg_code;
}
Program: 189481
Project: 189481
Buggy source:
public static MathTransform getTransform(Coordinate refLonLat){
  try {
    final CRSAuthorityFactory crsAuthorityFactory=CRS.getAuthorityFactory(true);
    final GeographicCRS geoCRS=crsAuthorityFactory.createGeographicCRS("String_Node_Str");
    final CoordinateReferenceSystem dataCRS=crsAuthorityFactory.createCoordinateReferenceSystem("String_Node_Str" + getEPSGCodefromUTS(refLonLat));
    final MathTransform transform=CRS.findMathTransform(geoCRS,dataCRS);
    return transform;
  }
 catch (  final NoSuchIdentifierException e) {
    e.printStackTrace();
  }
catch (  final FactoryException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public static MathTransform getTransform(Coordinate refLatLon){
  try {
    final CRSAuthorityFactory crsAuthorityFactory=CRS.getAuthorityFactory(false);
    final GeographicCRS geoCRS=crsAuthorityFactory.createGeographicCRS("String_Node_Str");
    final CoordinateReferenceSystem dataCRS=crsAuthorityFactory.createCoordinateReferenceSystem("String_Node_Str" + getEPSGCodefromUTS(refLatLon));
    final MathTransform transform=CRS.findMathTransform(geoCRS,dataCRS);
    return transform;
  }
 catch (  final NoSuchIdentifierException e) {
    e.printStackTrace();
  }
catch (  final FactoryException e) {
    e.printStackTrace();
  }
  return null;
}
Program: 189482
Project: 189482
Buggy source:
@BeforeTest public void setUp() throws NoSuchAuthorityCodeException, FactoryRegistryException, FactoryException, IOException {
  List<LineString> edges=Lists.newArrayList();
  CoordinateReferenceSystem crs=CRS.getAuthorityFactory(true).createGeographicCRS("String_Node_Str");
  startCoord=new Coordinate(40.7549,-73.97749);
  Envelope tmpEnv=new Envelope(startCoord);
  final double appMeter=GeoUtils.getMetersInAngleDegrees(1d);
  tmpEnv.expandBy(appMeter * 10e3);
  ReferencedEnvelope gridBounds=new ReferencedEnvelope(tmpEnv.getMinX(),tmpEnv.getMaxX(),tmpEnv.getMinY(),tmpEnv.getMaxY(),crs);
  List<OrthoLineDef> lineDefs=Arrays.asList(new OrthoLineDef(LineOrientation.VERTICAL,1,appMeter * 100d),new OrthoLineDef(LineOrientation.HORIZONTAL,1,appMeter * 100d));
  SimpleFeatureSource grid=Lines.createOrthoLines(gridBounds,lineDefs);
  FeatureIterator iter=grid.getFeatures().features();
  while (iter.hasNext()) {
    Feature feature=iter.next();
    LineString geom=(LineString)feature.getDefaultGeometryProperty().getValue();
    edges.add(geom);
    edges.add((LineString)geom.reverse());
  }
  graph=new GenericJTSGraph(edges);
  avgTransform=MatrixFactory.getDefault().copyArray(new double[][]{{1,0,1,0},{0,1,0,1}}).scale(1d / 2d);
}

Fixed version (ground truth):
@BeforeTest public void setUp() throws NoSuchAuthorityCodeException, FactoryRegistryException, FactoryException, IOException {
  List<LineString> edges=Lists.newArrayList();
  CoordinateReferenceSystem crs=CRS.getAuthorityFactory(false).createGeographicCRS("String_Node_Str");
  startCoord=new Coordinate(40.7549,-73.97749);
  Envelope tmpEnv=new Envelope(startCoord);
  final double appMeter=GeoUtils.getMetersInAngleDegrees(1d);
  tmpEnv.expandBy(appMeter * 10e3);
  ReferencedEnvelope gridBounds=new ReferencedEnvelope(tmpEnv.getMinX(),tmpEnv.getMaxX(),tmpEnv.getMinY(),tmpEnv.getMaxY(),crs);
  List<OrthoLineDef> lineDefs=Arrays.asList(new OrthoLineDef(LineOrientation.VERTICAL,1,appMeter * 100d),new OrthoLineDef(LineOrientation.HORIZONTAL,1,appMeter * 100d));
  SimpleFeatureSource grid=Lines.createOrthoLines(gridBounds,lineDefs);
  FeatureIterator iter=grid.getFeatures().features();
  while (iter.hasNext()) {
    Feature feature=iter.next();
    LineString geom=(LineString)feature.getDefaultGeometryProperty().getValue();
    edges.add(geom);
    edges.add((LineString)geom.reverse());
  }
  graph=new GenericJTSGraph(edges);
  avgTransform=MatrixFactory.getDefault().copyArray(new double[][]{{1,0,1,0},{0,1,0,1}}).scale(1d / 2d);
}
Program: 189483
Project: 189483
Buggy source:
/** 
 * TODO FIXME: make this a generic getStateOnPath (replace the other one).
 * @see {@link InferredPath#getStateOnPath(AbstractPathState)}
 * @param stateBelief
 * @return
 */
public PathStateBelief getStateBeliefOnPath(PathStateBelief stateBelief){
  final MultivariateGaussian edgeStateBelief;
  if (!this.isEmptyPath()) {
    edgeStateBelief=stateBelief.getGlobalStateBelief().clone();
    if (!stateBelief.isOnRoad()) {
      AbstractRoadTrackingFilter.convertToRoadBelief(edgeStateBelief,this,Iterables.getFirst(this.getEdges(),null),true);
    }
 else {
      final Vector convertedState=this.getStateOnPath(stateBelief);
      edgeStateBelief.setMean(convertedState);
    }
  }
 else {
    edgeStateBelief=stateBelief.getGroundBelief();
  }
  return PathStateBelief.getPathStateBelief(this,edgeStateBelief);
}

Fixed version (ground truth):
/** 
 * TODO FIXME: make this a generic getStateOnPath (replace the other one).
 * @see {@link InferredPath#getStateOnPath(AbstractPathState)}
 * @param stateBelief
 * @return
 */
public PathStateBelief getStateBeliefOnPath(PathStateBelief stateBelief){
  final MultivariateGaussian edgeStateBelief;
  if (!this.isEmptyPath()) {
    edgeStateBelief=stateBelief.getGlobalStateBelief().clone();
    if (!stateBelief.isOnRoad()) {
      AbstractRoadTrackingFilter.convertToRoadBelief(edgeStateBelief,this,Iterables.getFirst(this.getEdges(),null),true);
    }
 else {
      final Vector convertedState=this.getStateOnPath(stateBelief);
      Preconditions.checkState(convertedState != null);
      edgeStateBelief.setMean(convertedState);
    }
  }
 else {
    edgeStateBelief=stateBelief.getGroundBelief();
  }
  return PathStateBelief.getPathStateBelief(this,edgeStateBelief);
}
Program: 189484
Project: 189484
Buggy source:
@Override public Coordinate getCoordOnEdge(Vector obsPoint){
  if (this == SimpleInferredEdge.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;
}

Fixed version (ground truth):
@Override public Coordinate getCoordOnEdge(Vector obsPoint){
  if (this.isNullEdge())   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: 189485
Project: 189485
Buggy source:
@Override public String getEdgeId(){
  return edgeId.toString();
}

Fixed version (ground truth):
@Override public String getEdgeId(){
  return String.valueOf(edgeId);
}
Program: 189486
Project: 189486
Buggy source:
@Override public Vector getPointOnEdge(Coordinate obsPoint){
  if (this == SimpleInferredEdge.emptyEdge)   return null;
  final LinearLocation here=locationIndexedLine.project(obsPoint);
  final Coordinate pointOnLine=locationIndexedLine.extractPoint(here);
  return VectorFactory.getDefault().createVector2D(pointOnLine.x,pointOnLine.y);
}

Fixed version (ground truth):
@Override public Vector getPointOnEdge(Coordinate obsPoint){
  if (this.isNullEdge())   return null;
  final LinearLocation here=locationIndexedLine.project(obsPoint);
  final Coordinate pointOnLine=locationIndexedLine.extractPoint(here);
  return VectorFactory.getDefault().createVector2D(pointOnLine.x,pointOnLine.y);
}
Program: 189487
Project: 189487
Buggy source:
/** 
 * This returns a list of edges that are incoming, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way in the direction of this edge).
 * @return
 */
@Override public List<InferredEdge> getIncomingTransferableEdges(InferredEdge infEdge){
  Preconditions.checkArgument(infEdge.getBackingEdge() instanceof SimpleInferredEdge);
  final List<InferredEdge> result=Lists.newArrayList();
  for (  final Edge edge : OtpGraph.filterForStreetEdges(((Edge)((SimpleInferredEdge)infEdge.getBackingEdge())).getFromVertex().getIncoming())) {
    if (this.getBaseGraph().getIdForEdge(edge) != null)     result.add(this.getInferredEdge(edge));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * This returns a list of edges that are incoming, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way in the direction of this edge).
 * @return
 */
@Override public List<InferredEdge> getIncomingTransferableEdges(InferredEdge infEdge){
  final List<InferredEdge> result=Lists.newArrayList();
  for (  final Edge edge : OtpGraph.filterForStreetEdges(((Edge)(infEdge.getBackingEdge())).getFromVertex().getIncoming())) {
    if (this.getBaseGraph().getIdForEdge(edge) != null)     result.add(this.getInferredEdge(edge));
  }
  return result;
}
Program: 189488
Project: 189488
Buggy source:
/** 
 * This returns a list of edges that are outgoing, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way against the direction of this edge).
 * @return
 */
@Override public List<InferredEdge> getOutgoingTransferableEdges(InferredEdge infEdge){
  Preconditions.checkArgument(infEdge.getBackingEdge() instanceof SimpleInferredEdge);
  final List<InferredEdge> result=Lists.newArrayList();
  for (  final Edge edge : OtpGraph.filterForStreetEdges(((Edge)((SimpleInferredEdge)infEdge.getBackingEdge())).getToVertex().getOutgoingStreetEdges())) {
    result.add(this.getInferredEdge(edge));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * This returns a list of edges that are outgoing, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way against the direction of this edge).
 * @return
 */
@Override public List<InferredEdge> getOutgoingTransferableEdges(InferredEdge infEdge){
  final List<InferredEdge> result=Lists.newArrayList();
  for (  final Edge edge : OtpGraph.filterForStreetEdges(((Edge)(infEdge.getBackingEdge())).getToVertex().getOutgoingStreetEdges())) {
    result.add(this.getInferredEdge(edge));
  }
  return result;
}
Program: 189489
Project: 189489
Buggy source:
/** 
 * See   {@link #checkAndConvertState(Vector,InferredPath)}
 * @param belief
 * @param path
 * @return
 */
public static MultivariateGaussian checkAndConvertBelief(MultivariateGaussian belief,InferredPath path){
  final MultivariateGaussian adjBelief;
  if (path.isNullPath() && belief.getInputDimensionality() != 4) {
    final double dist=AbstractRoadTrackingFilter.getOr().times(belief.getMean()).getElement(0);
    final PathEdge edge=path.getEdgeForDistance(dist,false);
    adjBelief=getGroundBeliefFromRoad(belief,edge,false);
  }
 else   if (!path.isNullPath() && belief.getInputDimensionality() != 2) {
    adjBelief=getRoadBeliefFromGround(belief,path,false);
  }
 else {
    if (!path.isNullPath()) {
      Preconditions.checkState(path.isOnPath(AbstractRoadTrackingFilter.getOr().times(belief.getMean()).getElement(0)));
    }
    adjBelief=belief;
  }
  return adjBelief;
}

Fixed version (ground truth):
/** 
 * See   {@link #checkAndConvertState(Vector,InferredPath)}
 * @param belief
 * @param path
 * @return
 */
public static MultivariateGaussian checkAndConvertBelief(MultivariateGaussian belief,InferredPath path){
  final MultivariateGaussian adjBelief;
  if (path.isNullPath() && belief.getInputDimensionality() != 4) {
    final double dist=AbstractRoadTrackingFilter.getOr().times(belief.getMean()).getElement(0);
    final PathEdge edge=path.getEdgeForDistance(dist,false);
    adjBelief=getGroundBeliefFromRoad(belief,edge,true);
  }
 else   if (!path.isNullPath() && belief.getInputDimensionality() != 2) {
    adjBelief=getRoadBeliefFromGround(belief,path,true);
  }
 else {
    if (!path.isNullPath()) {
      Preconditions.checkState(path.isOnPath(AbstractRoadTrackingFilter.getOr().times(belief.getMean()).getElement(0)));
    }
    adjBelief=belief;
  }
  Preconditions.checkState(belief.getMean().getDimensionality() == belief.getCovariance().getNumColumns() && belief.getCovariance().isSquare());
  return adjBelief;
}
Program: 189490
Project: 189490
Buggy source:
public static MultivariateGaussian getRoadBeliefFromGround(MultivariateGaussian belief,InferredEdge edge,boolean useAbsVelocity){
  Preconditions.checkArgument(belief.getInputDimensionality() == 4);
  final MultivariateGaussian tmpMg=getRoadBeliefFromGround(belief,edge.getGeometry(),false,null,0,true);
  return tmpMg;
}

Fixed version (ground truth):
public static MultivariateGaussian getRoadBeliefFromGround(MultivariateGaussian belief,InferredEdge edge,boolean useAbsVelocity){
  Preconditions.checkArgument(belief.getInputDimensionality() == 4);
  final MultivariateGaussian tmpMg=getRoadBeliefFromGround(belief,edge.getGeometry(),false,null,0,useAbsVelocity);
  return tmpMg;
}
Program: 189491
Project: 189491
Buggy source:
/** 
 * Checks that the state is either on- or off-road, depending on the given path, and converts if necessary.
 * @param state
 * @param path
 * @return
 */
public static Vector checkAndConvertState(Vector state,InferredPath path){
  final Vector adjState;
  if (path.isNullPath() && state.getDimensionality() != 4) {
    final double dist=AbstractRoadTrackingFilter.getOr().times(state).getElement(0);
    final PathEdge edge=path.getEdgeForDistance(dist,false);
    adjState=getGroundStateFromRoad(state,edge,false);
  }
 else   if (!path.isNullPath() && state.getDimensionality() != 2) {
    adjState=getRoadStateFromGround(state,path,false);
  }
 else {
    adjState=state;
  }
  return adjState;
}

Fixed version (ground truth):
/** 
 * Checks that the state is either on- or off-road, depending on the given path, and converts if necessary.
 * @param state
 * @param path
 * @return
 */
public static Vector checkAndConvertState(Vector state,InferredPath path){
  final Vector adjState;
  if (path.isNullPath() && state.getDimensionality() != 4) {
    final double dist=AbstractRoadTrackingFilter.getOr().times(state).getElement(0);
    final PathEdge edge=path.getEdgeForDistance(dist,false);
    adjState=getGroundStateFromRoad(state,edge,true);
  }
 else   if (!path.isNullPath() && state.getDimensionality() != 2) {
    adjState=getRoadStateFromGround(state,path,true);
  }
 else {
    adjState=state;
  }
  return adjState;
}
Program: 189493
Project: 189493
Buggy source:
public abstract PathState getStateOnPath(Vector result);

Fixed version (ground truth):
/** 
 * Converts location component of the mean to a location on this path, if any. <br> Basically, if the state isn't already defined on the path, then we check if the state's edge is the opposite direction to the first edge on this path. If so, we can convert the state to this path's direction.
 * @param beliefPrediction
 */
public abstract PathState getStateOnPath(PathState currentState);
Program: 189494
Project: 189494
Buggy source:
@Override public PathState getStateOnPath(Vector state){
  return this.getStateOnPath(state,AbstractRoadTrackingFilter.getEdgeLengthErrorTolerance());
}

Fixed version (ground truth):
@Override public PathState getStateOnPath(PathState currentState){
}
Program: 189495
Project: 189495
Buggy source:
public static SimplePathState getPathState(@Nonnull InferredPath path,@Nonnull Vector state){
  Preconditions.checkArgument(!path.isNullPath() || state.getDimensionality() == 4);
  return new SimplePathState(path,state);
}

Fixed version (ground truth):
public static SimplePathState getPathState(@Nonnull InferredPath path,@Nonnull Vector state){
  Preconditions.checkArgument(!path.isNullPath() || state.getDimensionality() == 4);
  final Vector adjState=PathUtils.checkAndConvertState(state,path);
  return new SimplePathState(path,adjState);
}
Program: 189496
Project: 189496
Buggy source:
@Override public Vector getGroundState(){
  if (this.groundState != null)   return this.groundState;
  this.groundState=AbstractRoadTrackingFilter.convertToGroundState(this.globalState,this.getEdge(),true);
  return this.groundState;
}

Fixed version (ground truth):
@Override public Vector getGroundState(){
  if (this.groundState != null)   return this.groundState;
  this.groundState=PathUtils.getGroundStateFromRoad(this.globalState,this.getEdge(),true);
  return this.groundState;
}
Program: 189497
Project: 189497
Buggy source:
public MultivariateGaussian getGroundBelief(){
  if (this.groundBelief == null) {
    final MultivariateGaussian newBelief=this.globalStateBelief.clone();
    AbstractRoadTrackingFilter.convertToGroundBelief(newBelief,this.getEdge(),true);
    this.groundBelief=newBelief;
    return newBelief;
  }
 else {
    return this.groundBelief;
  }
}

Fixed version (ground truth):
public MultivariateGaussian getGroundBelief(){
  if (this.groundBelief == null) {
    this.groundBelief=PathUtils.getGroundBeliefFromRoad(this.globalStateBelief,this.getEdge(),isOnRoad());
  }
  return this.groundBelief;
}
Program: 189498
Project: 189498
Buggy source:
public static PathStateBelief getPathStateBelief(SimplePathState oldPathState,Matrix covariance){
  Preconditions.checkState(oldPathState.getRawState().getDimensionality() == covariance.getNumColumns());
  final SimplePathStateBelief result=new SimplePathStateBelief(oldPathState.getPath(),new MultivariateGaussian(oldPathState.getRawState(),covariance));
  result.localStateBelief=new MultivariateGaussian(oldPathState.getLocalState(),covariance);
  return result;
}

Fixed version (ground truth):
/** 
 * Simply adds a covariance to a PathState to produce a PathStateBelief.
 * @param oldPathState
 * @param covariance
 * @return
 */
public static PathStateBelief getPathStateBelief(SimplePathState oldPathState,Matrix covariance){
  Preconditions.checkState(oldPathState.getRawState().getDimensionality() == covariance.getNumColumns());
  final SimplePathStateBelief result=new SimplePathStateBelief(oldPathState.getPath(),new MultivariateGaussian(oldPathState.getRawState(),covariance));
  result.localStateBelief=new MultivariateGaussian(oldPathState.getLocalState(),covariance);
  return result;
}
Program: 189500
Project: 189500
Buggy source:
public Projection getProjection(){
  return projection;
}

Fixed version (ground truth):
@JsonIgnore public Projection getProjection(){
  return projection;
}
Program: 189501
Project: 189501
Buggy source:
@Override public State traverse(State s0){
  final RoutingRequest options=s0.getOptions();
  if (turnRestricted(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();
}

Fixed version (ground truth):
@Override public State traverse(State s0){
  final RoutingRequest options=s0.getOptions();
  if (turnRestricted(TraverseMode.CAR) && !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: 189502
Project: 189502
Buggy source:
public Simulation(String simulationName,OtpGraph graph,SimulationParameters simParameters){
  this.simParameters=simParameters;
  this.parameters=simParameters.getStateParams();
  this.filterTypeName=simParameters.getStateParams().getFilterTypeName();
  this.inferredGraph=graph;
  this.simulationName=simulationName;
  this.rng=new Random();
  if (parameters.getSeed() != 0l) {
    this.seed=parameters.getSeed();
  }
 else {
    this.seed=rng.nextLong();
  }
  this.rng.setSeed(seed);
}

Fixed version (ground truth):
public Simulation(String simulationName,OtpGraph graph,SimulationParameters simParameters){
  this.simParameters=simParameters;
  this.parameters=simParameters.getStateParams();
  this.filterTypeName=simParameters.getStateParams().getFilterTypeName();
  this.inferredGraph=graph;
  this.simulationName=simulationName;
  this.rng=new Random();
  if (parameters.getSeed() != 0l) {
    this.seed=parameters.getSeed();
  }
 else {
    this.seed=rng.nextLong();
  }
  this.rng.setSeed(seed);
  Observation initialObs=null;
  try {
    Observation.remove(simulationName);
    initialObs=Observation.createObservation(this.simulationName,this.simParameters.getStartTime(),this.simParameters.getStartCoordinate(),null,null,null);
  }
 catch (  final TimeOrderException e) {
    e.printStackTrace();
  }
  if (initialObs != null) {
    this.updater=new VehicleTrackingPathSamplerFilterUpdater(initialObs,graph,parameters,rng);
  }
 else {
    this.updater=null;
  }
}
Program: 189503
Project: 189503
Buggy source:
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);
  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=this.updater.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);
  return newState;
}
Program: 189504
Project: 189504
Buggy source:
public VehicleState computeInitialState(){
  Observation initialObs;
  try {
    try {
      Observation.remove(simulationName);
      initialObs=Observation.createObservation(this.simulationName,this.simParameters.getStartTime(),this.simParameters.getStartCoordinate(),null,null,null);
    }
 catch (    final TimeOrderException e) {
      e.printStackTrace();
      return null;
    }
    final List<InferredEdge> edges=Lists.newArrayList(InferredEdge.getEmptyEdge());
    for (    final StreetEdge edge : this.inferredGraph.getNearbyEdges(initialObs.getProjectedPoint(),25d)) {
      edges.add(this.inferredGraph.getInferredEdge(edge));
    }
    final Set<InferredPathEntry> evaluatedPaths=Sets.newHashSet();
    final InferredEdge currentInferredEdge=edges.get(rng.nextInt(edges.size()));
    for (    final InferredEdge edge : edges) {
      final InferredPath thisPath;
      if (edge.isEmptyEdge()) {
        thisPath=InferredPath.getEmptyPath();
      }
 else {
        thisPath=InferredPath.getInferredPath(edge);
      }
      if (edge == currentInferredEdge) {
      }
      evaluatedPaths.add(new InferredPathEntry(thisPath,null,null,null,Double.NEGATIVE_INFINITY));
    }
    final VehicleState vehicleState=new VehicleState(this.inferredGraph,initialObs,currentInferredEdge,parameters,rng);
    return vehicleState;
  }
 catch (  final NumberFormatException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public VehicleState computeInitialState(){
  if (this.updater == null)   return null;
  try {
    final Observation initialObs=this.updater.getInitialObservation();
    final List<InferredEdge> edges=Lists.newArrayList(InferredEdge.getEmptyEdge());
    for (    final StreetEdge edge : this.inferredGraph.getNearbyEdges(initialObs.getProjectedPoint(),25d)) {
      edges.add(this.inferredGraph.getInferredEdge(edge));
    }
    final Set<InferredPathEntry> evaluatedPaths=Sets.newHashSet();
    final InferredEdge currentInferredEdge=edges.get(rng.nextInt(edges.size()));
    for (    final InferredEdge edge : edges) {
      final InferredPath thisPath;
      if (edge.isEmptyEdge()) {
        thisPath=InferredPath.getEmptyPath();
      }
 else {
        thisPath=InferredPath.getInferredPath(edge);
      }
      if (edge == currentInferredEdge) {
      }
      evaluatedPaths.add(new InferredPathEntry(thisPath,null,null,null,Double.NEGATIVE_INFINITY));
    }
    final VehicleState vehicleState=new VehicleState(this.inferredGraph,initialObs,currentInferredEdge,parameters,rng);
    return vehicleState;
  }
 catch (  final NumberFormatException e) {
    e.printStackTrace();
  }
  return null;
}