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


Java MDirectionType类代码示例

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


MDirectionType类属于org.mtransit.parser.mt.data包,在下文中一共展示了MDirectionType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTripHeadsign

import org.mtransit.parser.mt.data.MDirectionType; //导入依赖的package包/类
@Override
public void setTripHeadsign(MRoute mRoute, MTrip mTrip, GTrip gTrip, GSpec gtfs) {
	if (ALL_ROUTE_TRIPS2.containsKey(mRoute.getId())) {
		return; // split
	}
	if (gTrip.getRouteId().endsWith(RID_ENDS_WITH_N)) {
		mTrip.setHeadsignDirection(MDirectionType.NORTH);
		return;
	} else if (gTrip.getRouteId().endsWith(RID_ENDS_WITH_S)) {
		mTrip.setHeadsignDirection(MDirectionType.SOUTH);
		return;
	}
	if (mRoute.getId() == 116l) {
		mTrip.setHeadsignDirection(MDirectionType.NORTH);
		return;
	} else if (mRoute.getId() == 216l) {
		mTrip.setHeadsignDirection(MDirectionType.SOUTH);
		return;
	}
	System.out.printf("\n%s: Unexpected trip %s!\n", mRoute.getId(), gTrip);
	System.exit(-1);
}
 
开发者ID:mtransitapps,项目名称:ca-fredericton-transit-bus-parser,代码行数:23,代码来源:FrederictonTransitBusAgencyTools.java

示例2: setTripHeadsign

import org.mtransit.parser.mt.data.MDirectionType; //导入依赖的package包/类
@Override
public void setTripHeadsign(MRoute mRoute, MTrip mTrip, GTrip gTrip, GSpec gtfs) {
	String gTripHeadsignLC = gTrip.getTripHeadsign().toLowerCase(Locale.ENGLISH);
	if (gTripHeadsignLC.endsWith(NORTH) || gTripHeadsignLC.endsWith(NORTHBOUND)) {
		mTrip.setHeadsignDirection(MDirectionType.NORTH);
		return;
	} else if (gTripHeadsignLC.endsWith(SOUTH) || gTripHeadsignLC.endsWith(SOUTHBOUND)) {
		mTrip.setHeadsignDirection(MDirectionType.SOUTH);
		return;
	} else if (gTripHeadsignLC.endsWith(EAST) || gTripHeadsignLC.endsWith(EASTBOUND)) {
		mTrip.setHeadsignDirection(MDirectionType.EAST);
		return;
	} else if (gTripHeadsignLC.endsWith(WEST) || gTripHeadsignLC.endsWith(WESTBOUND)) {
		mTrip.setHeadsignDirection(MDirectionType.WEST);
		return;
	}
	mTrip.setHeadsignString(cleanTripHeadsign(gTrip.getTripHeadsign()), gTrip.getDirectionId());
}
 
开发者ID:mtransitapps,项目名称:ca-mississauga-miway-bus-parser,代码行数:19,代码来源:MississaugaMiWayBusAgencyTools.java

示例3: setTripHeadsign

import org.mtransit.parser.mt.data.MDirectionType; //导入依赖的package包/类
@Override
public void setTripHeadsign(MRoute mRoute, MTrip mTrip, GTrip gTrip, GSpec gtfs) {
	if (ALL_ROUTE_TRIPS2.containsKey(mRoute.getId())) {
		return; // split
	}
	if (mRoute.getId() == 2l) {
		if ("Countryside".equalsIgnoreCase(gTrip.getTripHeadsign())) {
			mTrip.setHeadsignString(gTrip.getTripHeadsign(), MDirectionType.SOUTH.intValue());
			return;
		} else if ("High School".equalsIgnoreCase(gTrip.getTripHeadsign())) {
			mTrip.setHeadsignString(gTrip.getTripHeadsign(), MDirectionType.NORTH.intValue());
			return;
		}
		System.out.printf("\n%s: Unexpected trip %s!\n", mRoute.getId(), gTrip);
		System.exit(-1);
		return;
	} else if (mRoute.getId() == 5l) {
		String gTripHeadsignLC = gTrip.getTripHeadsign().toLowerCase(Locale.ENGLISH);
		if (gTripHeadsignLC.endsWith("east")) {
			mTrip.setHeadsignDirection(MDirectionType.EAST);
			return;
		} else if (gTripHeadsignLC.endsWith("west")) {
			mTrip.setHeadsignDirection(MDirectionType.WEST);
			return;
		}
		System.out.printf("\n%s: Unexpected trip %s!\n", mRoute.getId(), gTrip);
		System.exit(-1);
		return;
	}
	String tripHeadsign = gTrip.getTripHeadsign();
	if (StringUtils.isEmpty(tripHeadsign)) {
		tripHeadsign = mRoute.getLongName();
	}
	int directionId = gTrip.getDirectionId() == null ? 0 : gTrip.getDirectionId();
	mTrip.setHeadsignString(cleanTripHeadsign(tripHeadsign), directionId);
}
 
