All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aksw.commons.collections.FeatureMap Maven / Gradle / Ivy

There is a newer version: 0.9.9
Show newest version
package org.aksw.commons.collections;

import java.util.Collection;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.BiConsumer;

/**
 * A feature map associates a set of features with
 * items. Multiple items may have exactly the same features.
 *
 * Hence, this class is called FeatureMap for brevity, but is actually as Feature*Multi*Map.
 * Multimaps can be represented as Collections of entries; i.e. adding multiple entries with the same key is valid.
 *
 *
 * @author raven
 *
 * @param 
 * @param 
 */
public interface FeatureMap
    extends Collection, V>>
    //extends Map, Collection>
    //extends Multimap, V>
{

    default void forEach(BiConsumer, V> consumer) {
        this.forEach(e -> consumer.accept(e.getKey(), e.getValue()));
    }

    void put(Set tagSet, V value);

    boolean remove(Object tagSet);
    boolean removeValue(Object value);

    Set> keySet();
    Collection values();

    Set, Collection>> entrySet();

    // Get all items having exactly the specified feature set
    Collection get(Set prototype);
    Set> getTagSets(Object v);


    /**
     *
     * @param prototye
     * @return
     */
    Collection, V>> getIfSupersetOf(Set prototype);

    Collection, V>> getIfSubsetOf(Set prototype);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy