當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。