开发者ID:mtransitapps,项目名称:ca-grande-prairie-transit-bus-parser,代码行数:37,代码来源:GrandePrairieTransitBusAgencyTools.java

示例4: setTripHeadsign

import org.mtransit.parser.mt.data.MDirectionType; //导入依赖的package包/类
@Override
public void setTripHeadsign(MRoute mRoute, MTrip mTrip, GTrip gTrip, GSpec gtfs) {
	if (ALL_ROUTE_TRIPS2.containsKey(mRoute.getId())) {
		return; // split
	}
	if (mRoute.getId() == 2l) {
		if (gTrip.getRouteId().equals(_2EB)) {
			mTrip.setHeadsignDirection(MDirectionType.EAST);
			return;
		} else if (gTrip.getRouteId().equals(_2WB)) {
			mTrip.setHeadsignDirection(MDirectionType.WEST);
			return;
		}
	} else if (mRoute.getId() == 40l) {
		mTrip.setHeadsignString(BLUE, 0);
		return;
	} else if (mRoute.getId() == 41l) {
		mTrip.setHeadsignString(GREEN, 0);
		return;
	}
	if (gTrip.getRouteId().endsWith(AM)) {
		mTrip.setHeadsignString(AM, 0);
		return;
	} else if (gTrip.getRouteId().endsWith(PM)) {
		mTrip.setHeadsignString(PM, 1);
		return;
	}
	System.out.printf("\n%s: Unexpected trip %s!\n", mRoute.getId(), gTrip);
	System.exit(-1);
}
 
开发者ID:mtransitapps,项目名称:ca-milton-transit-bus-parser,代码行数:31,代码来源:MiltonTransitBusAgencyTools.java

示例5: setTripHeadsign

import org.mtransit.parser.mt.data.MDirectionType; //导入依赖的package包/类
@Override
public void setTripHeadsign(MRoute mRoute, MTrip mTrip, GTrip gTrip, GSpec gtfs) {
	if (mRoute.getId() == RID_WCE) {
		if (gTrip.getDirectionId() == 0) {
			mTrip.setHeadsignDirection(MDirectionType.EAST);
			return;
		} else if (gTrip.getDirectionId() == 1) {
			mTrip.setHeadsignDirection(MDirectionType.WEST);
			return;
		}
	}
	System.out.printf("Unexpected trip (unexpected route ID: %s): %s\n", mRoute.getId(), gTrip);
	System.exit(-1);
}
 
开发者ID:mtransitapps,项目名称:ca-west-coast-express-bus-parser,代码行数:15,代码来源:WestCoastExpressBusAgencyTools.java

示例6: setTripHeadsign

import org.mtransit.parser.mt.data.MDirectionType; //导入依赖的package包/类
@Override
public void setTripHeadsign(MRoute mRoute, MTrip mTrip, GTrip gTrip, GSpec gtfs) {
	if (ALL_ROUTE_TRIPS2.containsKey(mRoute.getId())) {
		return; // split
	}
	if (mRoute.getId() == 96l) {
		if (gTrip.getTripHeadsign().toLowerCase(Locale.ENGLISH).contains("guildford")) {
			if (gTrip.getDirectionId() == 0) {
				mTrip.setHeadsignString(GUILDFORD, gTrip.getDirectionId());
				return;
			}
			System.out.printf("\nUnexpected route trip head sign for %s!\n", gTrip);
			System.exit(-1);
			return;
		}
	} else if (mRoute.getId() == 555l) {
		if (gTrip.getDirectionId() == 0) {
			mTrip.setHeadsignString(CARVOLTH_EXCH, gTrip.getDirectionId());
			return;
		} else if (gTrip.getDirectionId() == 1) {
			mTrip.setHeadsignString(LOUGHEED_STATION, gTrip.getDirectionId());
			return;
		}
	} else if (mRoute.getId() == 848l) {
		if (SPECIAL_.equalsIgnoreCase(gTrip.getTripHeadsign())) {
			mTrip.setHeadsignString(LOUGHEED_STATION, gTrip.getDirectionId());
			return;
		}
	} else if (mRoute.getId() == 863l) {
		if (SPECIAL_.equalsIgnoreCase(gTrip.getTripHeadsign())) {
			mTrip.setHeadsignDirection(MDirectionType.WEST);
			return;
		}
	} else if (mRoute.getId() == 865l) {
		if (SPECIAL_.equalsIgnoreCase(gTrip.getTripHeadsign())) {
			mTrip.setHeadsignString(HANEY_PLACE, mTrip.getHeadsignId());
			return;
		}
	}
	String gTripHeadsign = gTrip.getTripHeadsign();
	gTripHeadsign = STARTS_WITH_ROUTE.matcher(gTripHeadsign).replaceAll(StringUtils.EMPTY);
	Matcher matcherTO = TO.matcher(gTripHeadsign);
	if (matcherTO.find()) {
		String gTripHeadsignBeforeTO = gTripHeadsign.substring(0, matcherTO.start());
		String gTripHeadsignAfterTO = gTripHeadsign.substring(matcherTO.end());
		if (mRoute.getLongName().equalsIgnoreCase(gTripHeadsignBeforeTO)) {
			gTripHeadsign = gTripHeadsignAfterTO;
		} else if (mRoute.getLongName().equalsIgnoreCase(gTripHeadsignAfterTO)) {
			gTripHeadsign = gTripHeadsignBeforeTO;
		} else {
			gTripHeadsign = gTripHeadsignAfterTO;
		}
	}
	Matcher matcherVIA = VIA.matcher(gTripHeadsign);
	if (matcherVIA.find()) {
		String gTripHeadsignBeforeVIA = gTripHeadsign.substring(0, matcherVIA.start());
		String gTripHeadsignAfterVIA = gTripHeadsign.substring(matcherVIA.end());
		if (mRoute.getLongName().equalsIgnoreCase(gTripHeadsignBeforeVIA)) {
			gTripHeadsign = gTripHeadsignAfterVIA;
		} else if (mRoute.getLongName().equalsIgnoreCase(gTripHeadsignAfterVIA)) {
			gTripHeadsign = gTripHeadsignBeforeVIA;
		} else {
			gTripHeadsign = gTripHeadsignBeforeVIA;
		}
	}
	mTrip.setHeadsignString(cleanTripHeadsign(gTripHeadsign), gTrip.getDirectionId());
}
 
