001package de.monochromata.anaphors.ast.feature;
002
003import java.util.Set;
004
005/**
006 * A collection of features.
007 * <p>
008 * It is assumed that features can be enumerated, have no order or precedence
009 * and that each feature container has a finite number of features.
010 * </p>
011 *
012 * @param <QI>
013 *            The type used to represent qualified identifiers
014 */
015public interface FeatureContainer<QI> {
016
017        /**
018         * Provides access to the features of this container.
019         *
020         * <p>
021         * TODO: Maybe return a sorted set?
022         * </p>
023         *
024         * @return The set of features in the container. The set is not modifiable.
025         */
026        public Set<Feature<QI>> getFeatures();
027
028        /**
029         * Returns true, if this container contains no features.
030         *
031         * @return {@literal} true}, if {@link #getFeatures()} returns an empty set,
032         *         {@literal false} otherwise.
033         */
034        public boolean isEmpty();
035
036        /**
037         * Compares the features in this container to the features in the given
038         * container.
039         *
040         * @param other
041         *            another container whose features are to be compared to the
042         *            features in this container.
043         * @return {literal true}, if this container contains all features contained
044         *         in the given container, {@literal false} otherwise.
045         */
046        public boolean containsFeaturesOf(FeatureContainer<QI> other);
047
048}