001    /*
002    Copyright (c) 1996-2012, Damon Hart-Davis
003    All rights reserved.
004    
005    Redistribution and use in source and binary forms, with or without
006    modification, are permitted provided that the following conditions are
007    met:
008    
009      * Redistributions of source code must retain the above copyright
010        notice, this list of conditions and the following disclaimer.
011    
012      * Redistributions in binary form must reproduce the above copyright
013        notice, this list of conditions and the following disclaimer in the
014        documentation and/or other materials provided with the
015        distribution.
016    
017    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
018    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
019    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
020    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
021    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
022    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
023    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
024    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
025    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
026    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
027    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028    */
029    package org.hd.d.pg2k.webSvr.exhibit;
030    
031    import org.hd.d.pg2k.svrCore.AllExhibitProperties;
032    import org.hd.d.pg2k.svrCore.Name;
033    import org.hd.d.pg2k.svrCore.Name.ExhibitFull;
034    
035    /**Interface for a class to sort exhibits (for a FilterBean).
036     * Sorters must be Serializable so that expressions can
037     * be persisted.  They must not attempt to cache any reference,
038     * direct or indirect, to a DataSourceBean.
039     * <p>
040     * Sorter objects must be immutable and the sort() method must be
041     * idempotent.
042     * <p>
043     * This interface may be used by any operation that needs to
044     * operate on the whole (remaining) set of exhibits at once.
045     * <p>
046     * A sort routine may return its input array re-arranged, or may
047     * return a new array.
048     * <p>
049     * In no case must it leave nulls or duplicates in the result,
050     * nor may the result be null.
051     * <p>
052     * Implementing classes should implement equals() and hashCode() properly.
053     */
054    public interface SortIF extends ExprIF
055        {
056        /**Sorts the given exhibits (specified by full name) in situ; never null. */
057        public ExhibitFull[] sort(AllExhibitProperties aep, Name.ExhibitFull[] exhibitNames);
058        }