
org.opentripplanner.model.UpdateError Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.model;
import javax.annotation.Nullable;
import org.opentripplanner.transit.model.framework.FeedScopedId;
import org.opentripplanner.transit.model.framework.Result;
public record UpdateError(
@Nullable FeedScopedId tripId,
UpdateErrorType errorType,
@Nullable Integer stopIndex
) {
public UpdateError(@Nullable FeedScopedId tripId, UpdateErrorType errorType) {
this(tripId, errorType, null);
}
public String debugId() {
if (tripId == null) {
return "no trip id";
} else if (stopIndex == null) {
return tripId.toString();
} else {
return "%s{stopIndex=%s}".formatted(tripId, stopIndex);
}
}
public enum UpdateErrorType {
UNKNOWN,
INVALID_INPUT_STRUCTURE,
TRIP_NOT_FOUND,
TRIP_NOT_FOUND_IN_PATTERN,
NO_FUZZY_TRIP_MATCH,
NO_TRIP_FOR_CANCELLATION_FOUND,
TRIP_ALREADY_EXISTS,
NO_START_DATE,
NO_UPDATES,
TOO_FEW_STOPS,
NO_VALID_STOPS,
NO_SERVICE_ON_DATE,
INVALID_ARRIVAL_TIME,
INVALID_DEPARTURE_TIME,
NEGATIVE_DWELL_TIME,
NEGATIVE_HOP_TIME,
INVALID_STOP_SEQUENCE,
NOT_IMPLEMENTED_UNSCHEDULED,
NOT_IMPLEMENTED_DUPLICATED,
NOT_MONITORED,
}
public static Result result(FeedScopedId tripId, UpdateErrorType errorType) {
return Result.failure(new UpdateError(tripId, errorType));
}
public static UpdateError noTripId(UpdateErrorType errorType) {
return new UpdateError(null, errorType);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy