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


Java GStop類代碼示例

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


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

示例1: getStopCode

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public String getStopCode(GStop gStop) {
	if (ZERO_0.equals(gStop.getStopCode())) {
		if (gStop.getStopId().startsWith(STC_F_STOP)) {
			return gStop.getStopId().substring(STC_F_STOP.length());
		}
		if (gStop.getStopId().startsWith(STC_F2015_STOP)) {
			return gStop.getStopId().substring(STC_F2015_STOP.length());
		}
		if (gStop.getStopId().startsWith(STC_F2015_STO)) {
			return gStop.getStopId().substring(STC_F2015_STO.length());
		}
		return null;
	}
	if (gStop.getStopCode().startsWith(STO)) {
		return gStop.getStopCode().substring(STO.length());
	}
	if (!Utils.isDigitsOnly(gStop.getStopCode())) {
		return null;
	}
	return super.getStopCode(gStop);
}
 
開發者ID:mtransitapps,項目名稱:ca-st-catharines-transit-bus-parser,代碼行數:23,代碼來源:StCatharinesTransitBusAgencyTools.java

示例2: getStopId

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public int getStopId(GStop gStop) {
	if (Utils.isDigitsOnly(gStop.getStopCode())) {
		return Integer.parseInt(gStop.getStopCode()); // use stop code as stop ID
	}
	Matcher matcher = DIGITS.matcher(gStop.getStopCode());
	if (matcher.find()) {
		int digits = Integer.parseInt(matcher.group());
		if (gStop.getStopCode().startsWith("MESC")) {
			return 13050000 + digits;
		}
	}
	System.out.printf("\nUnexpected stop ID for %s!\n", gStop);
	System.exit(-1);
	return -1;
}
 
開發者ID:mtransitapps,項目名稱:ca-lethbridge-transit-bus-parser,代碼行數:17,代碼來源:LethbridgeTransitBusAgencyTools.java

示例3: getStopId

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public int getStopId(GStop gStop) {
	try {
		if (!StringUtils.isEmpty(gStop.getStopCode()) && Utils.isDigitsOnly(gStop.getStopCode())) {
			return Integer.parseInt(gStop.getStopCode()); // use stop code as stop ID
		}
		if (Utils.isDigitsOnly(gStop.getStopId())) {
			return 100000 + Integer.parseInt(gStop.getStopId());
		}
		Matcher matcher = DIGITS.matcher(gStop.getStopId());
		if (matcher.find()) {
			return 100000 + Integer.parseInt(matcher.group());
		}
		System.out.printf("\nUnexpected stop ID for %s!\n", gStop);
		System.exit(-1);
		return -1;
	} catch (Exception e) {
		System.out.printf("\nUnexpected stop ID error for %s!\n", gStop);
		e.printStackTrace();
		System.exit(-1);
		return -1;
	}
}
 
開發者ID:mtransitapps,項目名稱:ca-london-transit-bus-parser,代碼行數:24,代碼來源:LondonTransitBusAgencyTools.java

示例4: getStopId

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public int getStopId(GStop gStop) {
	if (!Utils.isDigitsOnly(gStop.getStopId())) {
		Matcher matcher = DIGITS.matcher(gStop.getStopId());
		if (matcher.find()) {
			int digits = Integer.parseInt(matcher.group());
			if (gStop.getStopId().toLowerCase(Locale.ENGLISH).endsWith("a")) {
				return 100000 + digits;
			}
		}
		System.out.printf("\nUnexpected stop ID for %s!\n", gStop);
		System.exit(-1);
		return -1;
	}
	return super.getStopId(gStop);
}
 
開發者ID:mtransitapps,項目名稱:ca-gatineau-sto-bus-parser,代碼行數:17,代碼來源:GatineauSTOBusAgencyTools.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
	}
	Matcher matcher = DIGITS.matcher(gStop.getStopId());
	if (matcher.find()) {
		int digits = Integer.parseInt(matcher.group());
		int stopId;
		System.out.printf("\nStop doesn't have an ID (start with) %s!\n", gStop);
		System.exit(-1);
		stopId = -1;
		System.out.printf("\nStop doesn't have an ID (end with) %s!\n", gStop);
		System.exit(-1);
		return stopId + digits;
	}
	System.out.printf("\nUnexpected stop ID for %s!\n", gStop);
	System.exit(-1);
	return -1;
}
 
