当前位置: 首页>>代码示例>>Java>>正文


Java Utils.isDigitsOnly方法代码示例

本文整理汇总了Java中org.mtransit.parser.Utils.isDigitsOnly方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.isDigitsOnly方法的具体用法?Java Utils.isDigitsOnly怎么用?Java Utils.isDigitsOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mtransit.parser.Utils的用法示例。


在下文中一共展示了Utils.isDigitsOnly方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRouteId

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public long getRouteId(GRoute gRoute) {
	if (R_WE_NF.equals(gRoute.getRouteId())) {
		return 14001l;
	} else if (R_WE_NOTL.equals(gRoute.getRouteId())) {
		return 14002l;
	} else if (R_PC001.equals(gRoute.getRouteId())) {
		return R_PC001_ID;
	} else if (R_PC002.equals(gRoute.getRouteId())) {
		return R_PC002_ID;
	} else if (R_WEPC.equals(gRoute.getRouteId())) {
		return R_WEPC_ID;
	} else if (R_WESC.equals(gRoute.getRouteId())) {
		return 19001l;
	} else if (gRoute.getRouteId().startsWith(R_WE0)) {
		if (gRoute.getRouteShortName() != null && gRoute.getRouteShortName().length() > 0 && Utils.isDigitsOnly(gRoute.getRouteShortName())) {
			return Long.parseLong(gRoute.getRouteShortName()); // using route short name as route ID
		}
	}
	System.out.printf("\nUnexpected route ID for %s!\n", gRoute);
	System.exit(-1);
	return -1l;
}
 
开发者ID:mtransitapps,项目名称:ca-welland-transit-bus-parser,代码行数:24,代码来源:WellandTransitBusAgencyTools.java

示例2: getRouteShortName

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public String getRouteShortName(GRoute gRoute) {
	if (R_WE_NF.equals(gRoute.getRouteId())) {
		return NF;
	} else if (R_WE_NOTL.equals(gRoute.getRouteId())) {
		return NOTL;
	} else if (R_PC001.equals(gRoute.getRouteId())) {
		return PC1EAST;
	} else if (R_PC002.equals(gRoute.getRouteId())) {
		return PC2WEST;
	} else if (R_WEPC.equals(gRoute.getRouteId())) {
		return PCL;
	} else if (R_WESC.equals(gRoute.getRouteId())) {
		return BL;
	} else if (gRoute.getRouteId().startsWith(R_WE0)) {
		if (gRoute.getRouteShortName() != null && gRoute.getRouteShortName().length() > 0 && Utils.isDigitsOnly(gRoute.getRouteShortName())) {
			return gRoute.getRouteShortName();
		}
	}
	System.out.printf("\nUnexpected route short name for %s!\n", gRoute);
	System.exit(-1);
	return null;
}
 
开发者ID:mtransitapps,项目名称:ca-welland-transit-bus-parser,代码行数:24,代码来源:WellandTransitBusAgencyTools.java

示例3: getStopCode

import org.mtransit.parser.Utils; //导入方法依赖的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

示例4: getStopId

import org.mtransit.parser.Utils; //导入方法依赖的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.Utils; //导入方法依赖的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

示例6: getRouteId

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public long getRouteId(GRoute gRoute) {
	if (Utils.isDigitsOnly(gRoute.getRouteShortName())) {
		return Long.parseLong(gRoute.getRouteShortName()); // using route short name as route ID
	}
	Matcher matcher = DIGITS.matcher(gRoute.getRouteShortName());
	matcher.find();
	long digits = Long.parseLong(matcher.group());
	if (gRoute.getRouteShortName().endsWith("a")) {
		return 10000l + digits;
	} else if (gRoute.getRouteShortName().endsWith("b")) {
		return 20000l + digits;
	} else if (gRoute.getRouteShortName().endsWith("g")) {
		return 70000l + digits;
	} else if (gRoute.getRouteShortName().endsWith("h")) {
		return 80000l + digits;
	}
	System.out.printf("\nUnexpected route ID for %s!\n", gRoute);
	System.exit(-1);
	return -1l;
}
 
