ThreeState (VirtualFile vf, VcsKey vcsKey, VcsRevisionNumber number, TextRange range, long boundTime) { TreeMap<Integer, Long> treeMap = cache.getIfPresent(new HistoryCacheWithRevisionKey(VcsContextFactory.getInstance().createFilePathOn(vf), vcsKey, number)); if (treeMap != null) { Map.Entry<Integer, Long> last = treeMap.floorEntry(range.getEndOffset()); if (last == null || last.getKey() < range.getStartOffset()) { return ThreeState.NO; } Map.Entry<Integer, Long> first = treeMap.ceilingEntry(range.getStartOffset()); assert first != null; SortedMap<Integer, Long> interval = treeMap.subMap(first.getKey(), last.getKey()); for (Map.Entry<Integer, Long> entry : interval.entrySet()) { if (entry.getValue() >= boundTime) { return ThreeState.YES; } } return ThreeState.NO; } return ThreeState.UNSURE; }