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


Java EntityIndex.sortedMap方法代码示例

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


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

示例1: checkClosedRanges

import com.sleepycat.persist.EntityIndex; //导入方法依赖的package包/类
private <K,V> void checkClosedRanges(Transaction txn, int i, int j,
                                     EntityIndex<K,V> index,
                                     SortedMap<Integer,SortedSet<Integer>>
                                     expected,
                                     Getter<K> kGetter,
                                     Getter<V> vGetter)
    throws DatabaseException {

    SortedMap<K,V> map = index.sortedMap();
    SortedMap<Integer,SortedSet<Integer>> rangeExpected;
    K k = kGetter.fromInt(i);
    K kPlusOne = kGetter.fromInt(i + 1);
    K l = kGetter.fromInt(j);
    K lPlusOne = kGetter.fromInt(j + 1);

    /* Sub range exclusive. */
    rangeExpected = expected.subMap(i + 1, j);
    checkCursor
        (index.keys(txn, k, false, l, false, null),
         map.subMap(kPlusOne, l).keySet(), true,
         expandKeys(rangeExpected), kGetter);
    checkCursor
        (index.entities(txn, k, false, l, false, null),
         map.subMap(kPlusOne, l).values(), false,
         expandValues(rangeExpected), vGetter);

    /* Sub range inclusive. */
    rangeExpected = expected.subMap(i, j + 1);
    checkCursor
        (index.keys(txn, k, true, l, true, null),
         map.subMap(k, lPlusOne).keySet(), true,
         expandKeys(rangeExpected), kGetter);
    checkCursor
        (index.entities(txn, k, true, l, true, null),
         map.subMap(k, lPlusOne).values(), false,
         expandValues(rangeExpected), vGetter);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:38,代码来源:IndexTest.java

示例2: checkOpenRanges

import com.sleepycat.persist.EntityIndex; //导入方法依赖的package包/类
private <K,V> void checkOpenRanges(Transaction txn, int i,
                                   EntityIndex<K,V> index,
                                   SortedMap<Integer,SortedSet<Integer>>
                                   expected,
                                   Getter<K> kGetter,
                                   Getter<V> vGetter)
    throws DatabaseException {

    SortedMap<K,V> map = index.sortedMap();
    SortedMap<Integer,SortedSet<Integer>> rangeExpected;
    K k = kGetter.fromInt(i);
    K kPlusOne = kGetter.fromInt(i + 1);

    /* Head range exclusive. */
    rangeExpected = expected.headMap(i);
    checkCursor
        (index.keys(txn, null, false, k, false, null),
         map.headMap(k).keySet(), true,
         expandKeys(rangeExpected), kGetter);
    checkCursor
        (index.entities(txn, null, false, k, false, null),
         map.headMap(k).values(), false,
         expandValues(rangeExpected), vGetter);

    /* Head range inclusive. */
    rangeExpected = expected.headMap(i + 1);
    checkCursor
        (index.keys(txn, null, false, k, true, null),
         map.headMap(kPlusOne).keySet(), true,
         expandKeys(rangeExpected), kGetter);
    checkCursor
        (index.entities(txn, null, false, k, true, null),
         map.headMap(kPlusOne).values(), false,
         expandValues(rangeExpected), vGetter);

    /* Tail range exclusive. */
    rangeExpected = expected.tailMap(i + 1);
    checkCursor
        (index.keys(txn, k, false, null, false, null),
         map.tailMap(kPlusOne).keySet(), true,
         expandKeys(rangeExpected), kGetter);
    checkCursor
        (index.entities(txn, k, false, null, false, null),
         map.tailMap(kPlusOne).values(), false,
         expandValues(rangeExpected), vGetter);

    /* Tail range inclusive. */
    rangeExpected = expected.tailMap(i);
    checkCursor
        (index.keys(txn, k, true, null, false, null),
         map.tailMap(k).keySet(), true,
         expandKeys(rangeExpected), kGetter);
    checkCursor
        (index.entities(txn, k, true, null, false, null),
         map.tailMap(k).values(), false,
         expandValues(rangeExpected), vGetter);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:58,代码来源:IndexTest.java


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