开发者ID:mtransitapps,项目名称:ca-quebec-rtc-bus-parser,代码行数:22,代码来源:QuebecRTCBusAgencyTools.java

示例7: getRouteShortName

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public String getRouteShortName(GRoute gRoute) {
	if (Utils.isDigitsOnly(gRoute.getRouteShortName())) {
		int rsn = Integer.parseInt(gRoute.getRouteShortName());
		switch (rsn) {
		// @formatter:off
		case 300: return RSN_RED; // Red
		case 301: return RSN_BLUE; // Blue
		case 302: return RSN_GREEN; // Green
		// @formatter:on
		default:
			System.out.printf("\nUnexpected route long name for %s!\n", gRoute);
			System.exit(-1);
			return null;
		}
	}
	return super.getRouteShortName(gRoute); // used by real-time API
}
 
开发者ID:mtransitapps,项目名称:ca-niagara-falls-wego-bus-parser,代码行数:19,代码来源:NiagaraFallsWEGOBusAgencyTools.java

示例8: getRouteId

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public long getRouteId(GRoute gRoute) {
	if (gRoute.getRouteShortName() != null && gRoute.getRouteShortName().length() > 0 && Utils.isDigitsOnly(gRoute.getRouteShortName())) {
		return Long.parseLong(gRoute.getRouteShortName()); // use route short name as route ID
	}
	int indexOf;
	indexOf = gRoute.getRouteShortName().indexOf(EB);
	if (indexOf >= 0) {
		return Long.parseLong(gRoute.getRouteShortName().substring(0, indexOf)); // use route short name as route ID
	}
	indexOf = gRoute.getRouteShortName().indexOf(WB);
	if (indexOf >= 0) {
		return Long.parseLong(gRoute.getRouteShortName().substring(0, indexOf)); // use route short name as route ID
	}
	indexOf = gRoute.getRouteShortName().indexOf(AM);
	if (indexOf >= 0) {
		return Long.parseLong(gRoute.getRouteShortName().substring(0, indexOf)); // use route short name as route ID
	}
	indexOf = gRoute.getRouteShortName().indexOf(PM);
	if (indexOf >= 0) {
		return Long.parseLong(gRoute.getRouteShortName().substring(0, indexOf)); // use route short name as route ID
	}
	Matcher matcher = DIGITS.matcher(gRoute.getRouteShortName());
	matcher.find();
	long id = Long.parseLong(matcher.group());
	if (gRoute.getRouteShortName().endsWith(A)) {
		return ROUTE_ID_ENDS_WITH_A + id;
	} else if (gRoute.getRouteShortName().endsWith(B)) {
		return ROUTE_ID_ENDS_WITH_B + id;
	}
	System.out.printf("\nUnexpected route ID for %s!\n", gRoute);
	System.exit(-1);
	return -1l;
}
 
开发者ID:mtransitapps,项目名称:ca-milton-transit-bus-parser,代码行数:35,代码来源:MiltonTransitBusAgencyTools.java

示例9: getStopCode

import org.mtransit.parser.Utils; //导入方法依赖的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

示例10: getStopId

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public int getStopId(GStop gStop) {
	if (!StringUtils.isEmpty(gStop.getStopCode()) && Utils.isDigitsOnly(gStop.getStopCode())) {
		return Integer.parseInt(gStop.getStopCode()); // using stop code as stop ID
	}
	return 1000000 + Integer.parseInt(gStop.getStopId());
}
 
开发者ID:mtransitapps,项目名称:ca-vancouver-translink-bus-parser,代码行数:8,代码来源:VancouverTransLinkBusAgencyTools.java

