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