harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r546391 - in /harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util: NavigableMap.java NavigableSet.java
Date Tue, 12 Jun 2007 06:20:25 GMT
Author: pyang
Date: Mon Jun 11 23:20:25 2007
New Revision: 546391

URL: http://svn.apache.org/viewvc?view=rev&rev=546391
Log:
Apply patch for HARMONY-4122([classlib][luni][java6] New Interface java.util.NavigableMap/NavigableSet
for java6)

Added:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableMap.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableSet.java

Added: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableMap.java?view=auto&rev=546391
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableMap.java
(added)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableMap.java
Mon Jun 11 23:20:25 2007
@@ -0,0 +1,262 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.util;
+
+/**
+ * NavigableMap is a SortedMap with navigation methods answering the closest
+ * matches for specified item.
+ * 
+ * @param <K>
+ *            the type of key
+ * @param <V>
+ *            the type of value
+ * @since 1.6
+ */
+public interface NavigableMap<K, V> extends SortedMap<K, V> {
+    /**
+     * Answers the entry with the smallest key, or null if the map is empty.
+     * 
+     * @return the entry with the smallest key, or null if the map is empty
+     */
+    Map.Entry<K, V> firstEntry();
+
+    /**
+     * Answers the entry with the biggest key, or null if the map is empty.
+     * 
+     * @return the entry with the biggest key, or null if the map is empty
+     */
+    Map.Entry<K, V> lastEntry();
+
+    /**
+     * Deletes and answers the entry with the smallest key, or null if the map
+     * is empty.
+     * 
+     * @return the entry with the smallest key, or null if the map is empty
+     */
+    Map.Entry<K, V> pollFirstEntry();
+
+    /**
+     * Deletes and answers the entry with the biggest key, or null if the map is
+     * empty.
+     * 
+     * @return the entry with the biggest key, or null if the map is empty
+     */
+    Map.Entry<K, V> pollLastEntry();
+
+    /**
+     * Answers an entry related with the smallest key greater than or equal to
+     * the specified key, or null if no such key.
+     * 
+     * @param key
+     *            the key
+     * @return the entry, or null if no such key
+     * @throws ClassCastException
+     *             if the key cannot be compared with the keys in the map
+     * @throws NullPointerException
+     *             if the key is null and the map can not contain null key
+     */
+    Map.Entry<K, V> ceilingEntry(K key);
+
+    /**
+     * Answers the smallest key greater than or equal to the specified key, or
+     * null if no such key.
+     * 
+     * @param key
+     *            the key
+     * @return the smallest key greater than or equal to key, or null if no such
+     *         key
+     * @throws ClassCastException
+     *             if the key cannot be compared with the keys in the map
+     * @throws NullPointerException
+     *             if the key is null and the map can not contain null key
+     */
+    K ceilingKey(K key);
+
+    /**
+     * Answers an entry related with the smallest key greater than the specified
+     * key, or null if no such key.
+     * 
+     * @param key
+     *            the key
+     * @return the entry, or null if no such key
+     * @throws ClassCastException
+     *             if the key cannot be compared with the keys in the map
+     * @throws NullPointerException
+     *             if the key is null and the map can not contain null key
+     */
+    Map.Entry<K, V> higherEntry(K key);
+
+    /**
+     * Answers the smallest key greater than the specified key, or null if no
+     * such key.
+     * 
+     * @param key
+     *            the key
+     * @return the smallest key greater than key, or null if no such key
+     * @throws ClassCastException
+     *             if the key cannot be compared with the keys in the map
+     * @throws NullPointerException
+     *             if the key is null and the map can not contain null key
+     */
+    K higherKey(K key);
+
+    /**
+     * Answers an entry related with the biggest key less than or equal to the
+     * specified key, or null if no such key.
+     * 
+     * @param key
+     *            the key
+     * @return the entry, or null if no such key
+     * @throws ClassCastException
+     *             if the key cannot be compared with the keys in the map
+     * @throws NullPointerException
+     *             if the key is null and the map can not contain null key
+     */
+    Map.Entry<K, V> floorEntry(K key);
+
+    /**
+     * Answers the biggest key less than or equal to the specified key, or null
+     * if no such key.
+     * 
+     * @param key
+     *            the key
+     * @return the biggest key less than or equal to key, or null if no such key
+     * @throws ClassCastException
+     *             if the key cannot be compared with the keys in the map
+     * @throws NullPointerException
+     *             if the key is null and the map can not contain null key
+     */
+    K floorKey(K key);
+
+    /**
+     * Answers an entry related with the biggest key less than the specified
+     * key, or null if no such key.
+     * 
+     * @param key
+     *            the key
+     * @return the entry, or null if no such key
+     * @throws ClassCastException
+     *             if the key cannot be compared with the keys in the map
+     * @throws NullPointerException
+     *             if the key is null and the map can not contain null key
+     */
+    Map.Entry<K, V> lowerEntry(K key);
+
+    /**
+     * Answers the biggest key less than the specified key, or null if no such
+     * key.
+     * 
+     * @param key
+     *            the key
+     * @return the biggest key less than key, or null if no such key
+     * @throws ClassCastException
+     *             if the key cannot be compared with the keys in the map
+     * @throws NullPointerException
+     *             if the key is null and the map can not contain null key
+     */
+    K lowerKey(K key);
+
+    /**
+     * Answers a NavigableSet view of the keys in ascending order.
+     * 
+     * @return the navigable set view
+     */
+    NavigableSet<K> navigableKeySet();
+
+    /**
+     * Answers a reverse order view of the map.
+     * 
+     * @return the reverse order view of the map
+     */
+    NavigableMap<K, V> descendingMap();
+
+    /**
+     * Answers a NavigableSet view of the keys in descending order.
+     * 
+     * @return the navigable set view
+     */
+    NavigableSet<K> descendingKeySet();
+
+    /**
+     * Answers a view of part of the map whose keys is from startKey to endKey.
+     * 
+     * @param startKey
+     *            the start key
+     * @param startInclusive
+     *            true if the start key is in the returned map
+     * @param endKey
+     *            the end key
+     * @param endInclusive
+     *            true if the end key is in the returned map
+     * @return the sub-map view
+     * 
+     * @exception ClassCastException
+     *                when the class of the start or end key is inappropriate
+     *                for this SubMap
+     * @exception NullPointerException
+     *                when the start or end key is null and this SortedMap does
+     *                not support null keys
+     * @exception IllegalArgumentException
+     *                when the start key is greater than the end key
+     */
+    NavigableMap<K, V> subMap(K startKey, boolean startInclusive, K endKey,
+            boolean endInclusive);
+
+    /**
+     * Answers a view of the head of the map whose keys are smaller than (or
+     * equal to, depends on inclusive argument) endKey.
+     * 
+     * @param endKey
+     *            the end key
+     * @param inclusive
+     *            true if the end key is in the returned map
+     * @return the head-map view
+     * 
+     * @exception ClassCastException
+     *                when the class of the end key is inappropriate for this
+     *                SubMap
+     * @exception NullPointerException
+     *                when the end key is null and this SortedMap does not
+     *                support null keys
+     * @exception IllegalArgumentException
+     *                when the map is range-limited and end key is out of the
+     *                range of the map
+     */
+    NavigableMap<K, V> headMap(K endKey, boolean inclusive);
+
+    /**
+     * Answers a view of the tail of the map whose keys are bigger than (or
+     * equal to, depends on inclusive argument) startKey.
+     * 
+     * @param startKey
+     *            the start key
+     * @param inclusive
+     *            true if the start key is in the returned map
+     * @return the tail-map view
+     * 
+     * @exception ClassCastException
+     *                when the class of the start key is inappropriate for this
+     *                SubMap
+     * @exception NullPointerException
+     *                when the start key is null and this SortedMap does not
+     *                support null keys
+     * @exception IllegalArgumentException
+     *                when the map is range-limited and start key is out of the
+     *                range of the map
+     */
+    NavigableMap<K, V> tailMap(K startKey, boolean inclusive);
+}

