Skip to content

Commit 9eaca95

Browse files
committed
More renaming
1 parent 3b625ef commit 9eaca95

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

application/src/main/java/org/opentripplanner/routing/api/request/preference/MaxStopCountLimit.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
public class MaxStopCountLimit {
1616

1717
private static final int DEFAULT_LIMIT = 500;
18-
private static final Map<StreetMode, Integer> DEFAULT_FOR_MODE = Map.of();
18+
private static final Map<StreetMode, Integer> DEFAULT_FOR_MODES = Map.of();
1919

2020
public static final MaxStopCountLimit DEFAULT = new MaxStopCountLimit();
2121

2222
private final int defaultLimit;
23-
private final Map<StreetMode, Integer> limitForMode;
23+
private final Map<StreetMode, Integer> limitsForModes;
2424

2525
public MaxStopCountLimit() {
2626
this.defaultLimit = DEFAULT_LIMIT;
27-
this.limitForMode = DEFAULT_FOR_MODE;
27+
this.limitsForModes = DEFAULT_FOR_MODES;
2828
}
2929

3030
MaxStopCountLimit(Builder builder) {
3131
this.defaultLimit = IntUtils.requireNotNegative(builder.defaultLimit());
32-
this.limitForMode = builder.copyCustomLimits();
32+
this.limitsForModes = builder.copyCustomLimits();
3333
}
3434

3535
public static Builder of() {
@@ -44,7 +44,7 @@ public Builder copyOf() {
4444
* Get the max stop count limit for mode. If no custom value is defined, default is used.
4545
*/
4646
public int limitForMode(StreetMode mode) {
47-
return limitForMode.getOrDefault(mode, defaultLimit);
47+
return limitsForModes.getOrDefault(mode, defaultLimit);
4848
}
4949

5050
public int defaultLimit() {
@@ -56,7 +56,7 @@ public String toString() {
5656
return ToStringBuilder
5757
.of(MaxStopCountLimit.class)
5858
.addNum("defaultLimit", defaultLimit, DEFAULT_LIMIT)
59-
.addObj("limitForMode", limitForMode, DEFAULT_FOR_MODE)
59+
.addObj("limitsForModes", limitsForModes, DEFAULT_FOR_MODES)
6060
.toString();
6161
}
6262

@@ -67,27 +67,27 @@ public boolean equals(Object o) {
6767

6868
var that = (MaxStopCountLimit) o;
6969

70-
return (defaultLimit == that.defaultLimit && limitForMode.equals(that.limitForMode));
70+
return (defaultLimit == that.defaultLimit && limitsForModes.equals(that.limitsForModes));
7171
}
7272

7373
@Override
7474
public int hashCode() {
75-
return Objects.hash(defaultLimit, limitForMode);
75+
return Objects.hash(defaultLimit, limitsForModes);
7676
}
7777

78-
private Map<StreetMode, Integer> limitForMode() {
79-
return limitForMode;
78+
private Map<StreetMode, Integer> limitsForModes() {
79+
return limitsForModes;
8080
}
8181

8282
private boolean hasCustomLimit(StreetMode mode) {
83-
return limitForMode.containsKey(mode);
83+
return limitsForModes.containsKey(mode);
8484
}
8585

8686
public static class Builder {
8787

8888
private final MaxStopCountLimit original;
8989
private int defaultLimit;
90-
private Map<StreetMode, Integer> limitForMode = null;
90+
private Map<StreetMode, Integer> limitsForModes = null;
9191

9292
Builder(MaxStopCountLimit original) {
9393
this.original = original;
@@ -105,15 +105,15 @@ public Builder withDefaultLimit(int defaultLimit) {
105105

106106
public Builder with(StreetMode mode, Integer limit) {
107107
// Lazy initialize the valueForEnum map
108-
if (limitForMode == null) {
109-
limitForMode = new EnumMap<>(StreetMode.class);
108+
if (limitsForModes == null) {
109+
limitsForModes = new EnumMap<>(StreetMode.class);
110110
for (StreetMode it : StreetMode.values()) {
111111
if (original.hasCustomLimit(it)) {
112-
limitForMode.put(it, original.limitForMode(it));
112+
limitsForModes.put(it, original.limitForMode(it));
113113
}
114114
}
115115
}
116-
limitForMode.put(mode, limit);
116+
limitsForModes.put(mode, limit);
117117
return this;
118118
}
119119

@@ -130,13 +130,13 @@ public Builder withLimitsForModes(Map<StreetMode, Integer> limitsForModes) {
130130
* can be used to generate new values if desired.
131131
* */
132132
Map<StreetMode, Integer> copyCustomLimits() {
133-
if (limitForMode == null) {
133+
if (limitsForModes == null) {
134134
// The limitForMode is protected and should never be mutated, so we can reuse it
135-
return original.limitForMode();
135+
return original.limitsForModes();
136136
}
137137

138138
var copy = new EnumMap<StreetMode, Integer>(StreetMode.class);
139-
for (Map.Entry<StreetMode, Integer> it : limitForMode.entrySet()) {
139+
for (Map.Entry<StreetMode, Integer> it : limitsForModes.entrySet()) {
140140
if (defaultLimit != it.getValue()) {
141141
copy.put(it.getKey(), it.getValue());
142142
}

0 commit comments

Comments
 (0)