Aaron Kruglikov | 47047b2 | 2016-03-31 16:52:48 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Aaron Kruglikov | 47047b2 | 2016-03-31 16:52:48 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.store.service; |
| 18 | |
| 19 | import java.util.Map; |
| 20 | import java.util.NavigableSet; |
| 21 | |
| 22 | /** |
| 23 | * Tree map interface counterpart to {@link AsyncConsistentTreeMap}. |
| 24 | */ |
| 25 | public interface ConsistentTreeMap<K, V> extends ConsistentMap<K, V> { |
| 26 | |
| 27 | /** |
| 28 | * Returns the lowest key in the map. |
| 29 | * |
| 30 | * @return the key or null if none exist |
| 31 | */ |
| 32 | K firstKey(); |
| 33 | |
| 34 | /** |
| 35 | * Returns the highest key in the map. |
| 36 | * |
| 37 | * @return the key or null if none exist |
| 38 | */ |
| 39 | K lastKey(); |
| 40 | |
| 41 | /** |
| 42 | * Returns the entry associated with the least key greater than or equal to the key. |
| 43 | * |
| 44 | * @param key the key |
| 45 | * @return the entry or null |
| 46 | */ |
| 47 | Map.Entry<K, Versioned<V>> ceilingEntry(K key); |
| 48 | |
| 49 | /** |
| 50 | * Returns the entry associated with the greatest key less than or equal to key. |
| 51 | * |
| 52 | * @param key the key |
| 53 | * @return the entry or null |
| 54 | */ |
| 55 | Map.Entry<K, Versioned<V>> floorEntry(K key); |
| 56 | |
| 57 | /** |
| 58 | * Returns the entry associated with the lest key greater than key. |
| 59 | * |
| 60 | * @param key the key |
| 61 | * @return the entry or null |
| 62 | */ |
| 63 | Map.Entry<K, Versioned<V>> higherEntry(K key); |
| 64 | |
| 65 | /** |
| 66 | * Returns the entry associated with the largest key less than key. |
| 67 | * |
| 68 | * @param key the key |
| 69 | * @return the entry or null |
| 70 | */ |
| 71 | Map.Entry<K, Versioned<V>> lowerEntry(K key); |
| 72 | |
| 73 | /** |
| 74 | * Returns the entry associated with the lowest key in the map. |
| 75 | * |
| 76 | * @return the entry or null |
| 77 | */ |
| 78 | Map.Entry<K, Versioned<V>> firstEntry(); |
| 79 | |
| 80 | /** |
| 81 | * Returns the entry associated with the highest key in the map. |
| 82 | * |
| 83 | * @return the entry or null |
| 84 | */ |
| 85 | Map.Entry<K, Versioned<V>> lastEntry(); |
| 86 | |
| 87 | /** |
| 88 | * Returns and removes the entry associated with the lowest key. |
| 89 | * |
| 90 | * @return the entry or null |
| 91 | */ |
| 92 | Map.Entry<K, Versioned<V>> pollFirstEntry(); |
| 93 | |
| 94 | /** |
| 95 | * Returns and removes the entry associated with the highest key. |
| 96 | * |
| 97 | * @return the entry or null |
| 98 | */ |
| 99 | Map.Entry<K, Versioned<V>> pollLastEntry(); |
| 100 | |
| 101 | /** |
| 102 | * Returns the entry associated with the greatest key less than key. |
| 103 | * |
| 104 | * @param key the key |
| 105 | * @return the entry or null |
| 106 | */ |
| 107 | K lowerKey(K key); |
| 108 | |
| 109 | /** |
| 110 | * Returns the entry associated with the highest key less than or equal to key. |
| 111 | * |
| 112 | * @param key the key |
| 113 | * @return the entry or null |
| 114 | */ |
| 115 | K floorKey(K key); |
| 116 | |
| 117 | /** |
| 118 | * Returns the lowest key greater than or equal to key. |
| 119 | * |
| 120 | * @param key the key |
| 121 | * @return the key or null |
| 122 | */ |
| 123 | K ceilingKey(K key); |
| 124 | |
| 125 | /** |
| 126 | * Returns the lowest key greater than key. |
| 127 | * |
| 128 | * @param key the key |
| 129 | * @return the key or null |
| 130 | */ |
| 131 | K higherKey(K key); |
| 132 | |
| 133 | /** |
| 134 | * Returns a navigable set of the keys in this map. |
| 135 | * |
| 136 | * @return a navigable key set |
| 137 | */ |
| 138 | NavigableSet<K> navigableKeySet(); |
| 139 | |
| 140 | } |