private boolean checkIfPathIsSubPathAndScheduleARide(Cab cab,
      RideRequest rideRequest, DialARideModel model, Interval interval,
      IntervalTree<Interval> cabsSet, double timeInstant, Node node,
      Queue<Event> eventQueue) {
    List<Integer> myPath = new ArrayList<Integer>();
    List<IntermediateNode> thatCabsPath = cab.getPath();

    int[][] prev = model.getPrev();
    Stack<Integer> revPath = new Stack<Integer>();
    int d = rideRequest.getDestination();
    int src = rideRequest.getSource();

    while (d != src) {
      revPath.add(d);
      d = prev[src][d];
    }

    while (!revPath.isEmpty()) {
      myPath.add(revPath.pop());
    }

    // printPath("MyPath: ", myPath);
    // printPathNode("ThatCabsPath: ", thatCabsPath);

    int noOfHops = myPath.size();
    int finalNode = myPath.get(noOfHops - 1);
    boolean isSubPath = false;
    for (IntermediateNode hop : thatCabsPath) {
      if (hop.getNodeNumber() == finalNode) {
        isSubPath = true;
        break;
      }
    }

    boolean cabFoundInSrc = true;
    if (node.getNodeNumber() != rideRequest.getSource()) {
      cabFoundInSrc = false;
    }

    if (isSubPath) {
      // Do Scheduling & invalidate entry in PQ
      // System.out.println("Sub Path found while Dropping 1");

      doThePickupWhileServingSomeoneAndServeAll(model, model.getNodes(),
          rideRequest, eventQueue, timeInstant, rideRequest.getSource(), cab,
          node.getNodeNumber(), cabFoundInSrc, cabsSet, interval);
    } else {
      noOfHops = thatCabsPath.size();
      finalNode = thatCabsPath.get(noOfHops - 1).getNodeNumber();

      for (int hop : myPath) {
        if (hop == finalNode) {
          isSubPath = true;
          break;
        }
      }      
      if (isSubPath) {
        // Do Scheduling
        // System.out.println("Sub Path found while Dropping 2");
        // printPath("MyPath: ", myPath);
        // printPathNode("ThatCabsPath: ", thatCabsPath);
        doThePickupWhileServingSomeoneAndServeAllWhenMyStopIsLastStop(model,
            model.getNodes(), rideRequest, eventQueue, timeInstant,
            rideRequest.getSource(), cab, node.getNodeNumber(), cabFoundInSrc,
            cabsSet, interval);
      } else {
        // System.out
        // .println("Sub Path NOT found while Dropping, DISCARDED the cab!");
      }
    }

    return isSubPath;
  }