14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
- (OFComparisonResult)compare:(id)otherObject
{
MenuItem *otherItem;
if (![otherObject isKindOfClass:MenuItem.class])
@throw [OFInvalidArgumentException exception];
int x = (int)_text.longLongValue;
int y = (int)otherItem.text.longLongValue;
if (x > y)
return OFOrderedAscending;
if (x < y)
return OFOrderedDescending;
return OFOrderedSame;
|
>
>
|
>
>
>
>
|
>
>
>
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
- (OFComparisonResult)compare:(id)otherObject
{
MenuItem *otherItem;
if (![otherObject isKindOfClass:MenuItem.class])
@throw [OFInvalidArgumentException exception];
int x, y;
@try {
x = (int)_text.longLongValue;
} @catch (OFInvalidFormatException *e) {
x = 0;
}
@try {
y = (int)otherItem.text.longLongValue;
} @catch (OFInvalidFormatException *e) {
y = 0;
}
if (x > y)
return OFOrderedAscending;
if (x < y)
return OFOrderedDescending;
return OFOrderedSame;
|