Skip to content

Commit f2e7da1

Browse files
committed
Name some variables better.
1 parent e5ddf24 commit f2e7da1

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/main/kotlin/fi/hsl/jore4/hastus/service/importing/ImportService.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,34 +105,34 @@ class ImportService(private val graphQLServiceFactory: GraphQLServiceFactory) {
105105
// Consecutive pairs of stop points and Hastus codes with exactly same labels are
106106
// removed. The duplicates are found in case where a stop point has separate
107107
// records for both arrival and departure time.
108-
val hastusStopAndTimingPlaces: List<Pair<String, String?>> =
108+
val hastusStopPointsAndTimingPlaces: List<Pair<String, String?>> =
109109
filterOutConsecutiveDuplicates(
110110
hastusTripStops.map { it.stopId to it.timingPlace }
111111
)
112112

113-
val hastusStopLabels: List<String> = hastusStopAndTimingPlaces.map { it.first }
114-
val hastusTimingPlaceLabels: List<String?> = hastusStopAndTimingPlaces.map { it.second }
113+
val hastusStopPointLabels: List<String> = hastusStopPointsAndTimingPlaces.map { it.first }
114+
val hastusPlaceLabels: List<String?> = hastusStopPointsAndTimingPlaces.map { it.second }
115115

116-
val journeyPatternRefsMatchedByStopLabels: List<JoreJourneyPatternRef> =
116+
val journeyPatternRefsMatchedByStopPointLabels: List<JoreJourneyPatternRef> =
117117
journeyPatternRefsGroupedByRouteLabelAndDirection[hastusRouteLabelAndDirection]
118118
.orEmpty() // won't really be empty because of previously done label-direction matching
119119
.filter { journeyPatternRef ->
120-
val joreStopLabels: List<String> = journeyPatternRef.stops.map { it.stopLabel }
120+
val joreStopPointLabels: List<String> = journeyPatternRef.stops.map { it.stopLabel }
121121

122-
joreStopLabels == hastusStopLabels
122+
joreStopPointLabels == hastusStopPointLabels
123123
}
124124

125-
if (journeyPatternRefsMatchedByStopLabels.isEmpty()) {
125+
if (journeyPatternRefsMatchedByStopPointLabels.isEmpty()) {
126126
val exception = CannotFindJourneyPatternRefByStopPointLabelsException(
127127
hastusRouteLabelAndDirection,
128-
hastusStopLabels
128+
hastusStopPointLabels
129129
)
130130
LOGGER.warn(exception.message)
131131
throw exception
132132
}
133133

134134
val bestJourneyPatternRefMatch: JoreJourneyPatternRef =
135-
journeyPatternRefsMatchedByStopLabels
135+
journeyPatternRefsMatchedByStopPointLabels
136136
.sortedByDescending {
137137
// TODO Make sure that this is the appropriate ordering criteria when
138138
// finding JourneyPatternRef match.
@@ -142,13 +142,13 @@ class ImportService(private val graphQLServiceFactory: GraphQLServiceFactory) {
142142
val joreTimingPlaceLabels: List<String?> =
143143
journeyPatternRef.stops.map { it.timingPlaceCode }
144144

145-
joreTimingPlaceLabels == hastusTimingPlaceLabels
145+
joreTimingPlaceLabels == hastusPlaceLabels
146146
}
147147
?: run {
148148
val exception = CannotFindJourneyPatternRefByTimingPlaceLabelsException(
149149
hastusRouteLabelAndDirection,
150-
hastusStopLabels,
151-
hastusTimingPlaceLabels
150+
hastusStopPointLabels,
151+
hastusPlaceLabels
152152
)
153153
LOGGER.warn(exception.message)
154154
throw exception

0 commit comments

Comments
 (0)