Revision: 18538
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18538&view=rev
Author: hofman
Date: 2012-03-06 13:13:13 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
Only implement isEqual: and hash in concrete group subclasses that need them,
default to standard identity
Modified Paths:
--------------
trunk/bibdesk/BDSKCategoryGroup.m
trunk/bibdesk/BDSKExternalGroup.m
trunk/bibdesk/BDSKGroup.m
trunk/bibdesk/BDSKLibraryGroup.m
trunk/bibdesk/BDSKParentGroup.m
trunk/bibdesk/BDSKSmartGroup.m
trunk/bibdesk/BDSKStaticGroup.m
Modified: trunk/bibdesk/BDSKCategoryGroup.m
===================================================================
--- trunk/bibdesk/BDSKCategoryGroup.m 2012-03-06 07:35:23 UTC (rev 18537)
+++ trunk/bibdesk/BDSKCategoryGroup.m 2012-03-06 13:13:13 UTC (rev 18538)
@@ -111,8 +111,12 @@
}
- (BOOL)isEqual:(id)other {
- if ([super isEqual:other] == NO)
+ if (self == other)
+ return YES;
+ if (NO == [other isMemberOfClass:[self class]])
return NO;
+ if (NO == [[self name] isEqual:[(BDSKGroup *)other name]])
+ return NO;
return [[self key] isEqualToString:[other key]] || ([self key] == nil
&& [other key] == nil);
}
Modified: trunk/bibdesk/BDSKExternalGroup.m
===================================================================
--- trunk/bibdesk/BDSKExternalGroup.m 2012-03-06 07:35:23 UTC (rev 18537)
+++ trunk/bibdesk/BDSKExternalGroup.m 2012-03-06 13:13:13 UTC (rev 18538)
@@ -85,10 +85,6 @@
[super dealloc];
}
-- (BOOL)isEqual:(id)other { return self == other; }
-
-- (NSUInteger)hash { return BDSKHash(self); }
-
#pragma mark BDSKGroup overrides
- (BOOL)isExternal { return YES; }
Modified: trunk/bibdesk/BDSKGroup.m
===================================================================
--- trunk/bibdesk/BDSKGroup.m 2012-03-06 07:35:23 UTC (rev 18537)
+++ trunk/bibdesk/BDSKGroup.m 2012-03-06 13:13:13 UTC (rev 18538)
@@ -115,19 +115,6 @@
[super dealloc];
}
-- (NSUInteger)hash {
- return [name hash];
-}
-
-- (BOOL)isEqual:(id)other {
- if (self == other)
- return YES;
- if (![other isMemberOfClass:[self class]])
- return NO;
- // we don't care about the count for identification
- return [[self name] isEqual:[(BDSKGroup *)other name]];
-}
-
- (NSString *)description {
return [NSString stringWithFormat:@"%@<%p>: name=\"%@\",count=%ld", [self
class], self, name, (long)count];
}
Modified: trunk/bibdesk/BDSKLibraryGroup.m
===================================================================
--- trunk/bibdesk/BDSKLibraryGroup.m 2012-03-06 07:35:23 UTC (rev 18537)
+++ trunk/bibdesk/BDSKLibraryGroup.m 2012-03-06 13:13:13 UTC (rev 18538)
@@ -61,12 +61,6 @@
return [[item owner] isEqual:[self document]];
}
-- (BOOL)isEqual:(id)other { return self == other; }
-
-- (NSUInteger)hash {
- return BDSKHash(self);
-}
-
- (BOOL)isValidDropTarget { return YES; }
@end
Modified: trunk/bibdesk/BDSKParentGroup.m
===================================================================
--- trunk/bibdesk/BDSKParentGroup.m 2012-03-06 07:35:23 UTC (rev 18537)
+++ trunk/bibdesk/BDSKParentGroup.m 2012-03-06 13:13:13 UTC (rev 18538)
@@ -81,10 +81,6 @@
return [[[self class] allocWithZone:aZone] initWithName:name];
}
-- (NSUInteger)hash { return BDSKHash(self); }
-
-- (BOOL)isEqual:(id)other { return self == other; }
-
- (void)dealloc {
[children setValue:nil forKey:@"parent"];
[children setValue:nil forKey:@"document"];
Modified: trunk/bibdesk/BDSKSmartGroup.m
===================================================================
--- trunk/bibdesk/BDSKSmartGroup.m 2012-03-06 07:35:23 UTC (rev 18537)
+++ trunk/bibdesk/BDSKSmartGroup.m 2012-03-06 13:13:13 UTC (rev 18538)
@@ -111,10 +111,16 @@
[super dealloc];
}
+- (NSUInteger)hash {
+ return [[self name] hash];
+}
+
- (BOOL)isEqual:(id)other {
- if ([super isEqual:other])
- return [[self filter] isEqual:[(BDSKSmartGroup *)other filter]];
- else return NO;
+ if (self == other)
+ return YES;
+ if (NO == [other isMemberOfClass:[self class]])
+ return NO;
+ return [[self name] isEqual:[(BDSKGroup *)other name]] && [[self
filter] isEqual:[(BDSKSmartGroup *)other filter]];
}
- (NSString *)description {
Modified: trunk/bibdesk/BDSKStaticGroup.m
===================================================================
--- trunk/bibdesk/BDSKStaticGroup.m 2012-03-06 07:35:23 UTC (rev 18537)
+++ trunk/bibdesk/BDSKStaticGroup.m 2012-03-06 13:13:13 UTC (rev 18538)
@@ -99,6 +99,18 @@
[super dealloc];
}
+- (NSUInteger)hash {
+ return [[self name] hash];
+}
+
+- (BOOL)isEqual:(id)other {
+ if (self == other)
+ return YES;
+ if (NO == [other isMemberOfClass:[self class]])
+ return NO;
+ return [[self name] isEqual:[(BDSKGroup *)other name]];
+}
+
- (NSImage *)icon {
return [[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit