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


Java Speaker.getImportHashcode方法代码示例

本文整理汇总了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());
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:44,代码来源:SpeakersHandler.java

示例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());
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:44,代码来源:SpeakersHandler.java

示例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());
}
 
开发者ID:google,项目名称:iosched,代码行数:44,代码来源:SpeakersHandler.java


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