开发者ID:mtransitapps,项目名称:ca-vancouver-translink-bus-parser,代码行数:68,代码来源:VancouverTransLinkBusAgencyTools.java

示例7: setTripHeadsign

import org.mtransit.parser.mt.data.MDirectionType; //导入依赖的package包/类
@Override
public void setTripHeadsign(MRoute mRoute, MTrip mTrip, GTrip gTrip, GSpec gtfs) {
	String gTripHeadsignLC = gTrip.getTripHeadsign().toLowerCase(Locale.ENGLISH);
	if (gTripHeadsignLC.startsWith(EAST)) {
		mTrip.setHeadsignDirection(MDirectionType.EAST);
		return;
	} else if (gTripHeadsignLC.startsWith(WEST)) {
		mTrip.setHeadsignDirection(MDirectionType.WEST);
		return;
	} else if (gTripHeadsignLC.startsWith(NORTH)) {
		mTrip.setHeadsignDirection(MDirectionType.NORTH);
		return;
	} else if (gTripHeadsignLC.startsWith(SOUTH)) {
		mTrip.setHeadsignDirection(MDirectionType.SOUTH);
		return;
	}
	if (mRoute.getId() == 504l) {
		if (gTrip.getDirectionId() == 0) {
			mTrip.setHeadsignDirection(MDirectionType.EAST);
			return;
		} else if (gTrip.getDirectionId() == 1) {
			mTrip.setHeadsignDirection(MDirectionType.WEST);
			return;
		}
	}
	if (mRoute.getId() == 505l) {
		if (gTrip.getDirectionId() == 0) {
			mTrip.setHeadsignDirection(MDirectionType.EAST);
			return;
		} else if (gTrip.getDirectionId() == 1) {
			mTrip.setHeadsignDirection(MDirectionType.WEST);
			return;
		}
	}
	if (mRoute.getId() == 509l) {
		if (gTrip.getDirectionId() == 0) {
			mTrip.setHeadsignDirection(MDirectionType.EAST);
			return;
		} else if (gTrip.getDirectionId() == 1) {
			mTrip.setHeadsignDirection(MDirectionType.WEST);
			return;
		}
	}
	System.out.printf("%s: Unexpected trip %s!", mRoute.getId(), gTrip);
	System.exit(-1);
}
 
开发者ID:mtransitapps,项目名称:ca-toronto-ttc-light-rail-parser,代码行数:47,代码来源:TorontoTTCLightRailAgencyTools.java

示例8: setTripHeadsign

import org.mtransit.parser.mt.data.MDirectionType; //导入依赖的package包/类
@Override
public void setTripHeadsign(MRoute mRoute, MTrip mTrip, GTrip gTrip, GSpec gtfs) {
	String directionIdString = gTrip.getRouteId().substring(gTrip.getRouteId().length() - 1);
	mTrip.setHeadsignDirection(MDirectionType.parse(directionIdString));
}
 
开发者ID:mtransitapps,项目名称:ca-laval-stl-bus-parser,代码行数:6,代码来源:LavalSTLBusAgencyTools.java


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