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


Java Key.equals方法代码示例

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


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

示例1: stationImageIsReferenced

import com.google.appengine.api.datastore.Key; //导入方法依赖的package包/类
/**
 * Check whether this station image is being referenced (used)
 * in any program in the given station.
 * @param stationImageKey:
 * 			The stationImage key to check
 * @return True if the stationImage is being used in any program,
 * 			False otherwise
 */
public static boolean stationImageIsReferenced(Key stationImageKey) {
	
	List<Program> programs = 
			ProgramManager.getAllProgramsFromStation(
					stationImageKey.getParent(), true);
	for (Program program : programs) {
		
		// Check Slides
		List<Slide> slides =
				SlideManager.getAllSlidesFromProgram(
						program.getKey(), true);
		for (Slide slide : slides) {
			Key slideStationImageKey = slide.getStationImage();
			if (slideStationImageKey != null &&
					slideStationImageKey.equals(stationImageKey)) {
				return true;
			}
		}
	}
	
	// If stationImage not found in any program, then return false
	return false;
}
 
开发者ID:gfigueroa,项目名称:internet-radio-gae,代码行数:32,代码来源:StationImageManager.java

示例2: stationAudioIsReferenced

import com.google.appengine.api.datastore.Key; //导入方法依赖的package包/类
/**
 * Check whether this station audio is being referenced (used)
 * in any program in the given station.
 * @param stationAudioKey:
 * 			The stationAudio key to check
 * @return True if the stationAudio is being used in any program,
 * 			False otherwise
 */
public static boolean stationAudioIsReferenced(Key stationAudioKey) {
	
	List<Program> programs = 
			ProgramManager.getAllProgramsFromStation(
					stationAudioKey.getParent(), true);
	for (Program program : programs) {
		
		// Check MainTrack
		MainTrack mainTrack = program.getMainTrack();
		if (mainTrack != null) {
			Key mainTrackStationAudioKey  = mainTrack.getStationAudio();
			if (mainTrackStationAudioKey != null &&
					mainTrackStationAudioKey.equals(stationAudioKey)) {
				return true;
			}
		}
		
		// Check SecondaryTracks
		List<SecondaryTrack> secondaryTracks =
				SecondaryTrackManager.getAllSecondaryTracksFromProgram(
						program.getKey(), true);
		for (SecondaryTrack secondaryTrack : secondaryTracks) {
			Key secondaryTrackStationAudioKey = secondaryTrack.getStationAudio();
			if (secondaryTrackStationAudioKey != null &&
					secondaryTrackStationAudioKey.equals(stationAudioKey)) {
				return true;
			}
		}
	}
	
	// If stationAudio not found in any program, then return false
	return false;
}
 
开发者ID:gfigueroa,项目名称:internet-radio-gae,代码行数:42,代码来源:StationAudioManager.java


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