本文整理汇总了Java中com.google.samples.apps.iosched.io.model.Speaker.getImportHashcode方法的典型用法代码示例。如果您正苦于以下问题:Java Speaker.getImportHashcode方法的具体用法?Java Speaker.getImportHashcode怎么用?Java Speaker.getImportHashcode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.samples.apps.iosched.io.model.Speaker
的用法示例。
在下文中一共展示了Speaker.getImportHashcode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeContentProviderOperations
import com.google.samples.apps.iosched.io.model.Speaker; //导入方法依赖的package包/类
@Override
public void makeContentProviderOperations(ArrayList<ContentProviderOperation> list) {
Uri uri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(
ScheduleContract.Speakers.CONTENT_URI);
HashMap<String, String> speakerHashcodes = loadSpeakerHashcodes();
HashSet<String> speakersToKeep = new HashSet<String>();
boolean isIncrementalUpdate = speakerHashcodes != null && speakerHashcodes.size() > 0;
if (isIncrementalUpdate) {
LOGD(TAG, "Doing incremental update for speakers.");
} else {
LOGD(TAG, "Doing FULL (non incremental) update for speakers.");
list.add(ContentProviderOperation.newDelete(uri).build());
}
int updatedSpeakers = 0;
for (Speaker speaker : mSpeakers.values()) {
String hashCode = speaker.getImportHashcode();
speakersToKeep.add(speaker.id);
// add speaker, if necessary
if (!isIncrementalUpdate || !speakerHashcodes.containsKey(speaker.id) ||
!speakerHashcodes.get(speaker.id).equals(hashCode)) {
++updatedSpeakers;
boolean isNew = !isIncrementalUpdate || !speakerHashcodes.containsKey(speaker.id);
buildSpeaker(isNew, speaker, list);
}
}
int deletedSpeakers = 0;
if (isIncrementalUpdate) {
for (String speakerId : speakerHashcodes.keySet()) {
if (!speakersToKeep.contains(speakerId)) {
buildDeleteOperation(speakerId, list);
++deletedSpeakers;
}
}
}
LOGD(TAG, "Speakers: " + (isIncrementalUpdate ? "INCREMENTAL" : "FULL") + " update. " +
updatedSpeakers + " to update, " + deletedSpeakers + " to delete. New total: " +
mSpeakers.size());
}
示例2: makeContentProviderOperations
import com.google.samples.apps.iosched.io.model.Speaker; //导入方法依赖的package包/类
@Override
public void makeContentProviderOperations(ArrayList<ContentProviderOperation> list) {
Uri uri = ScheduleContract.addCallerIsSyncAdapterParameter(
ScheduleContract.Speakers.CONTENT_URI);
HashMap<String, String> speakerHashcodes = loadSpeakerHashcodes();
HashSet<String> speakersToKeep = new HashSet<String>();
boolean isIncrementalUpdate = speakerHashcodes != null && speakerHashcodes.size() > 0;
if (isIncrementalUpdate) {
LOGD(TAG, "Doing incremental update for speakers.");
} else {
LOGD(TAG, "Doing FULL (non incremental) update for speakers.");
list.add(ContentProviderOperation.newDelete(uri).build());
}
int updatedSpeakers = 0;
for (Speaker speaker : mSpeakers.values()) {
String hashCode = speaker.getImportHashcode();
speakersToKeep.add(speaker.id);
// add speaker, if necessary
if (!isIncrementalUpdate || !speakerHashcodes.containsKey(speaker.id) ||
!speakerHashcodes.get(speaker.id).equals(hashCode)) {
++updatedSpeakers;
boolean isNew = !isIncrementalUpdate || !speakerHashcodes.containsKey(speaker.id);
buildSpeaker(isNew, speaker, list);
}
}
int deletedSpeakers = 0;
if (isIncrementalUpdate) {
for (String speakerId : speakerHashcodes.keySet()) {
if (!speakersToKeep.contains(speakerId)) {
buildDeleteOperation(speakerId, list);
++deletedSpeakers;
}
}
}
LOGD(TAG, "Speakers: " + (isIncrementalUpdate ? "INCREMENTAL" : "FULL") + " update. " +
updatedSpeakers + " to update, " + deletedSpeakers + " to delete. New total: " +
mSpeakers.size());
}
示例3: makeContentProviderOperations
import com.google.samples.apps.iosched.io.model.Speaker; //导入方法依赖的package包/类
@Override
public void makeContentProviderOperations(ArrayList<ContentProviderOperation> list) {
Uri uri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(
ScheduleContract.Speakers.CONTENT_URI);
HashMap<String, String> speakerHashcodes = loadSpeakerHashcodes();
HashSet<String> speakersToKeep = new HashSet<>();
boolean isIncrementalUpdate = speakerHashcodes != null && speakerHashcodes.size() > 0;
if (isIncrementalUpdate) {
LOGD(TAG, "Doing incremental update for speakers.");
} else {
LOGD(TAG, "Doing FULL (non incremental) update for speakers.");
list.add(ContentProviderOperation.newDelete(uri).build());
}
int updatedSpeakers = 0;
for (Speaker speaker : mSpeakers.values()) {
String hashCode = speaker.getImportHashcode();
speakersToKeep.add(speaker.id);
// add speaker, if necessary
if (!isIncrementalUpdate || !speakerHashcodes.containsKey(speaker.id) ||
!speakerHashcodes.get(speaker.id).equals(hashCode)) {
++updatedSpeakers;
boolean isNew = !isIncrementalUpdate || !speakerHashcodes.containsKey(speaker.id);
buildSpeaker(isNew, speaker, list);
}
}
int deletedSpeakers = 0;
if (isIncrementalUpdate) {
for (String speakerId : speakerHashcodes.keySet()) {
if (!speakersToKeep.contains(speakerId)) {
buildDeleteOperation(speakerId, list);
++deletedSpeakers;
}
}
}
LOGD(TAG, "Speakers: " + (isIncrementalUpdate ? "INCREMENTAL" : "FULL") + " update. " +
updatedSpeakers + " to update, " + deletedSpeakers + " to delete. New total: " +
mSpeakers.size());
}