本文整理汇总了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;
}
示例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);
}
示例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());
}