Changing tree map interface to only allow a value type parameter, key is always string.

Change-Id: I727e62401998fec63acf9e584cfb79a6ed02b569
diff --git a/core/api/src/main/java/org/onosproject/store/service/AsyncConsistentTreeMap.java b/core/api/src/main/java/org/onosproject/store/service/AsyncConsistentTreeMap.java
index 5c60b19..87386ed 100644
--- a/core/api/src/main/java/org/onosproject/store/service/AsyncConsistentTreeMap.java
+++ b/core/api/src/main/java/org/onosproject/store/service/AsyncConsistentTreeMap.java
@@ -23,24 +23,27 @@
 import java.util.NavigableSet;
 import java.util.concurrent.CompletableFuture;
 
+import static org.onosproject.store.service.DistributedPrimitive.DEFAULT_OPERTATION_TIMEOUT_MILLIS;
+
 /**
  * API for a distributed tree map implementation.
  */
-public interface AsyncConsistentTreeMap<K, V> extends AsyncConsistentMap<K, V> {
+public interface AsyncConsistentTreeMap<V>
+        extends AsyncConsistentMap<String, V> {
 
     /**
      * Return the lowest key in the map.
      *
      * @return the key or null if none exist
      */
-    CompletableFuture<K> firstKey();
+    CompletableFuture<String> firstKey();
 
     /**
      * Return the highest key in the map.
      *
      * @return the key or null if none exist
      */
-    CompletableFuture<K> lastKey();
+    CompletableFuture<String> lastKey();
 
     /**
      * Returns the entry associated with the least key greater than or equal to
@@ -49,7 +52,8 @@
      * @param key the key
      * @return the entry or null if no suitable key exists
      */
-    CompletableFuture<Map.Entry<K, Versioned<V>>> ceilingEntry(K key);
+    CompletableFuture<Map.Entry<String, Versioned<V>>> ceilingEntry(
+            String key);
 
     /**
      * Returns the entry associated with the greatest key less than or equal
@@ -58,7 +62,7 @@
      * @param key the key
      * @return the entry or null if no suitable key exists
      */
-    CompletableFuture<Map.Entry<K, Versioned<V>>> floorEntry(K key);
+    CompletableFuture<Map.Entry<String, Versioned<V>>> floorEntry(String key);
 
     /**
      * Returns the entry associated with the least key greater than key.
@@ -66,7 +70,7 @@
      * @param key the key
      * @return the entry or null if no suitable key exists
      */
-    CompletableFuture<Map.Entry<K, Versioned<V>>> higherEntry(K key);
+    CompletableFuture<Map.Entry<String, Versioned<V>>> higherEntry(String key);
 
     /**
      * Returns the entry associated with the largest key less than key.
@@ -74,35 +78,35 @@
      * @param key the key
      * @return the entry or null if no suitable key exists
      */
-    CompletableFuture<Map.Entry<K, Versioned<V>>> lowerEntry(K key);
+    CompletableFuture<Map.Entry<String, Versioned<V>>> lowerEntry(String key);
 
     /**
      * Return the entry associated with the lowest key in the map.
      *
      * @return the entry or null if none exist
      */
-    CompletableFuture<Map.Entry<K, Versioned<V>>> firstEntry();
+    CompletableFuture<Map.Entry<String, Versioned<V>>> firstEntry();
 
     /**
      * Return the entry associated with the highest key in the map.
      *
      * @return the entry or null if none exist
      */
-    CompletableFuture<Map.Entry<K, Versioned<V>>> lastEntry();
+    CompletableFuture<Map.Entry<String, Versioned<V>>> lastEntry();
 
     /**
      * Return and remove the entry associated with the lowest key.
      *
      * @return the entry or null if none exist
      */
-    CompletableFuture<Map.Entry<K, Versioned<V>>> pollFirstEntry();
+    CompletableFuture<Map.Entry<String, Versioned<V>>> pollFirstEntry();
 
     /**
      * Return and remove the entry associated with the highest key.
      *
      * @return the entry or null if none exist
      */
-    CompletableFuture<Map.Entry<K, Versioned<V>>> pollLastEntry();
+    CompletableFuture<Map.Entry<String, Versioned<V>>> pollLastEntry();
 
     /**
      * Return the entry associated with the greatest key less than key.
@@ -110,7 +114,7 @@
      * @param key the key
      * @return the entry or null if no suitable key exists
      */
-    CompletableFuture<K> lowerKey(K key);
+    CompletableFuture<String> lowerKey(String key);
 
     /**
      * Return the highest key less than or equal to key.
@@ -118,7 +122,7 @@
      * @param key the key
      * @return the entry or null if no suitable key exists
      */
-    CompletableFuture<K> floorKey(K key);
+    CompletableFuture<String> floorKey(String key);
 
     /**
      * Return the lowest key greater than or equal to key.
@@ -126,7 +130,7 @@
      * @param key the key
      * @return the entry or null if no suitable key exists
      */
-    CompletableFuture<K> ceilingKey(K key);
+    CompletableFuture<String> ceilingKey(String key);
 
     /**
      * Return the lowest key greater than key.
@@ -134,14 +138,14 @@
      * @param key the key
      * @return the entry or null if no suitable key exists
      */
-    CompletableFuture<K> higherKey(K key);
+    CompletableFuture<String> higherKey(String key);
 
     /**
      * Returns a navigable set of the keys in this map.
      *
      * @return a navigable key set (this may be empty)
      */
-    CompletableFuture<NavigableSet<K>> navigableKeySet();
+    CompletableFuture<NavigableSet<String>> navigableKeySet();
 
     /**
      * Returns a navigable map containing the entries from the original map
@@ -157,15 +161,16 @@
      * @return a navigable map containing entries in the specified range (this
      * may be empty)
      */
-    CompletableFuture<NavigableMap<K, V>> subMap(K upperKey, K lowerKey,
-                                                 boolean inclusiveUpper,
-                                                 boolean inclusiveLower);
+    CompletableFuture<NavigableMap<String, V>> subMap(String upperKey,
+                                                      String lowerKey,
+                                                      boolean inclusiveUpper,
+                                                      boolean inclusiveLower);
 
-    default ConsistentTreeMap<K, V> asTreeMap() {
-        return asTreeMap(DistributedPrimitive.DEFAULT_OPERTATION_TIMEOUT_MILLIS);
+    default ConsistentTreeMap<V> asTreeMap() {
+        return asTreeMap(DEFAULT_OPERTATION_TIMEOUT_MILLIS);
     }
 
-    default ConsistentTreeMap<K, V> asTreeMap(long timeoutMillis) {
+    default ConsistentTreeMap<V> asTreeMap(long timeoutMillis) {
         return new DefaultConsistentTreeMap<>(this, timeoutMillis);
     }
 
diff --git a/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMap.java b/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMap.java
index 18a3410..eb62cac 100644
--- a/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMap.java
+++ b/core/api/src/main/java/org/onosproject/store/service/ConsistentTreeMap.java
@@ -17,26 +17,27 @@
 package org.onosproject.store.service;
 
 import java.util.Map;
+import java.util.NavigableMap;
 import java.util.NavigableSet;
 
 /**
  * Tree map interface counterpart to {@link AsyncConsistentTreeMap}.
  */
- public interface ConsistentTreeMap<K, V> extends ConsistentMap<K, V> {
+ public interface ConsistentTreeMap<V> extends ConsistentMap<String, V> {
 
     /**
      * Returns the lowest key in the map.
      *
      * @return the key or null if none exist
      */
-     K firstKey();
+     String firstKey();
 
     /**
      * Returns the highest key in the map.
      *
      * @return the key or null if none exist
      */
-     K lastKey();
+     String lastKey();
 
     /**
      * Returns the entry associated with the least key greater than or equal to the key.
@@ -44,7 +45,7 @@
      * @param key the key
      * @return the entry or null
      */
-     Map.Entry<K, Versioned<V>> ceilingEntry(K key);
+     Map.Entry<String, Versioned<V>> ceilingEntry(String key);
 
     /**
      * Returns the entry associated with the greatest key less than or equal to key.
@@ -52,7 +53,7 @@
      * @param key the key
      * @return the entry or null
      */
-     Map.Entry<K, Versioned<V>> floorEntry(K key);
+     Map.Entry<String, Versioned<V>> floorEntry(String key);
 
     /**
      * Returns the entry associated with the lest key greater than key.
@@ -60,7 +61,7 @@
      * @param key the key
      * @return the entry or null
      */
-     Map.Entry<K, Versioned<V>> higherEntry(K key);
+     Map.Entry<String, Versioned<V>> higherEntry(String key);
 
     /**
      * Returns the entry associated with the largest key less than key.
@@ -68,35 +69,35 @@
      * @param key the key
      * @return the entry or null
      */
-     Map.Entry<K, Versioned<V>> lowerEntry(K key);
+     Map.Entry<String, Versioned<V>> lowerEntry(String key);
 
     /**
      * Returns the entry associated with the lowest key in the map.
      *
      * @return the entry or null
      */
-     Map.Entry<K, Versioned<V>> firstEntry();
+     Map.Entry<String, Versioned<V>> firstEntry();
 
     /**
      * Returns the entry associated with the highest key in the map.
      *
      * @return the entry or null
      */
-     Map.Entry<K, Versioned<V>> lastEntry();
+     Map.Entry<String, Versioned<V>> lastEntry();
 
     /**
      * Returns and removes the entry associated with the lowest key.
      *
      * @return the entry or null
      */
-     Map.Entry<K, Versioned<V>> pollFirstEntry();
+     Map.Entry<String, Versioned<V>> pollFirstEntry();
 
     /**
      * Returns and removes the entry associated with the highest key.
      *
      * @return the entry or null
      */
-     Map.Entry<K, Versioned<V>> pollLastEntry();
+     Map.Entry<String, Versioned<V>> pollLastEntry();
 
     /**
      * Returns the entry associated with the greatest key less than key.
@@ -104,7 +105,7 @@
      * @param key the key
      * @return the entry or null
      */
-     K lowerKey(K key);
+     String lowerKey(String key);
 
     /**
      * Returns the entry associated with the highest key less than or equal to key.
@@ -112,7 +113,7 @@
      * @param key the key
      * @return the entry or null
      */
-     K floorKey(K key);
+     String floorKey(String key);
 
     /**
      * Returns the lowest key greater than or equal to key.
@@ -120,7 +121,7 @@
      * @param key the key
      * @return the key or null
      */
-     K ceilingKey(K key);
+     String ceilingKey(String key);
 
     /**
      * Returns the lowest key greater than key.
@@ -128,13 +129,32 @@
      * @param key the key
      * @return the key or null
      */
-     K higherKey(K key);
+     String higherKey(String key);
 
     /**
      * Returns a navigable set of the keys in this map.
      *
      * @return a navigable key set
      */
-     NavigableSet<K> navigableKeySet();
+     NavigableSet<String> navigableKeySet();
+
+    /**
+     * Returns a navigable map containing the entries from the original map
+     * which are larger than (or if specified equal to) {@code lowerKey} AND
+     * less than (or if specified equal to) {@code upperKey}.
+     *
+     * @param upperKey the upper bound for the keys in this map
+     * @param lowerKey the lower bound for the keys in this map
+     * @param inclusiveUpper whether keys equal to the upperKey should be
+     *                       included
+     * @param inclusiveLower whether keys equal to the lowerKey should be
+     *                       included
+     * @return a navigable map containing entries in the specified range (this
+     * may be empty)
+     */
+    NavigableMap<String, V> subMap(String upperKey,
+                                   String lowerKey,
+                                   boolean inclusiveUpper,
+                                   boolean inclusiveLower);
 
 }