當前位置: 首頁>>代碼示例>>Java>>正文


Java GStop.getStopId方法代碼示例

本文整理匯總了Java中org.mtransit.parser.gtfs.data.GStop.getStopId方法的典型用法代碼示例。如果您正苦於以下問題:Java GStop.getStopId方法的具體用法?Java GStop.getStopId怎麽用?Java GStop.getStopId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.mtransit.parser.gtfs.data.GStop的用法示例。


在下文中一共展示了GStop.getStopId方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getStopCode

import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public String getStopCode(GStop gStop) {
	if (Utils.isDigitsOnly(gStop.getStopId())) {
		return gStop.getStopId(); // using stop ID as stop code ("GoTime" number)
	}
	Matcher matcher = DIGITS.matcher(gStop.getStopId());
	matcher.find();
	return matcher.group();
}
 
開發者ID:mtransitapps,項目名稱:ca-halifax-transit-ferry-parser,代碼行數:10,代碼來源:HalifaxTransitFerryAgencyTools.java

示例2: getStopId

import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public int getStopId(GStop gStop) {
	String stopId = gStop.getStopId();
	if (stopId != null && stopId.length() > 0 && Utils.isDigitsOnly(stopId)) {
		return Integer.valueOf(stopId); // using stop code as stop ID
	}
	if (PLACE_CATC.equals(stopId)) {
		return 10000000;
	} else if (PLACE_CHCA.equals(stopId)) {
		return 11000000;
	} else if (PLACE_DWNP.equals(stopId)) {
		return 12000000;
	} else if (PLACE_GRDC.equals(stopId)) {
		return 13000000;
	} else if (PLACE_KNGC.equals(stopId)) {
		return 14000000;
	} else if (PLACE_MSPR.equals(stopId)) {
		return 15000000;
	} else if (PLACE_RAIL.equals(stopId)) {
		return 16000000;
	}
	try {
		Matcher matcher = DIGITS.matcher(stopId);
		matcher.find();
		int digits = Integer.parseInt(matcher.group());
		return digits;
	} catch (Exception e) {
		System.out.println("Error while finding stop ID for " + gStop);
		e.printStackTrace();
		System.exit(-1);
		return -1;
	}
}
 
開發者ID:mtransitapps,項目名稱:ca-kingston-transit-bus-parser,代碼行數:34,代碼來源:KingstonTransitBusAgencyTools.java

示例3: 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

示例4: getStopCode

import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public String getStopCode(GStop gStop) {
	return gStop.getStopId(); // using stop ID as stop code
}
 
開發者ID:mtransitapps,項目名稱:ca-quebec-rtc-bus-parser,代碼行數:5,代碼來源:QuebecRTCBusAgencyTools.java

示例5: getStopId

import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public int getStopId(GStop gStop) {
	String stopCode = getStopCode(gStop);
	if (stopCode != null && stopCode.length() > 0) {
		return Integer.valueOf(stopCode); // using stop code as stop ID
	}
	String stopIds = gStop.getStopId();
	int index = stopIds.indexOf(_MERGED);
	if (index >= 0) {
		stopIds = stopIds.substring(0, index);
	}
	Matcher matcher = DIGITS.matcher(stopIds);
	matcher.find();
	int digits = Integer.parseInt(matcher.group());
	int stopId;
	if (stopIds.startsWith(DDO)) {
		stopId = 100000;
	} else if (stopIds.startsWith(HUD)) {
		stopId = 200000;
	} else if (stopIds.startsWith(LIP)) {
		stopId = 300000;
	} else if (stopIds.startsWith(NIP)) {
		stopId = 400000;
	} else if (stopIds.startsWith(PCL)) {
		stopId = 500000;
	} else if (stopIds.startsWith(PIN)) {
		stopId = 600000;
	} else if (stopIds.startsWith(RIG)) {
		stopId = 700000;
	} else if (stopIds.startsWith(SAB)) {
		stopId = 800000;
	} else if (stopIds.startsWith(SGV)) {
		stopId = 900000;
	} else if (stopIds.startsWith(SLR)) {
		stopId = 1000000;
	} else if (stopIds.startsWith(SLZ)) {
		stopId = 1100000;
	} else if (stopIds.startsWith(VAU)) {
		stopId = 1200000;
	} else {
		System.out.printf("\nStop doesn't have an ID (start with)! %s!\n", gStop);
		System.exit(-1);
		stopId = -1;
	}
	if (stopIds.endsWith(A)) {
		stopId += 1000;
	} else if (stopIds.endsWith(B)) {
		stopId += 2000;
	} else if (stopIds.endsWith(C)) {
		stopId += 3000;
	} else if (stopIds.endsWith(D)) {
		stopId += 4000;
	} else if (stopIds.endsWith(E)) {
		stopId += 5000;
	} else if (stopIds.endsWith(F)) {
		stopId += 6000;
	} else if (stopIds.endsWith(G)) {
		stopId += 7000;
	} else if (stopIds.endsWith(H)) {
		stopId += 8000;
	} else {
		System.out.printf("\nStop doesn't have an ID (end with)! %s!\n", gStop);
		System.exit(-1);
	}
	return stopId + digits;
}
 
