// ********************************************************************** // // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** package Freeze; /** * Parent interface for Freeze maps. **/ public interface NavigableMap extends java.util.SortedMap { /** * Alternative to java.util.SortedMap.remove. This version * is more efficient because it does not decode and return the * old value. * * @param key The key of the entry to remove. * @return true if an entry for key was removed; * false, otherwise. **/ boolean fastRemove(K key); /** * Returns The entry with the least key. * * @return The entry with the least key, or null if the map is empty. **/ java.util.Map.Entry firstEntry(); /** * Returns The entry with the greatest key. * * @return The entry with the greatest key, or null if the map is empty. **/ java.util.Map.Entry lastEntry(); /** * Returns the entry with the least key greater than or equal to the given key. * * @param key The key. * @return The entry with the least key greater than or equal to the given key, * or null if there is no such entry. **/ java.util.Map.Entry ceilingEntry(K key); /** * Returns the entry with the greatest key less than or equal to the given key. * * @param key The key. * @return The entry with the greatest key less than or equal to the given key, * or null if there is no such entry. **/ java.util.Map.Entry floorEntry(K key); /** * Returns the entry with the least key strictly greater than the given key. * * @param key The key. * @return The entry with the least key strictly greater than the given key, * or null if there is no such entry. **/ java.util.Map.Entry higherEntry(K key); /** * Returns the entry with the greatest key strictly less than the given key. * * @param key The key. * @return The entry with the greatest key strictly less than the given key, * or null if there is no such entry. **/ java.util.Map.Entry lowerEntry(K key); /** * Returns the least key greater than or equal to the given key. * * @param key The key. * @return The least key greater than or equal to the given key, * or null if there is no such key. **/ K ceilingKey(K key); /** * Returns the greatest key less than or equal to the given key. * * @param key The key. * @return The greatest key less than or equal to the given key, * or null if there is no such key. **/ K floorKey(K key); /** * Returns the least key strictly greater than the given key. * * @return The least key strictly greater than the given key, * or null if there is no such key. **/ K higherKey(K key); /** * Returns the greatest key strictly less than the given key. * * @return The greatest key strictly less than the given key, * or null if there is no such key. **/ K lowerKey(K key); /** * Returns a reverse order Set view of the keys contained in this map. The set's iterator * returns the keys in descending order. The set is backed by the map, so changes to the map are reflected * in the set and vice versa. *

* Insertions cannot be made via the returned set and must be made on the main map. *

* remove and fastRemove on the returned set or on an iterator for the returned * set are supported, but only if this map does not have an index; otherwise, attempts to remove an element * raise UnsupportedOperationException. *

* If the map is modified while an iteration over the set is in progress * (except through the iterator's own remove or fastRemove operation), the results * of the iteration are undefined. * * @return A reverse order set view of the keys in this map. **/ java.util.Set descendingKeySet(); /** * Returns a reverse order view of the mappings contained in this map. * The descending map is backed by this map, so changes to the map are reflected in the descending map * and vice versa. *

* Insertions cannot be made via the descending map and must be made on the main map. *

* remove and fastRemove on the descending map or on an iterator for the descending * map are supported, but only if this map does not have an index; otherwise, attempts to remove an entry * raise UnsupportedOperationException. *

* If either map is modified while an iteration over either map is * in progress (except through the iterator's own remove or fastRemoveoperation), * the results of the iteration are undefined. * * @return a Reverse order view of this map. **/ NavigableMap descendingMap(); /** * Returns a view of the portion of this map whose keys are strictly less than toKey, or less than * or equal to toKey if inclusive is true. * The returned map is backed by this map, so changes to this map are reflected in the returned map * and vice versa. *

* Insertions cannot be made via the returned map and must be made on the main map. *

* remove and fastRemove on the returned map or on an iterator for the returned * map are supported, but only if this map does not have an index; otherwise, attempts to remove an entry * raise UnsupportedOperationException. *

* The returned map throws an IllegalArgumentException on an attempt to insert a key * outside its range. * * @param toKey High endpoint of the keys in the returned map. * @param inclusive If true, the endpoint is included in the returned map; otherwise, the endpoint * is excluded. * @return A view of the portion of this map whose keys are strictly less than toKey, or * less than or equal to toKey if inclusive is true. **/ NavigableMap headMap(K toKey, boolean inclusive); /** * Returns a view of the portion of this map whose keys are strictly greater than fromKey, or greater * than or equal to fromKey if inclusive is true. *

* Insertions cannot be made via the returned map and must be made on the main map. *

* remove and fastRemove on the returned map or on an iterator for the returned * map are supported, but only if this map does not have an index; otherwise, attempts to remove an entry * raise UnsupportedOperationException. *

* The returned map throws an IllegalArgumentException on an attempt to insert a key * outside its range. * * @param fromKey Low endpoint of the keys in the returned map. * @param inclusive If true, the endpoint is included in the returned map; otherwise, the endpoint * is excluded. * @return A view of the portion of this map whose keys are strictly greater than fromKey, or * greater than or equal to fromKey if inclusive is true. **/ NavigableMap tailMap(K fromKey, boolean inclusive); /** * Returns a view of the portion of this map whose keys range from fromKey to toKey. * If fromKey and toKey are equal, the returned map is empty unless * fromInclusive and toInclusive are both true. *

* Insertions cannot be made via the returned map and must be made on the main map. *

* remove and fastRemove on the returned map or on an iterator for the returned * map are supported, but only if this map does not have an index; otherwise, attempts to remove an entry * raise UnsupportedOperationException. *

* The returned map throws an IllegalArgumentException on an attempt to insert a key * outside its range. * * @param fromKey Low endpoint of the keys in the returned map. * @param fromInclusive true if the low endpoint is to be included in the returned view; * false, otherwise. * @param toKey High endpoint of the keys in the returned map. * @param toInclusive true if the high endpoint is to be included in the returned view; * false, otherwise. * @return A view of the portion of this map whose keys range from fromKey to toKey. **/ NavigableMap subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive); /** * Removes and returns a key-value mapping associated with the least key in this map, * or null if the map is empty. * * @return The removed first entry, or null if this map is empty. **/ java.util.Map.Entry pollFirstEntry(); /** * Removes and returns a key-value mapping associated with the greatest key in this map, * or null if the map is empty. * * @return The removed last entry, or null if this map is empty. **/ java.util.Map.Entry pollLastEntry(); }