return new SubMap(m, fromKey, fromInclusive, toKey, toInclusive, isDescending);
return new SubMap(m, fromKey, fromInclusive, toKey, toInclusive, isDescending);
rel &= ~m.LT; if (tooLow(key)) { if ((rel & m.LT) == 0) { ConcurrentSkipListMap.Node n = loNode(); if (isBeforeEnd(n)) return n.key; if (tooHigh(key)) { if ((rel & m.LT) != 0) { ConcurrentSkipListMap.Node n = hiNode(); if (n != null) { Object last = n.key; if (inBounds(last)) return last; if (n == null || !inBounds(n.key)) return null; Object k = n.key;
return new SubMap(m, fromKey, fromInclusive, toKey, toInclusive, isDescending);
rel &= ~m.LT; if (tooLow(key)) { if ((rel & m.LT) == 0) { ConcurrentSkipListMap.Node n = loNode(); if (isBeforeEnd(n)) return n.key; if (tooHigh(key)) { if ((rel & m.LT) != 0) { ConcurrentSkipListMap.Node n = hiNode(); if (n != null) { Object last = n.key; if (inBounds(last)) return last; if (n == null || !inBounds(n.key)) return null; Object k = n.key;
rel &= ~m.LT; if (tooLow(key)) { if ((rel & m.LT) == 0) { ConcurrentSkipListMap.Node n = loNode(); if (isBeforeEnd(n)) return n.key; if (tooHigh(key)) { if ((rel & m.LT) != 0) { ConcurrentSkipListMap.Node n = hiNode(); if (n != null) { Object last = n.key; if (inBounds(last)) return last; if (n == null || !inBounds(n.key)) return null; Object k = n.key;
/** * Submap version of ConcurrentSkipListMap.getNearEntry */ private Map.Entry getNearEntry(Object key, int rel) { if (isDescending) { // adjust relation for direction if ((rel & m.LT) == 0) rel |= m.LT; else rel &= ~m.LT; } if (tooLow(key)) return ((rel & m.LT) != 0)? null : lowestEntry(); if (tooHigh(key)) return ((rel & m.LT) != 0)? highestEntry() : null; for (;;) { Node n = m.findNear(key, rel); if (n == null || !inBounds(n.key)) return null; Object k = n.key; Object v = n.getValidValue(); if (v != null) return new AbstractMap.SimpleImmutableEntry(k, v); } }
/** * Submap version of ConcurrentSkipListMap.getNearEntry */ private Map.Entry getNearEntry(Object key, int rel) { if (isDescending) { // adjust relation for direction if ((rel & m.LT) == 0) rel |= m.LT; else rel &= ~m.LT; } if (tooLow(key)) return ((rel & m.LT) != 0)? null : lowestEntry(); if (tooHigh(key)) return ((rel & m.LT) != 0)? highestEntry() : null; for (;;) { Node n = m.findNear(key, rel); if (n == null || !inBounds(n.key)) return null; Object k = n.key; Object v = n.getValidValue(); if (v != null) return new AbstractMap.SimpleImmutableEntry(k, v); } }
/** * Submap version of ConcurrentSkipListMap.getNearEntry */ private Map.Entry getNearEntry(Object key, int rel) { if (isDescending) { // adjust relation for direction if ((rel & m.LT) == 0) rel |= m.LT; else rel &= ~m.LT; } if (tooLow(key)) return ((rel & m.LT) != 0)? null : lowestEntry(); if (tooHigh(key)) return ((rel & m.LT) != 0)? highestEntry() : null; for (;;) { Node n = m.findNear(key, rel); if (n == null || !inBounds(n.key)) return null; Object k = n.key; Object v = n.getValidValue(); if (v != null) return new AbstractMap.SimpleImmutableEntry(k, v); } }
public Object floorKey(Object key) { return getNearKey(key, (m.LT|m.EQ)); }
public Map.Entry lowerEntry(Object key) { return getNearEntry(key, (m.LT)); }
public Object firstKey() { return isDescending? highestKey() : lowestKey(); }
/** * @throws ClassCastException {@inheritDoc} * @throws NullPointerException if {@code fromKey} or {@code toKey} is null * @throws IllegalArgumentException {@inheritDoc} */ public NavigableMap subMap(Object fromKey, boolean fromInclusive, Object toKey, boolean toInclusive) { if (fromKey == null || toKey == null) throw new NullPointerException(); return new SubMap (this, fromKey, fromInclusive, toKey, toInclusive, false); }
public Map.Entry higherEntry(Object key) { return getNearEntry(key, (m.GT)); }
public Object ceilingKey(Object key) { return getNearKey(key, (m.GT|m.EQ)); }
/** * @throws ClassCastException {@inheritDoc} * @throws NullPointerException if {@code fromKey} or {@code toKey} is null * @throws IllegalArgumentException {@inheritDoc} */ public NavigableMap subMap(Object fromKey, boolean fromInclusive, Object toKey, boolean toInclusive) { if (fromKey == null || toKey == null) throw new NullPointerException(); return new SubMap (this, fromKey, fromInclusive, toKey, toInclusive, false); }
public Object lastKey() { return isDescending? lowestKey() : highestKey(); }
public Object ceilingKey(Object key) { return getNearKey(key, (m.GT|m.EQ)); }
public NavigableSet descendingKeySet() { return descendingMap().navigableKeySet(); }