diff --git a/src/main/java/org/opentripplanner/netex/NetexModule.java b/src/main/java/org/opentripplanner/netex/NetexModule.java index 1d946b33ad5..92ee25dbab2 100644 --- a/src/main/java/org/opentripplanner/netex/NetexModule.java +++ b/src/main/java/org/opentripplanner/netex/NetexModule.java @@ -90,7 +90,7 @@ public void buildGraph() { // TODO OTP2 - Move this into the AddTransitModelEntitiesToGraph // - and make sure they also work with GTFS feeds - GTFS do no // - have operators and notice assignments. - transitModel.getOperators().addAll(otpService.getAllOperators()); + transitModel.addOperators(otpService.getAllOperators()); transitModel.addNoticeAssignments(otpService.getNoticeAssignments()); AddTransitModelEntitiesToGraph.addToGraph( diff --git a/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java b/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java index ad5c6586fe0..ce2d3aa0ad2 100644 --- a/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java +++ b/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java @@ -122,11 +122,6 @@ public void addFeedInfo(FeedInfo info) { this.transitModel.addFeedInfo(info); } - @Override - public Collection getOperators() { - return this.transitModel.getOperators(); - } - @Override public Collection getNoticesByEntity(AbstractTransitEntity entity) { return this.transitModel.getNoticesByElement().get(entity); diff --git a/src/main/java/org/opentripplanner/transit/service/TransitModel.java b/src/main/java/org/opentripplanner/transit/service/TransitModel.java index c22c69b6b0d..91c5ba8e5d9 100644 --- a/src/main/java/org/opentripplanner/transit/service/TransitModel.java +++ b/src/main/java/org/opentripplanner/transit/service/TransitModel.java @@ -350,7 +350,11 @@ public Set getAgencyTimeZones() { } public Collection getOperators() { - return operators; + return Collections.unmodifiableCollection(operators); + } + + public void addOperators(Collection operators) { + this.operators.addAll(operators); } /** diff --git a/src/main/java/org/opentripplanner/transit/service/TransitService.java b/src/main/java/org/opentripplanner/transit/service/TransitService.java index 406d0cebc67..12fcbc9bc46 100644 --- a/src/main/java/org/opentripplanner/transit/service/TransitService.java +++ b/src/main/java/org/opentripplanner/transit/service/TransitService.java @@ -71,8 +71,6 @@ public interface TransitService { FeedInfo getFeedInfo(String feedId); - Collection getOperators(); - Collection getNoticesByEntity(AbstractTransitEntity entity); /** diff --git a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java b/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java index aab71628b03..3203d7d49fc 100644 --- a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java +++ b/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java @@ -68,7 +68,7 @@ private Trip createTrip(TripInput tripInput) { transitModel.addTripOnServiceDate(tripOnServiceDate); if (tripInput.route().getOperator() != null) { - transitModel.getOperators().add(tripInput.route().getOperator()); + transitModel.addOperators(List.of(tripInput.route().getOperator())); } var stopTimes = IntStream