開發者ID:mtransitapps,項目名稱:ca-la-presqu-ile-citpi-bus-parser,代碼行數:67,代碼來源:LaPresquIleCITPIBusAgencyTools.java

示例6: getStopId

import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public int getStopId(GStop gStop) {
	String stopCode = getStopCode(gStop);
	if (stopCode != null && stopCode.length() > 0) {
		return Integer.valueOf(stopCode); // using stop code as stop ID
	}
	String stop_id = gStop.getStopId();
	int indexOf = stop_id.indexOf(_MERGED);
	if (indexOf >= 0) {
		stop_id = stop_id.substring(0, indexOf);
	}
	Matcher matcher = DIGITS.matcher(stop_id);
	matcher.find();
	int digits = Integer.parseInt(matcher.group());
	int stopId;
	if (stop_id.startsWith(BEL)) {
		stopId = 100000;
	} else if (stop_id.startsWith(MMS)) {
		stopId = 200000;
	} else if (stop_id.startsWith(MSH)) {
		stopId = 300000;
	} else if (stop_id.startsWith(OTP)) {
		stopId = 400000;
	} else if (stop_id.startsWith(SBA)) {
		stopId = 500000;
	} else if (stop_id.startsWith(SJU)) {
		stopId = 600000;
	} else if (stop_id.startsWith(SHY)) {
		stopId = 700000;
	} else if (stop_id.startsWith(LON)) {
		stopId = 800000;
	} else {
		System.out.println("Stop doesn't have an ID (start with)! " + gStop);
		System.exit(-1);
		stopId = -1;
	}
	if (stop_id.endsWith(A)) {
		stopId += 1000;
	} else if (stop_id.endsWith(B)) {
		stopId += 2000;
	} else if (stop_id.endsWith(C)) {
		stopId += 3000;
	} else if (stop_id.endsWith(D)) {
		stopId += 4000;
	} else if (stop_id.endsWith(E)) {
		stopId += 5000;
	} else if (stop_id.endsWith(F)) {
		stopId += 6000;
	} else if (stop_id.endsWith(G)) {
		stopId += 7000;
	} else if (stop_id.endsWith(H)) {
		stopId += 8000;
	} else {
		System.out.println("Stop doesn't have an ID (end with)! " + gStop);
		System.exit(-1);
	}
	return stopId + digits;
}
 
開發者ID:mtransitapps,項目名稱:ca-richelieu-citvr-bus-parser,代碼行數:59,代碼來源:ValleeDuRichelieuCITVRBusAgencyTools.java

示例7: getStopCode

import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public String getStopCode(GStop gStop) {
	return gStop.getStopId(); // use stop ID as stop code, used by real-time API, do not change
}
 
開發者ID:mtransitapps,項目名稱:ca-sudbury-transit-bus-parser,代碼行數:5,代碼來源:SudburyTransitBusAgencyTools.java

示例8: getStopCode

import org.mtransit.parser.gtfs.data.GStop; //導入方法依賴的package包/類
@Override
public String getStopCode(GStop gStop) {
	return gStop.getStopId(); // using stop ID as stop code (useful to match with GTFS real-time)
}
 
開發者ID:mtransitapps,項目名稱:ca-montreal-amt-train-parser,代碼行數:5,代碼來源:MontrealAMTTrainAgencyTools.java


注:本文中的org.mtransit.parser.gtfs.data.GStop.getStopId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。