@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof RoadPath) { RoadPath that = (RoadPath) o; return (this.path.equals(that.getPath())) && (Double.doubleToLongBits(this.value) == Double.doubleToLongBits(that.getValue())) && (Double.doubleToLongBits(this.travelTime) == Double.doubleToLongBits(that.getTravelTime())); } return false; }
/** * Computes the travel time for this vehicle to any point. * @param p The point to calculate travel time to. * @param timeUnit The time unit used in the simulation. * @return The travel time in the used time unit. */ protected long computeTravelTimeTo(Point p, Unit<Duration> timeUnit) { return DoubleMath.roundToLong( getRoadModel().getPathTo(this, p, timeUnit, speed.get(), routeHeuristic) .getTravelTime(), RoundingMode.CEILING); }
/** * Computes the travel time for this vehicle to any point. * @param p The point to calculate travel time to. * @param timeUnit The time unit used in the simulation. * @return The travel time in the used time unit. */ protected long computeTravelTimeTo(Point p, Unit<Duration> timeUnit) { return DoubleMath.roundToLong( getRoadModel().getPathTo(this, p, timeUnit, speed.get(), routeHeuristic) .getTravelTime(), RoundingMode.CEILING); }
@Override public RoadPath getPathTo(MovingRoadUser object, Point destination, Unit<Duration> timeUnit, Measure<Double, Velocity> maxSpeed, GeomHeuristic heuristic) { final Optional<? extends Connection<?>> conn = getConnection(object); if (conn.isPresent()) { final double connectionPercentage = Point.distance(getPosition(object), conn.get().to()) / Point.distance(conn.get().from(), conn.get().to()); final double cost = heuristic.calculateCost(graph, conn.get().from(), conn.get().to()) * connectionPercentage; final double travelTime = heuristic.calculateTravelTime(graph, conn.get().from(), conn.get().to(), getDistanceUnit(), maxSpeed, timeUnit) * connectionPercentage; final RoadPath path = getPathTo(conn.get().to(), destination, timeUnit, maxSpeed, heuristic); return RoadPath.create(path.getPath(), path.getValue() + cost, path.getTravelTime() + travelTime); } return getPathTo(getPosition(object), destination, timeUnit, maxSpeed, heuristic); }
maxSpeed, heuristic).getTravelTime() * connectionPercentage; time += exitConnTT; stats.totalTravelTime += exitConnTT; snapshot.getDistanceOfPath(hp.getPath()); stats.totalDistance += distance.getValue(); final double tt = hp.getTravelTime(); vehicleLocation = nextLoc; time += DoubleMath.roundToLong(tt, RoundingMode.CEILING); snapshot.getDistanceOfPath(hp.getPath()); stats.totalDistance += distance.getValue(); final double tt = hp.getTravelTime(); time += DoubleMath.roundToLong(tt, RoundingMode.CEILING); stats.totalTravelTime += tt;