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


Java ParseQuery.setSkip方法代码示例

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


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

示例1: findAll

import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
 * Finds all {@link ParseObject}s from given {@link ParseQuery}.
 *
 * @param parseQuery parse query to use for querying objects
 * @return {@link List} with {@link ParseObject}s returned by given {@link ParseQuery}.
 *         Empty list in case of no results, never {@code null}.
 * @throws ParseException
 */
@NonNull
private List<T> findAll(ParseQuery<T> parseQuery) throws ParseException {
    int skip = 0;
    List<T> allObjects = new LinkedList<T>();
    parseQuery.setSkip(skip).setLimit(QUERY_LIMIT);

    boolean hasMore = true;
    while (hasMore) {
        List<T> foundObjects = parseQuery.find();
        allObjects.addAll(foundObjects);

        // Incrementing skip
        skip += QUERY_LIMIT;
        parseQuery.setSkip(skip);

        // If we have loaded as many objects as limit,
        // there might be more objects to load
        hasMore = foundObjects.size() == QUERY_LIMIT;
    }

    return allObjects;
}
 
开发者ID:AleksandarIlic,项目名称:ParseQueryLoader,代码行数:31,代码来源:ParseQueryLoader.java

示例2: all

import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
 *  Limit 10000 by skip
 */
@NonNull
@CheckReturnValue
public static <R extends ParseObject> Observable<R> all(@NonNull final ParseQuery<R> query, int count) {
    final int limit = 1000; // limit limitation
    query.setSkip(0);
    query.setLimit(limit);
    Observable<R> find = find(query);
    for (int i = limit; i < count; i+= limit) {
        if (i >= 10000) break; // skip limitation
        query.setSkip(i);
        query.setLimit(limit);
        find.concatWith(find(query));
    }
    return find.distinct(o -> o.getObjectId());
}
 
开发者ID:yongjhih,项目名称:RxParse,代码行数:19,代码来源:ParseObservable.java

示例3: loadMoreData

import com.parse.ParseQuery; //导入方法依赖的package包/类
public void loadMoreData(Integer currentCount){
    if(!isUpdating){
        notifyUpdateStart();
        ParseQuery<SnackEntry> query = ParseQuery.getQuery(SnackEntry.class);
        query.orderByDescending("createdAt");
        query.whereEqualTo("owner", targetUser);
        query.setLimit(10);
        query.setSkip(currentCount);
        query.findInBackground(new FindCallback<SnackEntry>() {
            @Override
            public void done(List<SnackEntry> moreSnacks, ParseException e) {
                if (e == null) {
                    snacks.addAll(moreSnacks);
                }

                notifyUpdateComplete(e);
            }
        });
    }
}
 
开发者ID:SCCapstone,项目名称:diet,代码行数:21,代码来源:SnackList.java

示例4: getAnimeList

import com.parse.ParseQuery; //导入方法依赖的package包/类
public List<Anime> getAnimeList(int page) {
    ArrayList<Anime> animeList = new ArrayList<>();
    try {
        ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
        query.setSkip((page-1) * 100);
        for (AnimeRecord record : query.find()) {
            Anime anime = AnimeRecord.toAnime(record);
            if (anime != null)
                animeList.add(anime);
        }
    } catch (ParseException e) {
        WriteLog.appendLogException(TAG, "getAnimeList failed", e);
    }
    return animeList;
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:16,代码来源:ParseManager.java

示例5: fetchMessages

import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
 * Fetches a full list of messages between two users.
 *
 * @param user1 The first user
 * @param user2 The second user
 * @param callback The callback to invoke upon completion.
 */
private void fetchMessages(ParseUser user1, ParseUser user2, int limit, int skip, final FindCallback<Message> callback) {
    List<ParseQuery<Message>> orQueries = new ArrayList<>();
    ParseQuery<Message> oredQuery;

    isUpdating = true;

    Log.d("Conversations", "Skip is " + skip);

    orQueries.add(ParseQuery.getQuery(Message.class)
                    .whereEqualTo(Message.FROM_KEY, user1)
                    .whereEqualTo(Message.TO_KEY, user2)
    );
    orQueries.add(ParseQuery.getQuery(Message.class)
                    .whereEqualTo(Message.TO_KEY, user1)
                    .whereEqualTo(Message.FROM_KEY, user2)
    );
    oredQuery = ParseQuery.or(orQueries);
    oredQuery.include(Message.FROM_KEY).include(Message.TO_KEY);
    oredQuery.orderByDescending("createdAt");
    oredQuery.setLimit(limit);
    oredQuery.setSkip(skip);
    oredQuery.findInBackground(new FindCallback<Message>() {
        @Override
        public void done(List<Message> messages, ParseException e) {
            if (e == null) {
                if (messages.size() > 0) {
                    ParseUser fromUser = messages.get(0).getFromUser();
                    ParseUser toUser = messages.get(0).getToUser();
                    // Null users not allowed
                    if (fromUser == null || toUser == null) {
                        messages.clear();
                    }
                }
                callback.done(messages, e);
                isUpdating = false;
            }
        }
    });
}
 
开发者ID:SCCapstone,项目名称:diet,代码行数:47,代码来源:Conversations.java


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