開發者ID:mtransitapps,項目名稱:ca-l-assomption-mrclasso-bus-parser,代碼行數:22,代碼來源:LAssomptionMRCLASSOBusAgencyTools.java

示例6: getStopCode

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public String getStopCode(GStop gStop) {
	if ("0".equals(gStop.getStopCode())) {
		if ("SCA1A".equals(gStop.getStopId())) {
			return "70001";
		} else if ("CHT178A".equals(gStop.getStopId())) {
			return "70178";
		} else if ("CHT300B".equals(gStop.getStopId())) {
			return "70300";
		} else if ("CHT265D".equals(gStop.getStopId())) {
			return "70265";
		} else if ("CHT229L".equals(gStop.getStopId())) {
			return "70229";
		} else if ("CHT264D".equals(gStop.getStopId())) {
			return "70264";
		} else {
			System.out.println("Stop doesn't have an ID! " + gStop);
			System.exit(-1);
		}
	}
	return super.getStopCode(gStop);
}
 
開發者ID:mtransitapps,項目名稱:ca-sud-ouest-citso-bus-parser,代碼行數:23,代碼來源:SudOuestCITSOBusAgencyTools.java

示例7: 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;
}
 
開發者ID:mtransitapps,項目名稱:ca-montreal-amt-train-parser,代碼行數:22,代碼來源:MontrealAMTTrainAgencyTools.java

示例8: compareEarly

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public int compareEarly(long routeId, List<MTripStop> list1, List<MTripStop> list2, MTripStop ts1, MTripStop ts2, GStop ts1GStop, GStop ts2GStop) {
	if (ALL_ROUTE_TRIPS2.containsKey(routeId)) {
		return ALL_ROUTE_TRIPS2.get(routeId).compare(routeId, list1, list2, ts1, ts2, ts1GStop, ts2GStop);
	}
	return super.compareEarly(routeId, list1, list2, ts1, ts2, ts1GStop, ts2GStop);
}
 
開發者ID:mtransitapps,項目名稱:ca-vernon-transit-system-bus-parser,代碼行數:8,代碼來源:VernonTransitSystemBusAgencyTools.java

示例9: getStopId

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

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

示例11: compareEarly

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public int compareEarly(long routeId, List<MTripStop> list1, List<MTripStop> list2, MTripStop ts1, MTripStop ts2, GStop ts1GStop, GStop ts2GStop) {
	if (ALL_ROUTE_TRIPS2.containsKey(routeId)) {
		return ALL_ROUTE_TRIPS2.get(routeId).compare(routeId, list1, list2, ts1, ts2, ts1GStop, ts2GStop);
	}
	System.out.printf("\n%s: Unexpected compare early route!\n", routeId);
	System.exit(-1);
	return -1;
}
 
開發者ID:mtransitapps,項目名稱:ca-welland-transit-bus-parser,代碼行數:10,代碼來源:WellandTransitBusAgencyTools.java

示例12: excludeStop

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public boolean excludeStop(GStop gStop) {
	if (IGNORE_STOP_ID.matcher(gStop.getStopId()).find()) {
		return true; // other agency
	}
	return super.excludeStop(gStop);
}
 
開發者ID:mtransitapps,項目名稱:ca-st-catharines-transit-bus-parser,代碼行數:8,代碼來源:StCatharinesTransitBusAgencyTools.java

示例13: getStopCode

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public String getStopCode(GStop gStop) {
	if (ZERO.equals(gStop.getStopCode())) {
		return null;
	}
	return super.getStopCode(gStop);
}
 
開發者ID:mtransitapps,項目名稱:ca-sorel-varennes-citsv-bus-parser,代碼行數:8,代碼來源:SorelVarennesCITSVBusAgencyTools.java

示例14: getStopCode

import org.mtransit.parser.gtfs.data.GStop; //導入依賴的package包/類
@Override
public String getStopCode(GStop gStop) {
	if (!StringUtils.isEmpty(gStop.getStopCode()) && Utils.isLettersOnly(gStop.getStopCode())) {
		System.out.printf("\nIgnore stop code '%s' for %s.", gStop.getStopCode(), gStop);
		return null; // ignore stop code without numbers
	}
	return super.getStopCode(gStop);
}
 
開發者ID:mtransitapps,項目名稱:ca-maritime-bus-parser,代碼行數:9,代碼來源:MaritimeBusAgencyTools.java

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


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