Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/backend/Route.java
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | public class Route implements Comparable<Route> { | ||||
//0=>feriale, 1=>festivo -2=>unknown | //0=>feriale, 1=>festivo -2=>unknown | ||||
public FestiveInfo festivo = FestiveInfo.UNKNOWN; | public FestiveInfo festivo = FestiveInfo.UNKNOWN; | ||||
private @Nullable String gtfsId; | private @Nullable String gtfsId; | ||||
public enum Type { // "long distance" sono gli extraurbani. | public enum Type { // "long distance" sono gli extraurbani. | ||||
BUS(1), LONG_DISTANCE_BUS(2), METRO(3), RAILWAY(4), TRAM(5), UNKNOWN(-2); | BUS(1), LONG_DISTANCE_BUS(2), METRO(3), RAILWAY(4), TRAM(5), UNKNOWN(-2); | ||||
//TODO: decide to give some special parameter to each field | //TODO: decide to give some special parameter to each field | ||||
private int code; | private final int code; | ||||
Type(int code){ | Type(int code){ | ||||
this.code = code; | this.code = code; | ||||
} | } | ||||
public int getCode(){ | public int getCode(){ | ||||
return this.code; | return this.code; | ||||
} | } | ||||
@Nullable | @Nullable | ||||
public static Type fromCode(int i){ | public static Type fromCode(int i){ | ||||
Show All 13 Lines | public enum Type { // "long distance" sono gli extraurbani. | ||||
default: | default: | ||||
return null; | return null; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public enum FestiveInfo{ | public enum FestiveInfo{ | ||||
FESTIVO(1),FERIALE(0),UNKNOWN(-2); | FESTIVO(1),FERIALE(0),UNKNOWN(-2); | ||||
private int code; | private final int code; | ||||
FestiveInfo(int code){ | FestiveInfo(int code){ | ||||
this.code = code; | this.code = code; | ||||
} | } | ||||
public int getCode() { | public int getCode() { | ||||
return code; | return code; | ||||
} | } | ||||
public static FestiveInfo fromCode(int i){ | public static FestiveInfo fromCode(int i){ | ||||
▲ Show 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | public class Route implements Comparable<Route> { | ||||
} | } | ||||
@Nullable | @Nullable | ||||
public String getGtfsId() { | public String getGtfsId() { | ||||
return gtfsId; | return gtfsId; | ||||
} | } | ||||
public void setGtfsId(@Nullable String gtfsId) { | public void setGtfsId(@Nullable String gtfsId) { | ||||
this.gtfsId = gtfsId; | if (gtfsId==null) this.gtfsId = null; | ||||
else | |||||
this.gtfsId = gtfsId.trim(); | |||||
} | } | ||||
public boolean isBranchIdValid(){ | public boolean isBranchIdValid(){ | ||||
return branchid!=BRANCHID_MISSING; | return branchid!=BRANCHID_MISSING; | ||||
} | } | ||||
@Override | @Override | ||||
public boolean equals(Object obj) { | public boolean equals(Object obj) { | ||||
▲ Show 20 Lines • Show All 84 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