Program: 189531
Project: 189531
Buggy source:
/** 
 * This method samples a path, updates the belief to reflect that, and returns the path.
 * @param edgeTransDist
 * @param belief
 * @param startEdge
 * @param movementFilter
 * @return
 */
private InferredPath traverseEdge(EdgeTransitionDistributions edgeTransDist,final MultivariateGaussian belief,PathEdge startEdge,StandardRoadTrackingFilter movementFilter){
  PathEdge currentEdge=startEdge;
  final List<PathEdge> currentPath=Lists.newArrayList();
  double distTraveled=0d;
  Double totalDistToTravel=null;
  while (totalDistToTravel == null || Math.abs(totalDistToTravel) >= Math.abs(currentEdge.getDistToStartOfEdge()) + currentEdge.getInferredEdge().getLength()) {
    final List<InferredEdge> transferEdges=Lists.newArrayList();
    if (currentEdge.getInferredEdge() == InferredEdge.getEmptyEdge()) {
      final Vector projLocation=StandardRoadTrackingFilter.getOg().times(belief.getMean());
      transferEdges.addAll(this.inferredGraph.getNearbyEdges(projLocation));
    }
 else {
      if (totalDistToTravel == null) {
        transferEdges.add(currentEdge.getInferredEdge());
      }
 else       if (belief.getMean().getElement(0) < 0d) {
        transferEdges.addAll(currentEdge.getInferredEdge().getIncomingTransferableEdges());
      }
 else       if (belief.getMean().getElement(0) > 0d) {
        transferEdges.addAll(currentEdge.getInferredEdge().getOutgoingTransferableEdges());
      }
 else {
        transferEdges.addAll(currentEdge.getInferredEdge().getIncomingTransferableEdges());
        transferEdges.addAll(currentEdge.getInferredEdge().getOutgoingTransferableEdges());
      }
    }
    final InferredEdge sampledEdge=edgeTransDist.sample(rng,transferEdges,currentEdge.getInferredEdge());
    if (sampledEdge == InferredEdge.getEmptyEdge()) {
      movementFilter.predict(belief,PathEdge.getEmptyPathEdge(),currentEdge);
      if (currentPath.isEmpty()) {
        return InferredPath.getEmptyPath();
      }
 else {
        currentPath.add(PathEdge.getEmptyPathEdge());
        return InferredPath.getInferredPath(currentPath);
      }
    }
    final PathEdge sampledPathEdge=PathEdge.getEdge(sampledEdge,distTraveled);
    if (totalDistToTravel == null) {
      if (belief.getInputDimensionality() == 4) {
        StandardRoadTrackingFilter.invertProjection(belief,sampledPathEdge);
      }
      final double currentLoc=belief.getMean().getElement(0);
      movementFilter.predict(belief,sampledPathEdge,null);
      belief.getMean().setElement(0,belief.getMean().getElement(0) + currentLoc);
      final Vector transStateSample=sampleMovementBelief(belief.getMean(),movementFilter);
      belief.setMean(transStateSample);
      totalDistToTravel=belief.getMean().getElement(0);
    }
    final double direction=belief.getMean().getElement(0) >= 0d ? 1d : -1d;
    if (sampledPathEdge == null) {
      belief.getMean().setElement(0,direction * currentEdge.getInferredEdge().getLength());
      belief.getMean().setElement(1,0d);
      break;
    }
    distTraveled+=direction * sampledPathEdge.getInferredEdge().getLength();
    currentEdge=sampledPathEdge;
    currentPath.add(sampledPathEdge);
  }
  return InferredPath.getInferredPath(currentPath);
}

Fixed version (ground truth):
/** 
 * This method samples a path, updates the belief to reflect that, and returns the path.
 * @param edgeTransDist
 * @param belief
 * @param startEdge
 * @param movementFilter
 * @return
 */
private InferredPath traverseEdge(EdgeTransitionDistributions edgeTransDist,final MultivariateGaussian belief,PathEdge startEdge,StandardRoadTrackingFilter movementFilter){
  PathEdge currentEdge=startEdge;
  final List<PathEdge> currentPath=Lists.newArrayList();
  double distTraveled=0d;
  Double totalDistToTravel=null;
  while (totalDistToTravel == null || Math.abs(totalDistToTravel) >= Math.abs(currentEdge.getDistToStartOfEdge()) + currentEdge.getInferredEdge().getLength()) {
    final List<InferredEdge> transferEdges=Lists.newArrayList();
    if (currentEdge.getInferredEdge() == InferredEdge.getEmptyEdge()) {
      final Vector projLocation=StandardRoadTrackingFilter.getOg().times(belief.getMean());
      transferEdges.addAll(this.inferredGraph.getNearbyEdges(projLocation));
    }
 else {
      if (totalDistToTravel == null) {
        transferEdges.add(currentEdge.getInferredEdge());
      }
 else       if (belief.getMean().getElement(0) < 0d) {
        transferEdges.addAll(currentEdge.getInferredEdge().getIncomingTransferableEdges());
      }
 else       if (belief.getMean().getElement(0) > 0d) {
        transferEdges.addAll(currentEdge.getInferredEdge().getOutgoingTransferableEdges());
      }
 else {
        transferEdges.addAll(currentEdge.getInferredEdge().getIncomingTransferableEdges());
        transferEdges.addAll(currentEdge.getInferredEdge().getOutgoingTransferableEdges());
      }
    }
    final InferredEdge sampledEdge=edgeTransDist.sample(rng,transferEdges,currentEdge.getInferredEdge());
    if (sampledEdge == InferredEdge.getEmptyEdge()) {
      movementFilter.predict(belief,PathEdge.getEmptyPathEdge(),currentEdge);
      if (currentPath.isEmpty()) {
        return InferredPath.getEmptyPath();
      }
 else {
        currentPath.add(PathEdge.getEmptyPathEdge());
        return InferredPath.getInferredPath(currentPath);
      }
    }
    double direction=belief.getMean().getElement(0) >= 0d ? 1d : -1d;
    final PathEdge sampledPathEdge=PathEdge.getEdge(sampledEdge,distTraveled);
    if (totalDistToTravel == null) {
      if (belief.getInputDimensionality() == 4) {
        StandardRoadTrackingFilter.invertProjection(belief,sampledPathEdge);
      }
      movementFilter.predict(belief,sampledPathEdge,null);
      final Vector transStateSample=sampleMovementBelief(belief.getMean(),movementFilter);
      belief.setMean(transStateSample);
      totalDistToTravel=belief.getMean().getElement(0);
      direction=belief.getMean().getElement(0) >= 0d ? 1d : -1d;
    }
    if (sampledPathEdge == null) {
      belief.getMean().setElement(0,direction * currentEdge.getInferredEdge().getLength());
      belief.getMean().setElement(1,0d);
      break;
    }
    distTraveled+=direction * sampledPathEdge.getInferredEdge().getLength();
    currentEdge=sampledPathEdge;
    currentPath.add(sampledPathEdge);
  }
  return InferredPath.getInferredPath(currentPath);
}