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


Java Utils类代码示例

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


Utils类属于org.mtransit.parser包,在下文中一共展示了Utils类的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: 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());
	if (matcher.find()) {
		long digits = Long.parseLong(matcher.group());
		if (gRoute.getRouteShortName().toLowerCase(Locale.ENGLISH).endsWith(N)) {
			return RID_STARTS_WITH_N + digits;
		} else if (gRoute.getRouteShortName().toLowerCase(Locale.ENGLISH).endsWith(S)) {
			return RID_STARTS_WITH_S + digits;
		}
	}
	System.out.printf("\nUnexpected route ID for %s!\n", gRoute);
	System.exit(-1);
	return -1l;
}
 
开发者ID:mtransitapps,项目名称:ca-lethbridge-transit-bus-parser,代码行数:19,代码来源:LethbridgeTransitBusAgencyTools.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.getRouteId())) {
		return Long.parseLong(gRoute.getRouteId());
	}
	Matcher matcher = DIGITS.matcher(gRoute.getRouteId());
	matcher.find();
	long id = Long.parseLong(matcher.group());
	if (gRoute.getRouteId().startsWith(A)) {
		return RID_A + id;
	} else if (gRoute.getRouteId().startsWith(B)) {
		return RID_B + id;
	} else if (gRoute.getRouteId().startsWith(F)) {
		return RID_F + id;
	}
	System.out.printf("\nUnexpected route ID %s!\n", gRoute);
	System.exit(-1);
	return -1l;
}
 
开发者ID:mtransitapps,项目名称:ca-st-albert-transit-bus-parser,代码行数:20,代码来源:StAlbertTransitBusAgencyTools.java

示例7: cleanStopName

import org.mtransit.parser.Utils; //导入依赖的package包/类
@Override
public String cleanStopName(String gStopName) {
	if (Utils.isUppercaseOnly(gStopName, true, true)) {
		gStopName = gStopName.toLowerCase(Locale.ENGLISH);
	}
	gStopName = BOUNDS.matcher(gStopName).replaceAll(StringUtils.EMPTY);
	gStopName = ENDS_WITH_STOP_CODE.matcher(gStopName).replaceAll(StringUtils.EMPTY);
	gStopName = HOS.matcher(gStopName).replaceAll(HOS_REPLACEMENT);
	gStopName = CleanUtils.CLEAN_AND.matcher(gStopName).replaceAll(CleanUtils.CLEAN_AND_REPLACEMENT);
	gStopName = CleanUtils.CLEAN_AT.matcher(gStopName).replaceAll(CleanUtils.CLEAN_AT_REPLACEMENT);
	gStopName = CleanUtils.removePoints(gStopName);
	gStopName = CleanUtils.cleanNumbers(gStopName);
	gStopName = CleanUtils.cleanStreetTypes(gStopName);
	gStopName = CleanUtils.cleanStreetTypesFRCA(gStopName);
	return CleanUtils.cleanLabel(gStopName);
}
 
开发者ID:mtransitapps,项目名称:ca-london-transit-bus-parser,代码行数:17,代码来源:LondonTransitBusAgencyTools.java

示例8: getStopId

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

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

示例10: getRouteId

import org.mtransit.parser.Utils; //导入依赖的package包/类
@Override
public long getRouteId(GRoute gRoute) {
	if (Utils.isDigitsOnly(gRoute.getRouteShortName())) {
		return Long.parseLong(gRoute.getRouteShortName()); // use route short name as route ID
	}
	Matcher matcher = DIGITS.matcher(gRoute.getRouteShortName());
	if (matcher.find()) {
		long id = Long.parseLong(matcher.group());
		if (gRoute.getRouteShortName().startsWith(C)) {
			return RID_SW_C + id;
		} else if (gRoute.getRouteShortName().startsWith(N)) {
			return RID_SW_N + id;
		} else if (gRoute.getRouteShortName().startsWith(P)) {
			return RID_SW_P + id;
		}
	}
	System.out.printf("\nUnexpected route ID %s\n", gRoute);
	System.exit(-1);
	return -1l;
}
 
开发者ID:mtransitapps,项目名称:ca-vancouver-translink-bus-parser,代码行数:21,代码来源:VancouverTransLinkBusAgencyTools.java

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

示例12: getRouteId

import org.mtransit.parser.Utils; //导入依赖的package包/类
@Override
public long getRouteId(GRoute gRoute) {
	if (Utils.isDigitsOnly(gRoute.getRouteShortName())) {
		return Long.parseLong(gRoute.getRouteShortName());
	}
	Matcher matcher = DIGITS.matcher(gRoute.getRouteShortName());
	if (matcher.find()) {
		int digits = Integer.parseInt(matcher.group());
		if (gRoute.getRouteShortName().endsWith(B)) {
			return RID_ENDS_WITH_B + digits;
		}
	}
	System.out.printf("\nCan't find route ID for %s!\n", gRoute);
	System.exit(-1);
	return -1l;
}
 
开发者ID:mtransitapps,项目名称:ca-banff-roam-transit-bus-parser,代码行数:17,代码来源:BanffRoamTransitBusAgencyTools.java

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

示例14: cleanStopName

import org.mtransit.parser.Utils; //导入依赖的package包/类
@Override
public String cleanStopName(String stopName) {
	stopName = CLEAN_SUBWAY.matcher(stopName).replaceAll(CLEAN_SUBWAY_REPLACEMENT);
	stopName = CLEAN_SUBWAY2.matcher(stopName).replaceAll(CLEAN_SUBWAY2_REPLACEMENT);
	stopName = CleanUtils.cleanSlashes(stopName);
	stopName = Utils.replaceAll(stopName.trim(), START_WITH_ST, StringUtils.EMPTY);
	stopName = Utils.replaceAll(stopName, SPACE_ST, CleanUtils.SPACE);
	stopName = CleanUtils.cleanLabelFR(stopName);
	StringBuilder resultSB = new StringBuilder();
	String[] words = stopName.split(SLASH);
	for (String word : words) {
		if (!resultSB.toString().contains(word.trim())) {
			if (resultSB.length() > 0) {
				resultSB.append(SPACE).append(SLASH).append(SPACE);
			}
			resultSB.append(word.trim());
		}
	}
	return resultSB.toString();
}
 
开发者ID:mtransitapps,项目名称:ca-montreal-stm-bus-parser,代码行数:21,代码来源:MontrealSTMBusAgencyTools.java

示例15: getStopId

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


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