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


Java TreeMap.higherEntry方法代码示例

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


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

示例1: filterPacket

import java.util.TreeMap; //导入方法依赖的package包/类
@Override
synchronized public EventPacket<?> filterPacket(EventPacket<?> in) {
    in = getEnclosedFilterChain().filterPacket(in);
    maybeAddListeners(chip);
    currentBoundingBoxes.clear(); // these are displayed, and returned to caller
    lastTs = in.getFirstTimestamp();
    BoundingBox next = null;
    // either use the original boxes or the undistorted ones, depending on calibration
    TreeMap<Integer, BoundingBox> usedBounndingBoxes = null;
    usedBounndingBoxes = calibration.isCalibrated() && calibration.isFilterEnabled() ? calibratedBoundingBoxes : boundingBoxes;
    // gets BB that is last in list and still with lower timestamp than last timestamp
    Entry<Integer, BoundingBox> entry = usedBounndingBoxes.lowerEntry(lastTs);
    // we do this more expensive search in case user has scrolled the file or rewound
    if (entry != null && entry.getValue() != null) {
        currentBoundingBoxes.add(entry.getValue());
        entry = usedBounndingBoxes.higherEntry(entry.getKey());
        if (entry != null) {
            next = entry.getValue();
        }
    }
    for (BasicEvent ev : in) {
        lastTs = ev.timestamp;  // gets next in list, then add to currentBoundingBoxes when timestamp reaches that value
        if (next != null && ev.timestamp > next.timestamp) {
            currentBoundingBoxes.add(next);
            entry = usedBounndingBoxes.higherEntry(next.timestamp);
            if (entry != null) {
                next = entry.getValue();
            }
        }
    }
    return in;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:33,代码来源:YuhuangBoundingboxDisplay.java

示例2: testHigherEntry

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * higherEntry returns next entry.
 */
public void testHigherEntry() {
    TreeMap map = map5();
    Map.Entry e1 = map.higherEntry(three);
    assertEquals(four, e1.getKey());

    Map.Entry e2 = map.higherEntry(zero);
    assertEquals(one, e2.getKey());

    Map.Entry e3 = map.higherEntry(five);
    assertNull(e3);

    Map.Entry e4 = map.higherEntry(six);
    assertNull(e4);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:TreeMapTest.java

示例3: getHigherEntry

import java.util.TreeMap; //导入方法依赖的package包/类
public void getHigherEntry(TreeMap<String,String> maps,String key){
    Map.Entry<String,String> entry = maps.higherEntry(key);
    System.out.println("后一个的Entry如下");
    System.out.print("key = " + entry.getKey());
    System.out.println(" value = " + entry.getValue());
}
 
开发者ID:byhieg,项目名称:JavaTutorial,代码行数:7,代码来源:TreeMapExample.java


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