/* * @(#) Sortable.java - Interface for comparable/orderable objects. * (c) 2000 Ivan Maidanski http://ivmai.chat.ru * Freeware class library sources. All rights reserved. ** * Language: Java [pure] * Tested with: JDK v1.1.6 * Last modified: 2000-12-27 12:20:00 GMT+03:00 */ /* * This software is the proprietary information of the author. ** * Permission to use, copy, and distribute this software and its * documentation for non-commercial purposes and without fee is * hereby granted provided that this copyright notice appears in all * copies. ** * This software should not be modified in any way; any found bug * should be reported to the author. ** * The author disclaims all warranties with regard to this software, * including all implied warranties of merchantability and fitness. * In no event shall the author be liable for any special, indirect * or consequential damages or any damages whatsoever resulting from * loss of use, data or profits, whether in an action of contract, * negligence or other tortuous action, arising out of or in * connection with the use or performance of this software. */ package ivmai.util; /** * Interface for comparable/orderable objects. ** * Any class implementing this interface allows semantic ordering * (sorting) of its instances using its built-in 'greater-than' * comparator method. ** * @version 2.0 * @author Ivan Maidanski */ public interface Sortable { /** * Tests for being semantically greater than the argument. ** * The result is true if and only if obj is of expected * type and this object is greater than the specified * one. Important notes: in a particular final class * int compareTo(Type val) throws NullPointerException * method may be provided for user convenience. ** * @param obj * the second compared object (may be null). * @return * true if obj is comparable with * this and this object is greater than * obj, else false. ** * @since 2.0 */ public abstract boolean greaterThan(Object obj); }