Fixed routing problems

This commit is contained in:
dkeen@dkeen-laptop 2012-04-13 16:23:34 -07:00
parent 6abb0f35b6
commit faf916891d
2 changed files with 108 additions and 76 deletions

View File

@ -14,18 +14,18 @@ public enum Line {
Station.EMBR, Station.WOAK, Station._12TH, Station._19TH, Station.EMBR, Station.WOAK, Station._12TH, Station._19TH,
Station.MCAR, Station.ASHB, Station.DBRK, Station.NBRK, Station.MCAR, Station.ASHB, Station.DBRK, Station.NBRK,
Station.PLZA, Station.DELN, Station.RICH), Station.PLZA, Station.DELN, Station.RICH),
ORANGE(false, Station.FRMT, Station.UCTY, Station.SHAY, ORANGE(false, Station.FRMT, Station.UCTY, Station.SHAY, Station.HAYW,
Station.HAYW, Station.BAYF, Station.SANL, Station.COLS, Station.BAYF, Station.SANL, Station.COLS, Station.FTVL,
Station.FTVL, Station.LAKE, Station._12TH, Station._19TH, Station.LAKE, Station._12TH, Station._19TH, Station.MCAR,
Station.MCAR, Station.ASHB, Station.DBRK, Station.NBRK, Station.ASHB, Station.DBRK, Station.NBRK, Station.PLZA,
Station.PLZA, Station.DELN, Station.RICH), Station.DELN, Station.RICH),
YELLOW(false, Station.MLBR, Station.SFIA, Station.SBRN, YELLOW(false, Station.MLBR, Station.SFIA, Station.SBRN, Station.SSAN,
Station.SSAN, Station.COLM, Station.DALY, Station.BALB, Station.COLM, Station.DALY, Station.BALB, Station.GLEN,
Station.GLEN, Station._24TH, Station._16TH, Station.CIVC, Station._24TH, Station._16TH, Station.CIVC, Station.POWL,
Station.POWL, Station.MONT, Station.EMBR, Station.WOAK, Station.MONT, Station.EMBR, Station.WOAK, Station._12TH,
Station._12TH, Station._19TH, Station.MCAR, Station.ROCK, Station._19TH, Station.MCAR, Station.ROCK, Station.ORIN,
Station.ORIN, Station.LAFY, Station.WCRK, Station.PHIL, Station.LAFY, Station.WCRK, Station.PHIL, Station.CONC,
Station.CONC, Station.NCON, Station.PITT), Station.NCON, Station.PITT),
BLUE(true, Station.DALY, Station.BALB, Station.GLEN, Station._24TH, BLUE(true, Station.DALY, Station.BALB, Station.GLEN, Station._24TH,
Station._16TH, Station.CIVC, Station.POWL, Station.MONT, Station._16TH, Station.CIVC, Station.POWL, Station.MONT,
Station.EMBR, Station.WOAK, Station.LAKE, Station.FTVL, Station.EMBR, Station.WOAK, Station.LAKE, Station.FTVL,
@ -42,12 +42,26 @@ public enum Line {
Station._16TH, Station.CIVC, Station.POWL, Station.MONT, Station._16TH, Station.CIVC, Station.POWL, Station.MONT,
Station.EMBR, Station.WOAK, Station.ASHB, Station.DBRK, Station.EMBR, Station.WOAK, Station.ASHB, Station.DBRK,
Station.NBRK, Station.PLZA, Station.DELN, Station.RICH), Station.NBRK, Station.PLZA, Station.DELN, Station.RICH),
YELLOW_RED_SCHEDULED_TRANSFER(YELLOW, RED, Station.MLBR, YELLOW_GREEN_SCHEDULED_TRANSFER(true, YELLOW, GREEN, Station.MLBR,
Station.SFIA, Station.SBRN, Station.SSAN, Station.COLM, Station.SFIA, Station.SBRN, Station.SSAN, Station.COLM,
Station.DALY, Station.BALB, Station.GLEN, Station._24TH, Station.DALY, Station.BALB, Station.GLEN, Station._24TH,
Station._16TH, Station.CIVC, Station.POWL, Station.MONT, Station._16TH, Station.CIVC, Station.POWL, Station.MONT,
Station.EMBR, Station.WOAK, Station.ASHB, Station.DBRK, Station.EMBR, Station.WOAK, Station.LAKE, Station.FTVL,
Station.NBRK, Station.PLZA, Station.DELN, Station.RICH); Station.COLS, Station.SANL, Station.BAYF, Station.HAYW,
Station.SHAY, Station.UCTY, Station.FRMT),
YELLOW_BLUE_SCHEDULED_TRANSFER(true, YELLOW, BLUE, Station.MLBR,
Station.SFIA, Station.SBRN, Station.SSAN, Station.COLM,
Station.DALY, Station.BALB, Station.GLEN, Station._24TH,
Station._16TH, Station.CIVC, Station.POWL, Station.MONT,
Station.EMBR, Station.WOAK, Station.LAKE, Station.FTVL,
Station.COLS, Station.SANL, Station.BAYF, Station.CAST,
Station.WDUB, Station.DUBL),
YELLOW_RED_SCHEDULED_TRANSFER(YELLOW, RED, Station.MLBR, Station.SFIA,
Station.SBRN, Station.SSAN, Station.COLM, Station.DALY,
Station.BALB, Station.GLEN, Station._24TH, Station._16TH,
Station.CIVC, Station.POWL, Station.MONT, Station.EMBR,
Station.WOAK, Station.ASHB, Station.DBRK, Station.NBRK,
Station.PLZA, Station.DELN, Station.RICH);
public final List<Station> stations; public final List<Station> stations;
@ -59,8 +73,7 @@ public enum Line {
protected final Line transferLine2; protected final Line transferLine2;
private Line(boolean directionMayInvert, private Line(boolean directionMayInvert, Station... stationArray) {
Station... stationArray) {
this.requiresTransfer = false; this.requiresTransfer = false;
this.directionMayInvert = directionMayInvert; this.directionMayInvert = directionMayInvert;
stations = Arrays.asList(stationArray); stations = Arrays.asList(stationArray);
@ -77,6 +90,15 @@ public enum Line {
this.transferLine2 = transferLine2; this.transferLine2 = transferLine2;
} }
private Line(boolean directionMayInvert, Line transferLine1,
Line transferLine2, Station... stationArray) {
this.requiresTransfer = true;
this.directionMayInvert = directionMayInvert;
stations = Arrays.asList(stationArray);
this.transferLine1 = transferLine1;
this.transferLine2 = transferLine2;
}
public static Collection<Line> getLinesForStation(Station station) { public static Collection<Line> getLinesForStation(Station station) {
Collection<Line> lines = new ArrayList<Line>(); Collection<Line> lines = new ArrayList<Line>();
for (Line line : Line.values()) { for (Line line : Line.values()) {

View File

@ -6,85 +6,89 @@ import java.util.List;
import android.util.Log; import android.util.Log;
public enum Station { public enum Station {
_12TH("12th", "12th St./Oakland City Center", false, false, "bayf"), _12TH("12th", "12th St./Oakland City Center", true, false, false, "bayf"),
_16TH("16th", "16th St. Mission", false, false), _16TH("16th", "16th St. Mission", false, false, false),
_19TH("19th", "19th St./Oakland", false, false, "bayf"), _19TH("19th", "19th St./Oakland", true, false, false, "bayf"),
_24TH("24th", "24th St. Mission", false, false), _24TH("24th", "24th St. Mission", false, false, false),
ASHB("ashb", "Ashby", false, false, "mcar"), ASHB("ashb", "Ashby", true, false, false, "mcar"),
BALB("balb", "Balboa Park", false, false), BALB("balb", "Balboa Park", false, false, false),
BAYF("bayf", "Bay Fair", true, false, "mcar"), BAYF("bayf", "Bay Fair", true, true, false, "mcar"),
CAST("cast", "Castro Valley", false, false, "bayf"), CAST("cast", "Castro Valley", true, false, false, "bayf"),
CIVC("civc", "Civic Center", false, false), CIVC("civc", "Civic Center", false, false, false),
COLS("cols", "Coliseum/Oakland Airport", true, false, "mcar"), COLS("cols", "Coliseum/Oakland Airport", true, true, false, "mcar"),
COLM("colm", "Colma", false, false, "balb", "balb"), COLM("colm", "Colma", true, false, false, "balb", "balb"),
CONC("conc", "Concord", false, false, "mcar"), CONC("conc", "Concord", true, false, false, "mcar"),
DALY("daly", "Daly City", false, false), DALY("daly", "Daly City", false, false, false),
DBRK("dbrk", "Downtown Berkeley", false, false, "mcar"), DBRK("dbrk", "Downtown Berkeley", true, false, false, "mcar"),
DUBL("dubl", "Dublin/Pleasanton", false, true, "bayf"), DUBL("dubl", "Dublin/Pleasanton", true, false, true, "bayf"),
DELN("deln", "El Cerrito del Norte", false, false, "mcar"), DELN("deln", "El Cerrito del Norte", true, false, false, "mcar"),
PLZA("plza", "El Cerrito Plaza", false, false, "mcar"), PLZA("plza", "El Cerrito Plaza", true, false, false, "mcar"),
EMBR("embr", "Embarcadero", false, false), EMBR("embr", "Embarcadero", false, false, false),
FRMT("frmt", "Fremont", true, false, "bayf"), FRMT("frmt", "Fremont", true, true, false, "bayf"),
FTVL("ftvl", "Fruitvale", true, false, "mcar"), FTVL("ftvl", "Fruitvale", true, true, false, "mcar"),
GLEN("glen", "Glen Park", false, false), GLEN("glen", "Glen Park", false, false, false),
HAYW("hayw", "Hayward", true, false, "bayf"), HAYW("hayw", "Hayward", true, true, false, "bayf"),
LAFY("lafy", "Lafayette", false, false, "mcar"), LAFY("lafy", "Lafayette", true, false, false, "mcar"),
LAKE("lake", "Lake Merritt", true, false, "mcar"), LAKE("lake", "Lake Merritt", true, true, false, "mcar"),
MCAR("mcar", "MacArthur", false, false, "bayf"), MCAR("mcar", "MacArthur", true, false, false, "bayf"),
MLBR("mlbr", "Millbrae", false, true, "balb", "balb"), MLBR("mlbr", "Millbrae", true, false, true, "balb", "balb"),
MONT("mont", "Montgomery St.", false, false), MONT("mont", "Montgomery St.", false, false, false),
NBRK("nbrk", "North Berkeley", false, false, "mcar"), NBRK("nbrk", "North Berkeley", true, false, false, "mcar"),
NCON("ncon", "North Concord/Martinez", false, false, "mcar"), NCON("ncon", "North Concord/Martinez", true, false, false, "mcar"),
ORIN("orin", "Orinda", false, false, "mcar"), ORIN("orin", "Orinda", true, false, false, "mcar"),
PITT("pitt", "Pittsburg/Bay Point", false, true, "mcar"), PITT("pitt", "Pittsburg/Bay Point", true, false, true, "mcar"),
PHIL("phil", "Pleasant Hill", false, false, "mcar"), PHIL("phil", "Pleasant Hill", true, false, false, "mcar"),
POWL("powl", "Powell St.", false, false), POWL("powl", "Powell St.", false, false, false),
RICH("rich", "Richmond", false, true, "mcar"), RICH("rich", "Richmond", true, false, true, "mcar"),
ROCK("rock", "Rockridge", false, false, "mcar"), ROCK("rock", "Rockridge", true, false, false, "mcar"),
SBRN("sbrn", "San Bruno", false, false, "balb", "balb"), SBRN("sbrn", "San Bruno", true, false, false, "balb", "balb"),
SANL("sanl", "San Leandro", true, false, "mcar"), SANL("sanl", "San Leandro", true, true, false, "mcar"),
SFIA("sfia", "SFO Airport", false, false, "sbrn", "balb", true), SFIA("sfia", "SFO Airport", true, false, false, "sbrn", "balb", true),
SHAY("shay", "South Hayward", true, false, "bayf"), SHAY("shay", "South Hayward", true, true, false, "bayf"),
SSAN("ssan", "South San Francisco", false, false, "balb", "balb"), SSAN("ssan", "South San Francisco", true, false, false, "balb", "balb"),
UCTY("ucty", "Union City", true, false, "bayf"), UCTY("ucty", "Union City", true, true, false, "bayf"),
WCRK("wcrk", "Walnut Creek", false, false, "mcar"), WCRK("wcrk", "Walnut Creek", true, false, false, "mcar"),
WDUB("wdub", "West Dublin/Pleasanton", false, false, "bayf"), WDUB("wdub", "West Dublin/Pleasanton", true, false, false, "bayf"),
WOAK("woak", "West Oakland", false, false), WOAK("woak", "West Oakland", false, false, false),
SPCL("spcl", "Special", false, false); SPCL("spcl", "Special", false, false, false);
public final String abbreviation; public final String abbreviation;
public final String name; public final String name;
public final boolean transferFriendly;
public final boolean invertDirection; public final boolean invertDirection;
protected final String inboundTransferStation; protected final String inboundTransferStation;
protected final String outboundTransferStation; protected final String outboundTransferStation;
public final boolean endOfLine; public final boolean endOfLine;
public final boolean longStationLinger; public final boolean longStationLinger;
private Station(String abbreviation, String name, boolean invertDirection, private Station(String abbreviation, String name, boolean transferFriendly,
boolean endOfLine) { boolean invertDirection, boolean endOfLine) {
this(abbreviation, name, invertDirection, endOfLine, null, null, false); this(abbreviation, name, transferFriendly, invertDirection, endOfLine,
null, null, false);
} }
private Station(String abbreviation, String name, boolean invertDirection, private Station(String abbreviation, String name, boolean transferFriendly,
boolean endOfLine, String transferStation) { boolean invertDirection, boolean endOfLine, String transferStation) {
this(abbreviation, name, invertDirection, endOfLine, transferStation, this(abbreviation, name, transferFriendly, invertDirection, endOfLine,
null, false); transferStation, null, false);
} }
private Station(String abbreviation, String name, boolean invertDirection, private Station(String abbreviation, String name, boolean transferFriendly,
boolean endOfLine, String inboundTransferStation, boolean invertDirection, boolean endOfLine,
String outboundTransferStation) { String inboundTransferStation, String outboundTransferStation) {
this(abbreviation, name, invertDirection, endOfLine, this(abbreviation, name, transferFriendly, invertDirection, endOfLine,
inboundTransferStation, outboundTransferStation, false); inboundTransferStation, outboundTransferStation, false);
} }
private Station(String abbreviation, String name, boolean invertDirection, private Station(String abbreviation, String name, boolean transferFriendly,
boolean endOfLine, String inboundTransferStation, boolean invertDirection, boolean endOfLine,
String outboundTransferStation, boolean longStationLinger) { String inboundTransferStation, String outboundTransferStation,
boolean longStationLinger) {
this.abbreviation = abbreviation; this.abbreviation = abbreviation;
this.name = name; this.name = name;
this.invertDirection = invertDirection; this.invertDirection = invertDirection;
this.inboundTransferStation = inboundTransferStation; this.inboundTransferStation = inboundTransferStation;
this.transferFriendly = transferFriendly;
this.outboundTransferStation = outboundTransferStation; this.outboundTransferStation = outboundTransferStation;
this.endOfLine = endOfLine; this.endOfLine = endOfLine;
this.longStationLinger = longStationLinger; this.longStationLinger = longStationLinger;
@ -160,6 +164,12 @@ public enum Station {
} else { } else {
route.setTransfer(false); route.setTransfer(false);
} }
if (route.hasTransfer() && !transferFriendly
&& !Line.YELLOW_ORANGE_SCHEDULED_TRANSFER.equals(line)) {
continue;
}
returnList.add(route); returnList.add(route);
} }
if (isNorth == null) { if (isNorth == null) {