Show
Ignore:
Timestamp:
06/13/08 15:57:37 (4 years ago)
Author:
gbooker
Message:

Changed the filtering method and the check for unwatched/favorite. This new system is far more powerful, and should actually be faster too. Implemented a bit more caching to help speed as well.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireDirectoryMetaData.m

    r586 r588  
    8080} 
    8181 
     82- (id)initWithEntity:(NSEntityDescription *)entity insertIntoManagedObjectContext:(NSManagedObjectContext *)context 
     83{ 
     84        self = [super initWithEntity:entity insertIntoManagedObjectContext:context]; 
     85        if(self == nil) 
     86                return self; 
     87         
     88        Basic_Directory_Function_Inits 
     89         
     90        return self; 
     91}        
     92 
    8293- (void) dealloc 
    8394{ 
     
    212223        NSArray *candidates = [[self.metaDirsSet allObjects] filteredArrayUsingPredicate:pred]; 
    213224        if([candidates count]) 
    214                 return [candidates objectAtIndex:0]; 
    215          
    216         candidates  = [[self.linkedDirsSet allObjects] filteredArrayUsingPredicate:pred]; 
    217         if([candidates count]) 
    218                 return ((SapphireDirectorySymLink *)[candidates objectAtIndex:0]).directory; 
     225                ret = [candidates objectAtIndex:0]; 
     226        else 
     227        { 
     228                candidates  = [[self.linkedDirsSet allObjects] filteredArrayUsingPredicate:pred]; 
     229                if([candidates count]) 
     230                        ret = ((SapphireDirectorySymLink *)[candidates objectAtIndex:0]).directory;              
     231        } 
     232        [ret setFilterPredicate:filterPredicate]; 
    219233         
    220234        return nil; 
     
    387401                for(i=0; i<count; i++) 
    388402                { 
    389                         if(![[allDirs objectAtIndex:i] checkPredicate:filterPredicate]) 
     403                        if(![[allDirs objectAtIndex:i] containsFileMatchingFilterPredicate:filterPredicate]) 
    390404                        { 
    391405                                [allDirs removeObjectAtIndex:i]; 
     
    402416                { 
    403417                        SapphireDirectorySymLink *link = [linkedDirsObjects objectAtIndex:i]; 
    404                         if([[link directory] checkPredicate:filterPredicate]) 
     418                        if([[link directory] containsFileMatchingFilterPredicate:filterPredicate]) 
    405419                                [allDirs addObject:link]; 
    406420                } 
     
    442456} 
    443457 
    444 /*Function to invoke a command on all files in a subtree*/ 
    445 - (void)invokeRecursivelyOnFiles:(NSInvocation *)fileInv 
     458- (void)invokeOnAllFiles:(NSInvocation *)fileInv 
    446459{ 
    447460        NSManagedObjectContext *moc = [self managedObjectContext];