Oolite
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_BASE_LIBRARY)
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) ? YES : NO;
53}
54
55- (BOOL)isGreaterThan:(id)object
56{
57 return (object != nil && [self compare:object] == NSOrderedDescending) ? YES : NO;
58}
59
60- (BOOL)isGreaterThanOrEqualTo:(id)object
61{
62 return (object != nil && [self compare:object] != NSOrderedAscending) ? YES : NO;
63}
64
65- (BOOL)isLessThan:(id)object
66{
67 return (object != nil && [self compare:object] == NSOrderedAscending) ? YES : NO;
68}
69
70- (BOOL)isLessThanOrEqualTo:(id)object
71{
72 return (object != nil && [self compare:object] != NSOrderedDescending) ? YES : NO;
73}
74
75- (BOOL)isNotEqualTo:(id)object
76{
77 return (object != nil && [self compare:object] != NSOrderedSame) ? YES : NO;
78}
79
80@end
81
82#endif
return nil