本文整理汇总了Java中java.util.TreeMap.lowerEntry方法的典型用法代码示例。如果您正苦于以下问题:Java TreeMap.lowerEntry方法的具体用法?Java TreeMap.lowerEntry怎么用?Java TreeMap.lowerEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.TreeMap
的用法示例。
在下文中一共展示了TreeMap.lowerEntry方法的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: testLowerEntry
import java.util.TreeMap; //导入方法依赖的package包/类
/**
* lowerEntry returns preceding entry.
*/
public void testLowerEntry() {
TreeMap map = map5();
Map.Entry e1 = map.lowerEntry(three);
assertEquals(two, e1.getKey());
Map.Entry e2 = map.lowerEntry(six);
assertEquals(five, e2.getKey());
Map.Entry e3 = map.lowerEntry(one);
assertNull(e3);
Map.Entry e4 = map.lowerEntry(zero);
assertNull(e4);
}
示例3: getLowestEntry
import java.util.TreeMap; //导入方法依赖的package包/类
public void getLowestEntry(TreeMap<String, String> maps, String key) {
Map.Entry<String,String> entry = maps.lowerEntry(key);
System.out.println("前一个的Entry如下");
System.out.print("key = " + entry.getKey());
System.out.println(" value = " + entry.getValue());
}