예제 #1
0
    /** 接受数据 */
    public void onReceivePage(int subsectionIndex, int subsectionSubIndex, int page, IntObjectMap <KeyData> dic, IntSet changePageSet)
    {
        CachePageData cachePageData = getCachePageData(subsectionIndex, subsectionSubIndex);

        if (changePageSet != null && !changePageSet.isEmpty())
        {
            changePageSet.forEach(k =>
            {
                //清CD
                cachePageData.lockDic.put(k, 0);
            });
        }

        SList <KeyData> list = cachePageData.list;

        if (dic != null)
        {
            dic.forEach((k, v) =>
            {
                ensureSize(k, list);
                list.set(k, v);
            });

            //有值才刷新
            onRefreshPage(subsectionIndex, subsectionSubIndex, page);
        }
    }
예제 #2
0
    /** 接受数据 */
    public void onReceivePageList(int subsectionIndex, int subsectionSubIndex, int page, SList <KeyData> receiveList)
    {
        CachePageData cachePageData = getCachePageData(subsectionIndex, subsectionSubIndex);

        //清cd
        cachePageData.lockDic.put(page, 0);

        SList <KeyData> list = cachePageData.list;

        if (receiveList != null && !receiveList.isEmpty())
        {
            int from = page * _eachPageShowMax;
            ensureSize(from + receiveList.size() - 1, list);

            KeyData[] values = receiveList.getValues();
            KeyData   v;

            for (int i = 0, len = receiveList.size(); i < len; ++i)
            {
                v = values[i];

                list.set(from + i, v);
            }

            //有值才刷新
            onRefreshPage(subsectionIndex, subsectionSubIndex, page);
        }

        Ctrl.print("onReceivePageList,", list.length());
    }
예제 #3
0
    /** 重新获取 */
    public void refresh(int subsectionIndex, int subsectionSubIndex)
    {
        CachePageData cachePageData = getCachePageData(subsectionIndex, subsectionSubIndex);

        cachePageData.lockDic.clear();
        cachePageData.needSendSet.clear();

        if (cachePageData.currentPage != -1)
        {
            getOnePage(subsectionIndex, subsectionSubIndex, cachePageData.currentPage);
        }
    }
예제 #4
0
    /** 设置当前参数 */
    public void setArg(int subsectionIndex, int subsectionSubIndex, int arg)
    {
        CachePageData cachePageData = getCachePageData(subsectionIndex, subsectionSubIndex);

        if (cachePageData.arg == arg)
        {
            return;
        }

        cachePageData.arg = arg;

        refresh(subsectionIndex, subsectionSubIndex);
    }
예제 #5
0
    /** 获取某页数据(调用) */
    private void getOnePage(int subsectionIndex, int subsectionSubIndex, int page)
    {
        CachePageData cachePageData = getCachePageData(subsectionIndex, subsectionSubIndex);

        /** 未到时间 */
        if (cachePageData.lockDic.get(page) > 0)
        {
            cachePageData.needSendSet.add(page);
        }
        else
        {
            cachePageData.lockDic.put(page, Global.pageToolShowCD);
            sendGet(subsectionIndex, subsectionSubIndex, page, cachePageData.arg);
        }
    }
예제 #6
0
    /** 选择当前观察页(用完了传-1) */
    public void setCurrentPage(int subsectionIndex, int subsectionSubIndex, int page)
    {
        CachePageData cachePageData = getCachePageData(subsectionIndex, subsectionSubIndex);

        if (cachePageData.currentPage == page)
        {
            return;
        }

        cachePageData.currentPage = page;

        if (page != -1)
        {
            getOnePage(subsectionIndex, subsectionSubIndex, page);
        }
    }
예제 #7
0
    private CachePageData getCachePageData(int subsectionIndex, int subsectionSubIndex)
    {
        long cacheKey = getCacheKey(subsectionIndex, subsectionSubIndex);

        CachePageData cachePageData;

        if (!_cachePageDataMap.contains(cacheKey))
        {
            _cachePageDataMap.put(cacheKey, cachePageData = new CachePageData());
            cachePageData.subsectionIndex    = subsectionIndex;
            cachePageData.subsectionSubIndex = subsectionSubIndex;
        }
        else
        {
            cachePageData = _cachePageDataMap.get(cacheKey);
        }

        return(cachePageData);
    }
예제 #8
0
    /** 获取当前数据 */
    public SList <KeyData> getList(int subsectionIndex, int subsectionSubIndex)
    {
        CachePageData cachePageData = getCachePageData(subsectionIndex, subsectionSubIndex);

        return(cachePageData.list);
    }