/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.collection.lookups;

import java.io.Serializable;
import java.util.Map;
import java.util.Set;
import net.ranides.assira.collection.IntCollection;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public interface Lookup<K> extends Map<K, Integer>, Serializable {

    /**
     * Checks whether the given value is contained in {@link #values()}.
     */
    boolean containsValue(int v);

    void defaultReturnValue(int rv);

    int defaultReturnValue();

    Set<LookupEntry<K>> fastEntrySet();

    /**
     * Returns the value to which the given key is mapped.
     *
     * @param key the key.
     * @return the corresponding value, or the
     * {@linkplain #defaultReturnValue() default return value} if no value was
     * present for the given key.
     *
     */
    int getInt(Object key);

    int put(K key, int value);

    int removeInt(Object key);

    @Override
    IntCollection values();
    
    interface LookupEntry<K> extends Map.Entry<K, Integer> {

        int setValue(int value);

        int getIntValue();

        @Override
        default Integer setValue(Integer value) {
            return setValue(value.intValue());
        }

        @Override
        default Integer getValue() {
            return getIntValue();
        }
        
    }
}
