Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/backend/Stop.java
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | public class Stop implements Comparable<Stop> { | ||||
public @Nullable String routesThatStopHereToString() { | public @Nullable String routesThatStopHereToString() { | ||||
// M E M O I Z A T I O N | // M E M O I Z A T I O N | ||||
if(this.routesThatStopHereString != null) { | if(this.routesThatStopHereString != null) { | ||||
return this.routesThatStopHereString; | return this.routesThatStopHereString; | ||||
} | } | ||||
// no string yet? build it! | // no string yet? build it! | ||||
return buildString(); | return buildRoutesString(); | ||||
} | } | ||||
@Nullable | @Nullable | ||||
public String getAbsurdGTTPlaceName() { | public String getAbsurdGTTPlaceName() { | ||||
return absurdGTTPlaceName; | return absurdGTTPlaceName; | ||||
} | } | ||||
public void setAbsurdGTTPlaceName(@NonNull String absurdGTTPlaceName) { | public void setAbsurdGTTPlaceName(@NonNull String absurdGTTPlaceName) { | ||||
this.absurdGTTPlaceName = absurdGTTPlaceName; | this.absurdGTTPlaceName = absurdGTTPlaceName; | ||||
} | } | ||||
public void setRoutesThatStopHere(@Nullable List<String> routesThatStopHere) { | public void setRoutesThatStopHere(@Nullable List<String> routesThatStopHere) { | ||||
this.routesThatStopHere = routesThatStopHere; | this.routesThatStopHere = routesThatStopHere; | ||||
} | } | ||||
@Nullable | @Nullable | ||||
protected List<String> getRoutesThatStopHere(){ | protected List<String> getRoutesThatStopHere(){ | ||||
return routesThatStopHere; | return routesThatStopHere; | ||||
} | } | ||||
private @Nullable String buildString() { | private @Nullable String buildRoutesString() { | ||||
// no routes => no string | // no routes => no string | ||||
if(this.routesThatStopHere == null || this.routesThatStopHere.size() == 0) { | if(this.routesThatStopHere == null || this.routesThatStopHere.size() == 0) { | ||||
return null; | return null; | ||||
} | } | ||||
StringBuilder sb = new StringBuilder(); | StringBuilder sb = new StringBuilder(); | ||||
Collections.sort(routesThatStopHere,new LinesNameSorter()); | Collections.sort(routesThatStopHere,new LinesNameSorter()); | ||||
int i, lenMinusOne = routesThatStopHere.size() - 1; | int i, lenMinusOne = routesThatStopHere.size() - 1; | ||||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register