Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
Comparison.m
Go to the documentation of this file.
1//
2// $Id: Comparison.m,v 1.3 2004/11/29 23:35:50 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#include "Comparison.h"
46#include <Foundation/NSString.h>
47
48@implementation NSObject (OLComparison)
49
50- (BOOL) isEqualTo: (id)object
51{
52 return (object != nil && [self compare: object] == NSOrderedSame) ?
53 YES : NO;
54}
55
56- (BOOL) isGreaterThan: (id)object
57{
58 return (object != nil && [self compare: object] == NSOrderedDescending) ?
59 YES : NO;
60}
61
62- (BOOL) isGreaterThanOrEqualTo: (id)object
63{
64 return (object != nil && [self compare: object] != NSOrderedAscending) ?
65 YES : NO;
66}
67
68- (BOOL) isLessThan: (id)object
69{
70 return (object != nil && [self compare: object] == NSOrderedAscending) ?
71 YES : NO;
72}
73
74- (BOOL) isLessThanOrEqualTo: (id)object
75{
76 return (object != nil && [self compare: object] != NSOrderedDescending) ?
77 YES : NO;
78}
79
80- (BOOL) isNotEqualTo: (id)object
81{
82 return (object != nil && [self compare: object] != NSOrderedSame) ?
83 YES : NO;
84}
85
86@end
87
88#endif
return nil