package net.ranides.assira.collection.query;

/**
 * This interfaces represents information about stream capabilities.
 * You can check if stream supports some feature by calling one of instance method or by using bit flags.
 */
public interface CQueryFeatures {

    /**
     * Returned if query implements fast, native "each" iteration
     */
    int EACH        = 0x0001;
    /**
     * Returned if query implements fast, native Stream
     */
    int STREAM      = 0x0002;
    /**
     * Returned if query implements fast, native Iterator
     */
    int ITERATOR    = 0x0004;
    /**
     * Returned if query implements fast "size" operation with O(1) complexity
     */
    int LENGTH      = 0x0008;
    /**
     * Returned if query is able to return List in O(1) time without copying elements
     */
    int LIST        = 0x0010;
    /**
     * Returned if query is in parallel mode
     */
    int PARALLEL    = 0x0020;

    /**
     * Returns "true" if query implements fast, native "each" iteration
     * @return boolean
     */
    boolean hasFastEach();

    /**
     * Returns "true" if query implements fast, native Stream
     *
     * @return boolean
     */
    boolean hasFastStream();

    /**
     * Returns "true" if query implements fast, native Iterator
     *
     * @return boolean
     */
    boolean hasFastIterator();

    /**
     * Returns "true" if query implements fast "size" operation with O(1) complexity
     *
     * @return boolean
     */
    boolean hasFastLength();

    /**
     * Returns "true" if query is able to return List in O(1) time without copying elements
     *
     * @return boolean
     */
    boolean hasFastList();

    /**
     * Returns "true" if query is in parallel mode
     *
     * @return boolean
     */
    boolean isParallel();

    /**
     * Returns supported features in bitmask.
     *
     * @return int
     */
    int flags();

}
