Line data Source code
1 0 : // 2 : // $Id: Comparison.h,v 1.3 2004/12/12 20:17:24 will_mason Exp $ 3 : // 4 : // vi: set ft=objc: 5 : 6 : /* 7 : * ObjectiveLib - a library of containers and algorithms for Objective-C 8 : * 9 : * Copyright (c) 2004 10 : * Will Mason 11 : * 12 : * Portions: 13 : * 14 : * Copyright (c) 1994 15 : * Hewlett-Packard Company 16 : * 17 : * Copyright (c) 1996,1997 18 : * Silicon Graphics Computer Systems, Inc. 19 : * 20 : * Copyright (c) 1997 21 : * Moscow Center for SPARC Technology 22 : * 23 : * Copyright (c) 1999 24 : * Boris Fomitchev 25 : * 26 : * This library is free software; you can redistribute it and/or 27 : * modify it under the terms of the GNU Lesser General Public 28 : * License as published by the Free Software Foundation; either 29 : * version 2.1 of the License, or (at your option) any later version. 30 : * 31 : * This library is distributed in the hope that it will be useful, 32 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 33 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 34 : * Lesser General Public License for more details. 35 : * 36 : * You should have received a copy of the GNU Lesser General Public 37 : * License along with this library; if not, write to the Free Software 38 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 39 : * 40 : * You may contact the author at will_mason@users.sourceforge.net. 41 : */ 42 : 43 : #if defined(GNUSTEP) 44 : 45 : #if !defined(__COMPARISON_OL_GUARD) 46 : #define __COMPARISON_OL_GUARD 47 : 48 : #include <Foundation/NSObject.h> 49 : 50 : /** 51 : * @category NSObject(OLComparisonMethods) Comparison.h Objectivelib/Comparison.h 52 : * 53 : * Comparison methods used in @ref Functors "function objects". These comparison 54 : * methods are only required to be included when GNUstep is the platform, as 55 : * Cocoa already defines them. Under Cocoa they are declared in the 56 : * intuitively-named file @c NSScriptWhoseTests.h. All of these methods send 57 : * the message @c compare: to the receiving object. 58 : * 59 : * @pre The receiving object must implement the method @c compare:. 60 : */ 61 : @interface NSObject (OLComparisonMethods) 62 : 63 : /** 64 : * Return whether another object is equal to this one. This message returns YES if 65 : * and only if the message @c compare: returns @c NSOrderedSame. 66 : * 67 : * @param object the object to which to compare this one 68 : * @return YES if @a object is equal to this one, NO otherwise 69 : */ 70 : - (BOOL) isEqualTo: (id)object; 71 : 72 : /** 73 : * Return whether this object is greater than another one. This message returns 74 : * YES if and only if @c compare: returns @c NSOrderedDescending. 75 : * 76 : * @param object the object to which to compare this one 77 : * @return YES if this object is greater than @a object, NO otherwise 78 : */ 79 : - (BOOL) isGreaterThan: (id)object; 80 : 81 : /** 82 : * Return whether this object is greater than or equal to another one. This message returns 83 : * YES if and only if @c compare: does not return @c NSOrderedAscending. 84 : * 85 : * @param object the object to which to compare this one 86 : * @return YES if this object is greater than or equal to @a object, NO otherwise 87 : */ 88 : - (BOOL) isGreaterThanOrEqualTo: (id)object; 89 : 90 : /** 91 : * Return whether this object is less than another one. This message returns 92 : * YES if and only if @c compare: returns @c NSOrderedAscending. 93 : * 94 : * @param object the object to which to compare this one 95 : * @return YES if this object is less than @a object, NO otherwise 96 : */ 97 : - (BOOL) isLessThan: (id)object; 98 : 99 : /** 100 : * Return whether this object is less than or equal to another one. This message returns 101 : * YES if and only if @c compare: does not return @c NSOrderedDescending. 102 : * 103 : * @param object the object to which to compare this one 104 : * @return YES if this object is less than or equal to @a object, NO otherwise 105 : */ 106 : - (BOOL) isLessThanOrEqualTo: (id)object; 107 : 108 : /** 109 : * Return whether another object is not equal to this one. This message returns YES if 110 : * and only if the message @c compare: does not return @c NSOrderedSame. 111 : * 112 : * @param object the object to which to compare this one 113 : * @return YES if @a object is not equal to this one, NO otherwise 114 : */ 115 : - (BOOL) isNotEqualTo: (id)object; 116 : 117 : @end 118 : 119 : #endif 120 : 121 : #endif