package com.fireflysource.common.collection.trie;

import java.nio.ByteBuffer;
import java.util.Set;

/* ------------------------------------------------------------ */

/**
 * A Trie String lookup data structure.
 *
 * @param <V> the Trie entry type
 */
public interface Trie<V> {
    /* ------------------------------------------------------------ */

    /**
     * Put an entry into the Trie
     *
     * @param s The key for the entry
     * @param v The value of the entry
     * @return True if the Trie had capacity to add the field.
     */
    public boolean put(String s, V v);

    /* ------------------------------------------------------------ */

    /**
     * Put a value as both a key and a value.
     *
     * @param v The value and key
     * @return True if the Trie had capacity to add the field.
     */
    public boolean put(V v);

    /* ------------------------------------------------------------ */
    public V remove(String s);

    /* ------------------------------------------------------------ */

    /**
     * Get an exact match from a String key
     *
     * @param s The key
     * @return the value for the string key
     */
    public V get(String s);

    /* ------------------------------------------------------------ */

    /**
     * Get an exact match from a String key
     *
     * @param s      The key
     * @param offset The offset within the string of the key
     * @param len    the length of the key
     * @return the value for the string / offset / length
     */
    public V get(String s, int offset, int len);

    /* ------------------------------------------------------------ */

    /**
     * Get an exact match from a segment of a ByteBuufer as key
     *
     * @param b The buffer
     * @return The value or null if not found
     */
    public V get(ByteBuffer b);

    /* ------------------------------------------------------------ */

    /**
     * Get an exact match from a segment of a ByteBuufer as key
     *
     * @param b      The buffer
     * @param offset The offset within the buffer of the key
     * @param len    the length of the key
     * @return The value or null if not found
     */
    public V get(ByteBuffer b, int offset, int len);

    /* ------------------------------------------------------------ */

    /**
     * Get the best match from key in a String.
     *
     * @param s The string
     * @return The value or null if not found
     */
    public V getBest(String s);

    /* ------------------------------------------------------------ */

    /**
     * Get the best match from key in a String.
     *
     * @param s      The string
     * @param offset The offset within the string of the key
     * @param len    the length of the key
     * @return The value or null if not found
     */
    public V getBest(String s, int offset, int len);

    /* ------------------------------------------------------------ */

    /**
     * Get the best match from key in a byte array.
     * The key is assumed to by ISO_8859_1 characters.
     *
     * @param b      The buffer
     * @param offset The offset within the array of the key
     * @param len    the length of the key
     * @return The value or null if not found
     */
    public V getBest(byte[] b, int offset, int len);

    /* ------------------------------------------------------------ */

    /**
     * Get the best match from key in a byte buffer.
     * The key is assumed to by ISO_8859_1 characters.
     *
     * @param b      The buffer
     * @param offset The offset within the buffer of the key
     * @param len    the length of the key
     * @return The value or null if not found
     */
    public V getBest(ByteBuffer b, int offset, int len);

    /* ------------------------------------------------------------ */
    public Set<String> keySet();

    /* ------------------------------------------------------------ */
    public boolean isFull();

    /* ------------------------------------------------------------ */
    public boolean isCaseInsensitive();

    /* ------------------------------------------------------------ */
    public void clear();

}

@@ -99,75 +99,8 @@
 t;%0A%0A
-/* ------------------------------------------------------------ */%0A
 %0A/**
@@ -211,79 +211,8 @@
 V%3E %7B
-%0A    /* ------------------------------------------------------------ */
 %0A%0A  
@@ -402,39 +402,32 @@
 ld.%0A     */%0A    
-public 
 boolean put(Stri
@@ -443,80 +443,8 @@
 );%0A%0A
-    /* ------------------------------------------------------------ */%0A%0A
     
@@ -601,39 +601,32 @@
 ld.%0A     */%0A    
-public 
 boolean put(V v)
@@ -636,177 +636,27 @@
     
-/* ------------------------------------------------------------ */%0A    public V remove(String s);%0A%0A    /* ------------------------------------------------------------ */
+V remove(String s);
 %0A%0A  
@@ -784,39 +784,32 @@
 key%0A     */%0A    
-public 
 V get(String s);
@@ -814,80 +814,8 @@
 );%0A%0A
-    /* ------------------------------------------------------------ */%0A%0A
     
@@ -1068,31 +1068,24 @@
      */%0A    
-public 
 V get(String
@@ -1115,80 +1115,8 @@
 );%0A%0A
-    /* ------------------------------------------------------------ */%0A%0A
     
@@ -1267,39 +1267,32 @@
 und%0A     */%0A    
-public 
 V get(ByteBuffer
@@ -1301,80 +1301,8 @@
 );%0A%0A
-    /* ------------------------------------------------------------ */%0A%0A
     
@@ -1566,31 +1566,24 @@
      */%0A    
-public 
 V get(ByteBu
@@ -1617,80 +1617,8 @@
 );%0A%0A
-    /* ------------------------------------------------------------ */%0A%0A
     
@@ -1753,39 +1753,32 @@
 und%0A     */%0A    
-public 
 V getBest(String
@@ -1787,80 +1787,8 @@
 );%0A%0A
-    /* ------------------------------------------------------------ */%0A%0A
     
@@ -2032,39 +2032,32 @@
 und%0A     */%0A    
-public 
 V getBest(String
@@ -2087,80 +2087,8 @@
 );%0A%0A
-    /* ------------------------------------------------------------ */%0A%0A
     
@@ -2390,39 +2390,32 @@
 und%0A     */%0A    
-public 
 V getBest(byte%5B%5D
@@ -2445,80 +2445,8 @@
 );%0A%0A
-    /* ------------------------------------------------------------ */%0A%0A
     
@@ -2758,23 +2758,16 @@
  */%0A    
-public 
 V getBes
@@ -2813,403 +2813,91 @@
     
-/* ------------------------------------------------------------ */%0A    public Set%3CString%3E keySet();%0A%0A    /* ------------------------------------------------------------ */%0A    public boolean isFull();%0A%0A    /* ------------------------------------------------------------ */%0A    public boolean isCaseInsensitive();%0A%0A    /* ------------------------------------------------------------ */%0A    public
+Set%3CString%3E keySet();%0A%0A    boolean isFull();%0A%0A    boolean isCaseInsensitive();%0A%0A   
  voi

clean up codes