Added: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableSet.java?view=auto&rev=546391
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableSet.java
(added)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/NavigableSet.java
Mon Jun 11 23:20:25 2007
@@ -0,0 +1,192 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package java.util;
+
+/**
+ * NavigableSet is a SortedSet with navigation methods answering the closest
+ * matches for specified item.
+ * 
+ * @param <E>
+ *            the type of element
+ * @since 1.6
+ */
+public interface NavigableSet<E> extends SortedSet<E> {
+
+    /**
+     * Deletes and answers the smallest element, or null if the set is empty.
+     * 
+     * @return the smallest element, or null if the set is empty
+     */
+    E pollFirst();
+
+    /**
+     * Deletes and answers the biggest element, or null if the set is empty.
+     * 
+     * @return the biggest element, or null if the set is empty
+     */
+    E pollLast();
+
+    /**
+     * Answers the smallest element bigger than the specified one, or null if no
+     * such element.
+     * 
+     * @param e
+     *            the specified element
+     * @return the smallest element bigger than the specified one, or null if no
+     *         such element
+     * @throws ClassCastException
+     *             if the element cannot be compared with the ones in the set
+     * @throws NullPointerException
+     *             if the element is null and the set can not contain null
+     */
+    E higher(E e);
+
+    /**
+     * Answers the smallest element bigger than or equal to the specified one,
+     * or null if no such element.
+     * 
+     * @param e
+     *            the specified element
+     * @return the smallest element bigger than or equal to the specified one,
+     *         or null if no such element
+     * @throws ClassCastException
+     *             if the element cannot be compared with the ones in the set
+     * @throws NullPointerException
+     *             if the element is null and the set can not contain null
+     */
+    E ceiling(E e);
+
+    /**
+     * Answers the biggest element less than the specified one, or null if no
+     * such element.
+     * 
+     * @param e
+     *            the specified element
+     * @return the biggest element less than the specified one, or null if no
+     *         such element
+     * @throws ClassCastException
+     *             if the element cannot be compared with the ones in the set
+     * @throws NullPointerException
+     *             if the element is null and the set can not contain null
+     */
+    E lower(E e);
+
+    /**
+     * Answers the biggest element less than or equal to the specified one, or
+     * null if no such element.
+     * 
+     * @param e
+     *            the specified element
+     * @return the biggest element less than or equal to the specified one, or
+     *         null if no such element
+     * @throws ClassCastException
+     *             if the element cannot be compared with the ones in the set
+     * @throws NullPointerException
+     *             if the element is null and the set can not contain null
+     */
+    E floor(E e);
+
+    /**
+     * Answers a descending iterator of this set.
+     * 
+     * @return the descending iterator
+     */
+    Iterator<E> descendingIterator();
+
+    /**
+     * Answers a reverse order view of this set.
+     * 
+     * @return the reverse order view
+     */
+    NavigableSet<E> descendingSet();
+
+    /**
+     * Answers a NavigableSet of the specified portion of this set which
+     * contains elements greater (or equal to, depends on startInclusive) the
+     * start element but less than (or equal to, depends on endInclusive) the
+     * end element. The returned NavigableSet is backed by this set so changes
+     * to one are reflected by the other.
+     * 
+     * @param start
+     *            the start element
+     * @param startInclusive
+     *            true if the start element is in the returned set
+     * @param end
+     *            the end element
+     * @param endInclusive
+     *            true if the end element is in the returned set
+     * @return the subset
+     * 
+     * @throws ClassCastException
+     *             when the start or end object cannot be compared with the
+     *             elements in this set
+     * @throws NullPointerException
+     *             when the start or end object is null and the set cannot
+     *             contain null
+     * @throws IllegalArgumentException
+     *             when the start is bigger than end; or start or end is out of
+     *             range and the set has a range
+     */
+    NavigableSet<E> subSet(E start, boolean startInclusive, E end,
+            boolean endInclusive);
+
+    /**
+     * Answers a NavigableSet of the specified portion of this set which
+     * contains elements less than (or equal to, depends on endInclusive) the
+     * end element. The returned NavigableSet is backed by this set so changes
+     * to one are reflected by the other.
+     * 
+     * @param end
+     *            the end element
+     * @param endInclusive
+     *            true if the end element is in the returned set
+     * @return the subset
+     * 
+     * @throws ClassCastException
+     *             when the end object cannot be compared with the elements in
+     *             this set
+     * @throws NullPointerException
+     *             when the end object is null and the set cannot contain handle
+     *             null
+     * @throws IllegalArgumentException
+     *             when end is out of range and the set has a range
+     */
+    NavigableSet<E> headSet(E end, boolean endInclusive);
+
+    /**
+     * Answers a NavigableSet of the specified portion of this set which
+     * contains elements greater (or equal to, depends on startInclusive) the
+     * start element. The returned NavigableSet is backed by this set so changes
+     * to one are reflected by the other.
+     * 
+     * @param start
+     *            the start element
+     * @param startInclusive
+     *            true if the start element is in the returned set
+     * @return the subset
+     * 
+     * @throws ClassCastException
+     *             when the start object cannot be compared with the elements in
+     *             this set
+     * @throws NullPointerException
+     *             when the start object is null and the set cannot contain null
+     * @throws IllegalArgumentException
+     *             when start is out of range and the set has a range
+     */
+    NavigableSet<E> tailSet(E start, boolean startInclusive);
+}



Mime
View raw message