Skip to content

Commit

Permalink
Refactor: clean up operator related stuff in TransitModel
Browse files Browse the repository at this point in the history
  • Loading branch information
habrahamsson-skanetrafiken committed Oct 10, 2024
1 parent 9e58db4 commit 014824b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/opentripplanner/netex/NetexModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ public void addFeedInfo(FeedInfo info) {
this.transitModel.addFeedInfo(info);
}

@Override
public Collection<Operator> getOperators() {
return this.transitModel.getOperators();
}

@Override
public Collection<Notice> getNoticesByEntity(AbstractTransitEntity<?, ?> entity) {
return this.transitModel.getNoticesByElement().get(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -349,7 +350,11 @@ public Set<ZoneId> getAgencyTimeZones() {
}

public Collection<Operator> getOperators() {
return operators;
return Collections.unmodifiableCollection(operators);
}

public void addOperators(Collection<Operator> operators) {
this.operators.addAll(operators);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public interface TransitService {

FeedInfo getFeedInfo(String feedId);

Collection<Operator> getOperators();

Collection<Notice> getNoticesByEntity(AbstractTransitEntity<?, ?> entity);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private Trip createTrip(TripInput tripInput) {
transitModel.addTripOnServiceDate(tripOnServiceDate.getId(), tripOnServiceDate);

if (tripInput.route().getOperator() != null) {
transitModel.getOperators().add(tripInput.route().getOperator());
transitModel.addOperators(List.of(tripInput.route().getOperator()));
}

var stopTimes = IntStream
Expand Down

0 comments on commit 014824b

Please sign in to comment.