本文整理匯總了Java中org.mtransit.parser.gtfs.data.GStop.getStopCode方法的典型用法代碼示例。如果您正苦於以下問題:Java GStop.getStopCode方法的具體用法?Java GStop.getStopCode怎麽用?Java GStop.getStopCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mtransit.parser.gtfs.data.GStop
的用法示例。
在下文中一共展示了GStop.getStopCode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getStopId
import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public int getStopId(GStop gStop) {
String stopCode = gStop.getStopCode();
if (stopCode == null || stopCode.equals(ZERO)) {
System.out.printf("\nUnexpected stop ID %s!\n", gStop);
System.exit(-1);
}
int stopId = Integer.valueOf(stopCode); // using stop code as stop ID
if (gStop.getStopId().endsWith(A)) {
return 1000000 + stopId;
} else if (gStop.getStopId().endsWith(B)) {
return 2000000 + stopId;
} else if (gStop.getStopId().endsWith(C)) {
return 3000000 + stopId;
} else if (gStop.getStopId().endsWith(D)) {
return 4000000 + stopId;
}
System.out.printf("\nUnexpected stop ID %s!\n", gStop);
System.exit(-1);
return -1;
}
示例2: getStopId
import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public int getStopId(GStop gStop) {
String stopCode = gStop.getStopCode();
if (stopCode == null || stopCode.length() == 0 || ZERO_0.equals(stopCode)) {
stopCode = gStop.getStopId();
}
if (Utils.isDigitsOnly(stopCode)) {
return Integer.parseInt(stopCode); // using stop code as stop ID
}
if (stopCode.startsWith(WE42)) {
return 230000000 + Integer.parseInt(stopCode.substring(WE42.length()));
} else if (stopCode.startsWith(WE4)) {
return 231000000 + Integer.parseInt(stopCode.substring(WE4.length()));
} else if (stopCode.startsWith(WE004)) {
return 232000000 + Integer.parseInt(stopCode.substring(WE004.length()));
}
try {
Matcher matcher = DIGITS.matcher(stopCode);
if (matcher.find()) {
int routeId = Integer.parseInt(matcher.group());
if (stopCode.startsWith(NOTL)) {
routeId += 14000000;
} else if (stopCode.startsWith(PC2)) {
routeId += 160000000;
} else if (stopCode.startsWith(PC)) {
routeId += 161000000;
} else if (stopCode.startsWith(WE2)) {
routeId += 233000000;
} else if (stopCode.startsWith(WE)) {
routeId += 234000000;
} else {
System.out.printf("\nUnexpected stop ID (starts with digits) %s!\n", gStop);
System.exit(-1);
routeId = -1;
}
return routeId;
}
} catch (Exception e) {
System.out.printf("\nError while finding stop ID for %s!\n", gStop);
e.printStackTrace();
System.exit(-1);
return -1;
}
System.out.printf("\nUnexpected stop ID %s!\n", gStop);
System.exit(-1);
return -1;
}
開發者ID:mtransitapps,項目名稱:ca-welland-transit-bus-parser,代碼行數:48,代碼來源:WellandTransitBusAgencyTools.java