示例11: getRouteId

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public long getRouteId(GRoute gRoute) {
	if (!Utils.isDigitsOnly(gRoute.getRouteId())) {
		return Long.parseLong(gRoute.getRouteShortName());
	}
	return super.getRouteId(gRoute);
}
 
开发者ID:mtransitapps,项目名称:ca-sorel-varennes-citsv-bus-parser,代码行数:8,代码来源:SorelVarennesCITSVBusAgencyTools.java

示例12: getRouteShortName

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public String getRouteShortName(GRoute gRoute) {
	if (!Utils.isDigitsOnly(gRoute.getRouteShortName())) {
		Matcher matcher = DIGITS.matcher(gRoute.getRouteShortName());
		if (matcher.find()) {
			return matcher.group();
		}
		System.out.printf("\nUnexpected route short name %s.\n", gRoute);
	}
	return super.getRouteShortName(gRoute);
}
 
开发者ID:mtransitapps,项目名称:ca-maritime-bus-parser,代码行数:12,代码来源:MaritimeBusAgencyTools.java

示例13: getRouteId

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public long getRouteId(GRoute gRoute) {
	if (!Utils.isDigitsOnly(gRoute.getRouteId())) {
		if (gRoute.getRouteLongName().startsWith("1")) {
			if ("MCCONNELL".equals(gRoute.getRouteId())) {
				return 1001l;
			} else if ("PITT".equals(gRoute.getRouteId())) {
				return 1002l;
			}
		} else if (gRoute.getRouteLongName().startsWith("2")) {
			if ("CUMBERLAND".equals(gRoute.getRouteId())) {
				return 2001l;
			} else if ("SUNRISE".equals(gRoute.getRouteId())) {
				return 2002l;
			}
		} else if (gRoute.getRouteLongName().startsWith("3")) {
			if ("BROOKDALE".equals(gRoute.getRouteId())) {
				return 3001l;
			} else if ("MONTREAL".equals(gRoute.getRouteId())) {
				return 3002l;
			}
		} else if (gRoute.getRouteLongName().startsWith("4")) {
			if ("RIVERDALE".equals(gRoute.getRouteId())) {
				return 4001l;
			}
		} else if (gRoute.getRouteLongName().startsWith("61")) {
			return 61l;
		}
		System.out.printf("\nUnexpected route ID for %s!\n", gRoute);
		System.exit(-1);
		return -1l;
	}
	return super.getRouteId(gRoute);
}
 
开发者ID:mtransitapps,项目名称:ca-cornwall-transit-bus-parser,代码行数:35,代码来源:CornwallTransitBusAgencyTools.java

示例14: getRouteShortName

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public String getRouteShortName(GRoute gRoute) {
	String routeShortName = gRoute.getRouteShortName(); // used by real-time API
	if (Utils.isDigitsOnly(routeShortName)) { // used by real-time API
		routeShortName = String.valueOf(Integer.valueOf(routeShortName)); // used by real-time API
	} // used by real-time API
	return routeShortName; // used by real-time API
}
 
开发者ID:mtransitapps,项目名称:ca-vancouver-translink-bus-parser,代码行数:9,代码来源:VancouverTransLinkBusAgencyTools.java

示例15: getRouteColor

import org.mtransit.parser.Utils; //导入方法依赖的package包/类
@Override
public String getRouteColor(GRoute gRoute) {
	if (!Utils.isDigitsOnly(gRoute.getRouteId())) {
		if (RID_B1.equalsIgnoreCase(gRoute.getRouteId())) {
			if (gRoute.getRouteColor().equalsIgnoreCase(COLOR_ECFE25)) {
				return COLOR_702929;
			}
		}
	}
	return super.getRouteColor(gRoute);
}
 
开发者ID:mtransitapps,项目名称:ca-st-albert-transit-bus-parser,代码行数:12,代码来源:StAlbertTransitBusAgencyTools.java


注:本文中的org.mtransit.parser.Utils.isDigitsOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。