//
//  DTCArrayExtensions.h
//  Dragoman
//
//  Created by Philipp on 5/11/08.
//  Copyright 2015 Incredible Bee Ltd. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@interface NSArray (Additions)

#pragma mark Querying an Array

// Returns the object in the array with the lowest index value, or nil if the array is empty
-(id) firstObject;

#pragma mark Finding Objects in an Array

// Returns the indexes of objects identical to those in a given array (ignores any objects from the given array that aren't in the receiver)
-(NSIndexSet *) indexesOfObjectsIdenticalToObjectsFromArray:(NSArray *)anArray;

#pragma mark Functional-like methods

// Creates a new array by collecting the return value of passing aSelector message to each element
-(NSArray *)map:(SEL)aSelector;

// Like map but sends aSelector message with anObject as argument
-(NSArray *)map:(SEL)aSelector withObject:(id)anObject;


#pragma mark Filename methods

// Returns only the path extension from a filename (NSString) array
-(NSArray *)pathExtensions;

// Swap extensions
-(NSArray *)swapExtensions:(NSString *)newExtensions;

// Determines whether the array (of filenames) all have one of the given file extensions
-(BOOL) belongToTypes:(NSArray *)anExtensionList;

-(BOOL) belongToSameType;

@end
