001    package data;
002    
003    import java.io.Serializable;
004    
005    /**
006     * Condition used for filtering {@link DataBasket DataBaskets}.
007     *
008     * @author Steffen Zschaler
009     * @version 2.0 14/06/1999
010     * @since v2.0
011     */
012    public interface DataBasketCondition<T> extends DataBasketKeys, Serializable {
013    
014        /**
015         * Return the main key that {@link DataBasketEntry DataBasketEntries} must have to
016         * match the condition. Returning <code>null</code> means any main key.
017         *
018         * @override Always
019         */
020        public String getMainKey();
021    
022        /**
023         * Return the secondary key that {@link DataBasketEntry DataBasketEntries} must have to
024         * match the condition. Returning <code>null</code> means any secondary key.
025         *
026         * @override Always
027         */
028        public String getSecondaryKey();
029    
030        /**
031         * Return the source for operations that match the condition. Returning <code>null</code>
032         * means any source, other values mean exactly what they say, i.e. they are tested for
033         * identity.
034         *
035         * @override Always
036         */
037        public DataBasketEntrySource getSource();
038    
039        /**
040         * Return the destination for operations that match the condition. Returning
041         * <code>null</code> means any destination, other values mean exactly what they say, i.e.
042         * they are tested for identity.
043         *
044         * @override Always
045         */
046        public DataBasketEntryDestination getDestination();
047    
048        /**
049         * Return the object for operations that match the condition. Returning <code>null</code>
050         * means check each DataBasketEntry by calling {@link #match match()}, other values mean
051         * exactly what they say, i.e. they are tested for identity.
052         *
053         * @override Always
054         */
055        public Object getValue();
056    
057        /**
058         * Return true for DataBasketEntries that match the condition. This method is only called
059         * for DataBasketEntries that have already been filtered by their main and secondary key,
060         * as well as their source and destination. Additionally, it is only called if
061         * {@link #getValue()} returns <code>null</code>.
062         *
063         * @override Always
064         */
065        public boolean match(DataBasketEntry<T> dbe);
066    }